/* Create the htprequest opbect and process the readystate contents */ function createRequestObject() { if (window.XMLHttpRequest && !(window.ActiveXObject)) { return new XMLHttpRequest(); } else if (window.ActiveXObject){ /* return new ActiveXObject('Microsoft.XMLHTTP'); */ try { return new ActiveXObject('MSXML2.XMLHTTP'); } catch (e) { return new ActiveXObject('Microsoft.XMLHTTP'); } } } var http = createRequestObject(); function handleResponse() { if(http.readyState == 4){ var response = http.responseText; if (response != 'undefined' && response != '') { var update = new Array(); var up2 = new Array(); if(response.indexOf('|||' != -1) ) { update = response.split('|||'); for (var i = 1; i to_date) { alert(msg); return false; } return true; } function DateCheck(syr, smt, sdt, msg) { hdt=sdt[sdt.selectedIndex].value; hmt=smt[smt.selectedIndex].value; hyr=syr[syr.selectedIndex].value; hms_maxval=31; if ((hmt=="APR") || (hmt=="JUN") || (hmt=="SEP") || (hmt=="NOV")){hms_maxval=30;} if ((hmt=="FEB") && (hyr%4)==0){hms_maxval=29;} if ((hmt=="FEB") && (hyr%4)!=0){hms_maxval=28;} if (parseInt(hdt)>hms_maxval) { alert(msg); return false; } return true; } function validateLogin(form) { ErrorMsg = new Array(); ErrorMsg[0]="------------------------- The Following Errors Occured -------------------------" + String.fromCharCode(13); CheckFieldString("noblank",form.txtusername,"{$lang.signup_js_errors.username_noblank}"); CheckFieldString("noblank",form.txtpassword,"{$lang.signup_js_errors.password_noblank}"); CheckFieldString("alphanum",form.txtusername,"{$lang.signup_js_errors.username_charset}"); CheckFieldString("alphanum",form.txtpassword,"{$lang.signup_js_errors.password_charset}"); /* concat all error messages into one string */ result=""; if( ErrorCount > 0) { alert(ErrorMsg[1]); return false; } return true; } // After clicking a link to delete something, pops up a window asking the user to confirm // If the user clicks ok, it tacks delete=Y to the url. If the user clicks cancel, // it returns false which leaves the user on the page. // // Ex. Delete // function confirmLink(theLink, theMessage) { var is_confirmed = confirm(theMessage); if (is_confirmed) { theLink.href += '&delete=Y'; } return is_confirmed; } // After clicking a submit button, pops up a window asking the user to confirm // If the user clicks ok, it proceeds. If the user clicks cancel, it cancels submitting // the form // // ex. // function confirmButton(theMessage) { var is_confirmed = confirm(theMessage); return is_confirmed; } // The next two functions comprise the text counting for a text box. // function countCheck(countLimit) { if(document.frmCmt.comment.value.length > countLimit) { alert('Too many characters in the comment box!'); document.frmCmt.comment.focus(); return false; } else return true; } function countText(countLimit) { var old = document.frmCmt.counter.value; document.frmCmt.counter.value=document.frmCmt.comment.value.length; if(document.frmCmt.counter.value > countLimit && old <= countLimit) { alert('Too many characters in the comment box!'); if(document.styleSheets) { document.frmCmt.counter.style.fontWeight = 'bold'; document.frmCmt.counter.style.color = '#ff0000'; } } else if(document.frmCmt.counter.value <= countLimit && old > countLimit && document.styleSheets ) { document.frmCmt.counter.style.fontWeight = 'normal'; document.frmCmt.counter.style.color = '#000000'; } } function openInParentWindow(url) { window.opener.document.location.href=url; window.opener.focus(); } /* To validate the type of input values in the form fields */ function CheckFieldString(type, formField, strMsg) { var checkOK; var checkStr = formField.value; var allValid = true; var flagDot = false; var namestr, domainstr; if (type == 'noblank') { if (checkStr == "") { ErrorCount++; ErrorMsg[ErrorCount] = strMsg ; } } else { if (type == 'integer') { checkOK = "0123456789"; } else if (type == 'decimal'){ checkOK = "0123456789."; } else if (type == 'text') { /* checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz "; */ checkOK = text_chars; } else if (type == 'alphanumeric') { /* checkOK = "0123456789.+-_#,/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ()_"; */ checkOK = alphanumeric_chars; } else if (type == 'full') { /* checkOK = "0123456789.,[]{}=+-_#,/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ()_:;'\\*^%$@<>?'\"\'"; */ checkOK = full_chars; } else if (type == 'alphanum') { /* checkOK = "0123456789_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz "; */ checkOK = alphanum_chars; } else if (type == 'email'){ checkOK = "0123456789_-@.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; if ( /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,7})+$/.test(checkStr) ){ }else{ ErrorCount++; ErrorMsg[ErrorCount] = strMsg ; } } else if (type == 'phone') { checkOK = "0123456789-+"; } else if (type == 'URL') { checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.:/\\"; } else if (type == 'path') { checkOK = "0123456789.+-_#,/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz () \\ "; } else { ErrorCount++; ErrorMsg[ErrorCount] = "Check Validation one of the mentioned validation type is wrong" ; return 1; } /* code for email validation */ /* if ((type == 'email') && (checkStr != "")) { namestr = checkStr.substring(0, checkStr.indexOf("@")); // everything before the '@' domainstr = checkStr.substring(checkStr.indexOf("@")+1, checkStr.length); // everything after the '@' // Rules: namestr cannot be empty, or that would indicate no characters before the '@', // domainstr must contain a period that is not the first character (i.e. right after // the '@'). The last character must be an alpha. if ((namestr.length == 0) || (domainstr.indexOf(".") <= 0) || (domainstr.indexOf("@") != -1)) { ErrorCount++; ErrorMsg[ErrorCount] = "Enter a valid Email Address." ; } } */ for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) { if (ch == checkOK.charAt(j)) { break; } if (j == checkOK.length-1 ){ allValid = false; break; } } if (type == 'decimal') /* for decimal type */ { for (t = 0; t < checkStr.length; t++){ dot = checkStr.charAt(t) if (dot =='.' && flagDot == false) { flagDot=true; } else if (dot =='.' && flagDot == true){ ErrorCount++; ErrorMsg[ErrorCount] = strMsg ; break; } } } if (!allValid){ ErrorCount++; ErrorMsg[ErrorCount] = strMsg ; break; } } } } // captcha reload function reloadCaptcha() { now = new Date(); var capObj = document.getElementById('spam_code_img'); if (capObj) { capObj.src = capObj.src + (capObj.src.indexOf('?') > -1 ? '&' : '?') + Math.ceil(Math.random()*(now.getTime())); } }