function validateLogin() { if((checkBlank('loginForm','userName','Please enter username')) || (checkBlank('loginForm','pwd','Please enter password'))) { if((checkBlank('loginForm','userName','Please enter username')) && (checkBlank('loginForm','pwd','Please enter password'))) { return true; } return false; } else { return false; } } function checkBlank(formName, fieldName,alertMsg) { var fld = ""; eval("fld = document."+formName+ "." +fieldName+".value"); if(fld == "") { document.getElementById("div_"+fieldName).innerHTML = alertMsg; try { document.getElementById("div_"+fieldName).style.display = "block"; } catch(e) {} return false; } else { return true; } } function isZip(formName, fieldName, alertMsg) { var t1 = ""; eval("t1 = document."+formName+ "." +fieldName+".value"); t2 = parseInt(t1.length); if ((parseInt(t1) > 0) ) { return true; } else { document.getElementById("div_"+fieldName).innerHTML = alertMsg; try { document.getElementById("div_"+fieldName).style.display = "block"; } catch(e) {} return false; } } function clearErrorMsg(fieldName) { try { document.getElementById("div_"+fieldName).innerHTML = ""; } catch(e) {} try { document.getElementById("div_"+fieldName).style.display = "none"; } catch(e) {} } function substituteBlankSpace(queryString) { queryString = queryString.replace(/\ /g,"%20"); return queryString; } function popUp(URL, width, height) { day = new Date(); id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width='+width+',height='+height+',left=100,top=100');"); } function closePopup() { window.close(); } function DisableButton(bName) { try { b = document.getElementById(bName); b.disabled = true; b.value = 'Submitting'; } catch(e) {} } function EnableButton(bName) { try { b = document.getElementById(bName); b.disabled = false; b.value = 'Save'; } catch(e) {} } function isBlank(formName, fieldName) { var fld = ""; eval("fld = document."+formName+ "." +fieldName+".value"); if(fld == "") { var alrt = "Please Enter "+fieldName; alert(alrt); eval("document."+formName+"."+fieldName+".focus()"); return false; } else { return true; } } function checkIsBlank(formName, fieldName,alertMsg) { var fld = ""; eval("fld = document."+formName+ "." +fieldName+".value"); var clsName = ""; try { clsName = document.getElementById(fieldName).className; } catch(e) {} try { if(clsName =="clsHighlights") { document.getElementById(fieldName).className = ""; } } catch(e) {} if(fld == "") { alert(alertMsg); eval("document."+formName+"."+fieldName+".focus()"); try { document.getElementById(fieldName).className = "clsHighlights"; } catch(e) {} return false; } else { return true; } } function isNumber(formName, fieldName) { var t1 = ""; eval("t1 = document."+formName+ "." +fieldName+".value"); if (parseInt(t1) >= 0) { return true; } else { alert("Please enter " + fieldName + " as integer number."); eval("document."+formName+"."+fieldName+".focus()"); return false; } } function trim(strInput) { return strInput.replace(/^\s+/g, '').replace(/\s+$/g, ''); } function isPhoneNumber(formName,ph1,ph2,ph3, alertMsg,msgDiv) { str1 = eval("document."+ formName +"."+ph1+".value"); str2 = eval("document."+ formName +"."+ph2+".value"); str3 = eval("document."+ formName +"."+ph3+".value"); if (str1 == "") { try { document.getElementById("div_"+msgDiv).innerHTML = "Please enter area code in "+alertMsg+" number"; } catch(e) {} try { document.getElementById("div_"+msgDiv).style.display = "block"; } catch(e) {} return false; } if (str2 == "") { try { document.getElementById("div_"+msgDiv).innerHTML = "Please check the "+alertMsg+" number"; } catch(e) {} try { document.getElementById("div_"+msgDiv).style.display = "block"; } catch(e) {} return false; } if (str3 == "") { try { document.getElementById("div_"+msgDiv).innerHTML = "Please check the "+alertMsg+" number"; } catch(e) {} try { document.getElementById("div_"+msgDiv).style.display = "block"; } catch(e) {} return false; } var str = str1 + str2 + str3; for (var i = 0; i < str.length; i++) { var ch = str.substring(i, i + 1); if (ch < "0" || "9" < ch) { try { document.getElementById("div_"+msgDiv).innerHTML = alertMsg +" number should be numeric"; } catch(e) {} try { document.getElementById("div_"+msgDiv).style.display = "block"; } catch(e) {} return false; } } if (str.length != 10) { try { document.getElementById("div_"+msgDiv).innerHTML = alertMsg +" number should have 10 digits"; } catch(e) {} try { document.getElementById("div_"+msgDiv).style.display = "block"; } catch(e) {} return false; } return true; } function isPasswordOk(formName, fieldName1, fieldName2) { eval("str = document."+formName+ "." +fieldName1+".value"); eval("str1 = document."+formName+ "." +fieldName2+".value"); str = trim(str); str1 = trim(str1); if (str == "") { alert("Enter Your Password."); eval("document."+formName+"."+fieldName1+".value=str"); eval("document."+formName+"."+fieldName1+".select()"); eval("document."+formName+"."+fieldName1+".focus()"); return false; } if(str.length <6) { alert("Your Password Should be at least 6 Characters."); eval("document."+formName+"."+fieldName1+".select()"); eval("document."+formName+"."+fieldName1+".focus()"); return false; } if (str1 == "") { alert("Please Confirm Your Password."); eval("document."+formName+"."+fieldName1+".value=str1"); eval("document."+formName+"."+fieldName2+".select()"); eval("document."+formName+"."+fieldName2+".focus()"); return false; } if (str == str1) { } else { alert("Confirm Your Password Again."); eval("document."+formName+"."+fieldName2+".value=\"\""); eval("document."+formName+"."+fieldName2+".select()"); eval("document."+formName+"."+fieldName2+".focus()"); return false; } return true; } /** * email validation script. */ function isEmailOk(formName, fieldName) { var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ var email = ""; try { eval("email = document."+formName+"."+fieldName+".value"); } catch(e) {} if (email == "") { try { document.getElementById("div_"+fieldName).innerHTML = "Please enter E-mail address."; } catch(e) {} try { document.getElementById("div_"+fieldName).style.display = "block"; } catch(e) {} return false; } if (!email.match(re)) { try { document.getElementById("div_"+fieldName).innerHTML = "Check E-mail Address!"; } catch(e) {} try { document.getElementById("div_"+fieldName).style.display = "block"; } catch(e) {} return (false); } return(true); } function autoTab(formName, srcFiled,trgtField) { var ph = ""; eval("ph = document."+formName+"."+srcFiled+".value"); var phLen = ph.length; if(phLen == 3) { eval("document."+formName+"."+trgtField+".focus()"); } } function isRadioCheck(formName, fieldName,alertMsg) { var fld = ""; var fldCnt = 0; eval("var obj = document."+formName+ "." +fieldName); for(var i=0; i 0) { return true; } else { try { document.getElementById("div_"+fieldName).innerHTML = alertMsg; } catch(e) {} try { document.getElementById("div_"+fieldName).style.display = "block"; } catch(e) {} return false; } } function format_number(pnumber,decimals){ if (isNaN(pnumber)) { return 0}; if (pnumber=='') { return 0}; var snum = new String(pnumber); var sec = snum.split('.'); var whole = parseFloat(sec[0]); var result = ''; if(sec.length > 1){ var dec = new String(sec[1]); dec = String(parseFloat(sec[1])/Math.pow(10,(dec.length - decimals))); dec = String(whole + Math.round(parseFloat(dec))/Math.pow(10,decimals)); var dot = dec.indexOf('.'); if(dot == -1){ dec += '.'; dot = dec.indexOf('.'); } while(dec.length <= dot + decimals) { dec += '0'; } result = dec; } else{ var dot; var dec = new String(whole); dec += '.'; dot = dec.indexOf('.'); while(dec.length <= dot + decimals) { dec += '0'; } result = dec; } return result; } function gotoHome() { window.location.href="index.php"; } function gotoVisitInfo(visitId, opt) { window.location.href="addVisitInformation.php?visitId="+visitId+"&opt="+opt; } function goBack() { history.back(); } function gotoHomeWithSelected(visitId) { window.location.href="index.php?visitId="+visitId; } function updateEmail() { var myEmail = ""; try { myEmail = document.formEmail.myEmail.value; } catch(e) {} try { document.formEmail.email.value = myEmail; } catch(e) {} }