//////////////////////////////////////////////////////////////////////////// // db Masters' Links Directory 3.5, Copyright (c) 2003 dB Masters Multimedia // Content Manager comes with ABSOLUTELY NO WARRANTY // Licensed under the AGPL // See license.txt and readme.txt for details //////////////////////////////////////////////////////////////////////////// function validate_cat() { if(validate_required(document.getElementById('form').name,"Please enter a name for this category.")==false) { return false; } } function validate_link() { if(validate_required(document.getElementById('form').name,"Please enter a name for this link.")==false) { return false; } else if(validate_required(document.getElementById('form').dsc,"Please enter a short description of the link.")==false) { return false; } else if(validate_required(document.getElementById('form').url,"Please enter the URL of the link.")==false) { return false; } else if(validate_required(document.getElementById('form').email,"Please enter an email address.")==false) { return false; } } function validate_add() { if(validate_required(document.getElementById('form').name,"Please enter a name for the link.")==false) { return false; } else if(validate_required(document.getElementById('form').dsc,"Please enter a short description of the link.")==false) { return false; } else if(validate_required(document.getElementById('form').url,"Please enter the URL of the link.")==false) { return false; } else if(validate_email(document.getElementById('form').email,"Please enter a valid email address.")==false) { return false; } else if(validate_required(document.getElementById('form').password,"Please enter a password.")==false) { return false; } } function validate_edit() { if(validate_required(document.getElementById('form').name,"Please enter a name for the link.")==false) { return false; } else if(validate_required(document.getElementById('form').dsc,"Please enter a short description of the link.")==false) { return false; } else if(validate_required(document.getElementById('form').url,"Please enter the URL of the link.")==false) { return false; } else if(validate_required(document.getElementById('form').email,"Please enter an email address.")==false) { return false; } else if(validate_required(document.getElementById('form').password,"Please enter a password.")==false) { return false; } } function validate_login() { if(validate_required(document.getElementById('form').url,"Please enter the URL of the link you wish to edit.")==false) { return false; } else if(validate_required(document.getElementById('form').email,"Please enter the email address you registered the link with.")==false) { return false; } else if(validate_required(document.getElementById('form').password,"Please enter the password you registered the link with.")==false) { return false; } } function validate_admin() { if(validate_required(document.getElementById('form').pw,"Please enter a password.")==false) { return false; } } function validate_remind() { if(validate_required(document.getElementById('form').email,"Please enter your email address.")==false) { return false; } } function blocking(nr) { if (document.getElementById) { current=(document.getElementById(nr).style.display=='none')?'block':'none'; document.getElementById(nr).style.display=current; } } function validate_required(field,alerttxt) { with (field) { if (value==null||value=="") { if (!alerttxt=="") { alert(alerttxt); style.background = "yellow"; focus(); } return false; } else { return true; } } } function check_numeric(field,alerttxt) { with (field) { if (value==null||IsNumeric(value) == false) { alert(alerttxt);return false; } else { return true; } } } function IsNumeric(strString) // check for valid numeric strings { var strValidChars = "0123456789.-"; var strChar; var blnResult = true; if (strString.length == 0) return false; // test strString consists of valid characters listed above for (i = 0; i < strString.length && blnResult == true; i++) { strChar = strString.charAt(i); if (strValidChars.indexOf(strChar) == -1) { blnResult = false; } } return blnResult; } function validate_email(field,alerttxt) { with (field) { apos=value.indexOf("@"); dotpos=value.lastIndexOf("."); if (apos<1||dotpos-apos<2) { alert(alerttxt); style.background = "yellow"; focus(); return false; } else {return true;} } } //----------------------------------------