function checkEmail() { var err_msg = ''; if (document.forms['frmContactUs'].name.value == '') { err_msg = "Please enter your name!"; } if (err_msg.length == 0) { if (document.forms['frmContactUs'].custemail.value == '') { err_msg = "Please enter your email address!"; } } if (err_msg.length == 0) { if (document.forms['frmContactUs'].comment.value == '') { err_msg = "Please enter your enquiry!"; } } if (err_msg.length != 0) { alert(err_msg); return false; } return true; } function submitEmail() { if (checkEmail()) { document.forms['frmContactUs'].action = "mailer.php"; document.forms['frmContactUs'].submit(); } } function changeOn(td,col,sel,cur){ if (sel != 1) { if (cur == 1) { td.style.cursor = 'pointer'; } td.style.backgroundColor=col; } } function changeOut(td,col,sel){ if (sel != 1) { td.style.cursor = 'default'; td.style.backgroundColor=col; } } function submitClick (urlStub) { window.location = urlStub; } function checkEmailAddr(strCheck) { var i = 0; var at_counter = 0; var alpha_counter = 0; var dot_counter = 0; for (i=0; i < strCheck.length; i++) { //find ascii value of character a = strCheck.charCodeAt(i); //Check ascii value within permitted characters A..Z, a..z, 0..9 if ((a >= 65 && a <= 90) || (a >= 97 && a <= 122) || (a >= 48) && (a <= 57)) { //Increment alpha counter alpha_counter++; } if (a == 46) { //Increment dot counter dot_counter++; } if (a == 64) { //Increment @ counter at_counter++; } } if ((alpha_counter >= 3) && (at_counter == 1) && (dot_counter >= 1)) { //Returns true to submit return true; } return false; } function isDataOKCheck(strToCheck,okType) { var okArray = ""; var flagNotOK = false; switch (okType) { case 0: var okArray = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 "; break; case 1: var okArray = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; break; case 2: var okArray = "0123456789"; break; case 3: var okArray = "0123456789+() "; break; case 4: var okArray = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; break; } if (strToCheck.length > 0) { for (i=0; i < strToCheck.length; i++) { strChar = strToCheck.charAt(i); for (j=0; j < okArray.length; j++) { if (strChar == okArray.charAt(j)) { break; } if (j == (okArray.length - 1)) { flagNotOK = true; break; } } if (flagNotOK == true) { break; } } } if (flagNotOK == false) { return true; } return false; } function submitLogin(refURL,loginType) { var err_msg = ""; if (loginType == 0) { var strUname = document.getElementById('ulogin'); var strPwd = document.getElementById('upwd'); var url = 'userLogin.php'; } else { var strUname = document.getElementById('strUsername'); var strPwd = document.getElementById('strPassword'); var strPwdConfirm = document.getElementById('strPasswordConfirm'); var strEmailAddress = document.getElementById('strEmailAddress'); var url = 'citroxx.php'; } if (err_msg.length == 0) { if (strUname) { if (strUname.value == "") { err_msg = "Please enter a username!"; } else { if ((strUname.value.length < 5) || (strUname.value.length > 15)) { err_msg = "Please enter a username that is between 5 and 15 characters in length!"; } } } } if (err_msg.length == 0) { if (strEmailAddress) { if (strEmailAddress.value == "") { err_msg = "Please enter your email address!"; } else { if (!checkEmailAddr(strEmailAddress.value)) { err_msg = "Please check your email address!"; } } } } if (err_msg.length == 0) { if (strPwd) { if (strPwd.value == "") { err_msg = "Please enter a password!"; } else { if (!isDataOKCheck(strPwd.value,4)) { err_msg = "Please check your password!"; } else { if ((strPwd.value.length < 6) || (strPwd.value.length > 10)) { err_msg = "Passwords should be between 6 and 10 characters long!"; } } if (err_msg.length != 0) { strPwd.value = ""; if (strPwdConfirm) { strPwdConfirm.value = ""; } strPwd.focus(); } } } } if (err_msg.length == 0) { if (strPwdConfirm) { if (strPwdConfirm.value == "") { err_msg = "Please enter a password!"; } else { if (!isDataOKCheck(strPwdConfirm.value,4)) { err_msg = "Please check your password!"; } else { if ((strPwdConfirm.value.length < 6) || (strPwdConfirm.value.length > 10)) { err_msg = "Passwords should be between 6 and 10 characters long!"; } } if (err_msg.length != 0) { strPwd.value = ""; strPwdConfirm.value = ""; strPwd.focus(); } } } } if (err_msg.length != 0) { alert(err_msg); } else { document.forms['frmLogin'].action = url; document.forms['frmLogin'].submit(); } } function submitReminder() { var err_msg = ""; if (err_msg.length == 0) { if (document.forms['frmReminder'].strEmailAddress.value == "") { err_msg = "Please enter your email address!"; } else { if (!checkEmailAddr(document.forms['frmReminder'].strEmailAddress.value)) { err_msg = "Please check your email address!"; } } } if (err_msg.length != 0) { alert(err_msg); } else { document.forms['frmReminder'].action = "userReminder.php?pid=contact_confirm"; document.forms['frmReminder'].submit(); } } function submitPassword() { var err_msg = ""; if (err_msg.length == 0) { if (document.forms['frmPassword'].strUserName) { if (document.forms['frmPassword'].strUserName.value == "") { err_msg = "Please enter a username!"; } } } if (err_msg.length == 0) { if (document.forms['frmPassword'].strUserName) { if ((document.forms['frmPassword'].strUserName.value.length < 6) || (document.forms['frmPassword'].strUserName.value.length > 10)) { err_msg = "Please enter a username that is between 6 and 10 characters in length!"; } } } if (err_msg.length == 0) { if (document.forms['frmPassword'].strPassword) { if (document.forms['frmPassword'].strPassword.value == "") { err_msg = "Please enter a password!"; } else { if (!isDataOKCheck(document.forms['frmPassword'].strPassword.value,4)) { err_msg = "Please check your password!"; } else { if ((document.forms['frmPassword'].strPassword.value.length < 6) || (document.forms['frmPassword'].strPassword.value.length > 10)) { err_msg = "Passwords should be between 6 and 10 characters long!"; } } if (err_msg.length != 0) { document.forms['frmPassword'].strPassword.value = ""; document.forms['frmPassword'].strPasswordConfirm.value = ""; document.forms['frmPassword'].strPassword.focus(); } } } } if (err_msg.length == 0) { if (document.forms['frmPassword'].strPasswordConfirm) { if (document.forms['frmPassword'].strPasswordConfirm.value == "") { err_msg = "Please confirm your password!"; } } } if (err_msg.length == 0) { if (document.forms['frmPassword'].strPasswordConfirm) { if (document.forms['frmPassword'].strPassword.value != document.forms['frmPassword'].strPasswordConfirm.value) { document.forms['frmPassword'].strPassword.value = ""; document.forms['frmPassword'].strPasswordConfirm.value = ""; document.forms['frmPassword'].strPassword.focus(); err_msg = "Your passwords do not match! Please re-enter your passwords"; } } } if (err_msg.length != 0) { alert(err_msg); } else { document.forms['frmPassword'].action = "updatePassword.php"; document.forms['frmPassword'].submit(); } } function isPopupBlocker() { var oWin = window.open("","testpopupblocker","width=100,height=50,top=5000,left=5000"); if (oWin==null || typeof(oWin)=="undefined") { alert('You have a popup blocker installed!'); } else { oWin.close(); } }