// JavaScript Document function Hide(sp) { var x = document.getElementById(sp); if (x!=null) { x.style.display = 'none'; } } function Show(sp) { var x = document.getElementById(sp); if (x!=null) { x.style.display = 'inline'; } } function Hint(el,msg) { if ((el.value == '' && msg > '') || (msg == '')) { el.value = msg; } } function _Numbers(iObj) { var i, pStr; var strValidChars = "0123456789"; pStr = iObj.value; for (i = 0; i < pStr.length; i++) { var c = pStr.charAt(i); if(strValidChars.indexOf(c) < 0) { window.alert("Please use numeric characters only"); iObj.value = pStr.substring(0,i) iObj.focus(); return; } } } function isTelephoneNum(pStr) { var i; var j = pStr; var strValidChars = "0123456789+()-. "; pStr = j.replace(/ +/g,''); for (i = 0; i < pStr.length; i++) { var c = pStr.charAt(i); if(strValidChars.indexOf(c) < 0) { return false; } } return true; } function isName(pStr) { var nameexp = /^([a-z,']+\s*\-*)+$/i; return( nameexp.test(pStr) ); } function isEmail(pStr) { var objText=pStr; var reg01 = /(@.*@)|(\.\.)|(@\.)|\,|\;|\\|\!|\%|\$|\&|\*|\(|\)|\=|\s|\'|\"|(\.@)|(^\.)/; // not valid var reg02 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/; // is valid return( (!reg01.test(objText) && reg02.test(objText)) ); } function Subscribe() { var focusobj; with (document.frmNewsletter) { email.style.color = '#000000'; title.style.color = '#000000'; firstname.style.color = '#000000'; surname.style.color = '#000000'; company.style.color = '#000000'; jobtitle.style.color = '#000000'; country.style.color = '#000000'; if (email.value.length==0 || email.value == 'Email Address' || (!isEmail(email.value))) { email.style.color = 'red'; if (! focusobj) focusobj = email; } if (title.value.length==0 || title.value == 'Title') { title.style.color = 'red'; if (! focusobj) focusobj = title; } if (firstname.value.length==0 || firstname.value == 'First Name') { firstname.style.color = 'red'; if (! focusobj) focusobj = firstname; } if (surname.value.length==0 || surname.value == 'Surname') { surname.style.color = 'red'; if (! focusobj) focusobj = surname; } if (company.value.length==0 || company.value == 'Company') { company.style.color = 'red'; if (! focusobj) focusobj = company; } if (jobtitle.value.length==0 || jobtitle.value == 'Job Title') { jobtitle.style.color = 'red'; if (! focusobj) focusobj = jobtitle; } if (country.value.length==0 || country.value == 'Country') { country.style.color = 'red'; if (! focusobj) focusobj = country; } if (! focusobj) { submit(); } } } function Suggest() { var focusobj; Hide('spSug'); Hide('spSEmail'); with (document.frmSuggestion) { if (email.value.length==0 || (!isEmail(email.value))) { Show('spSEmail'); if (! focusobj) focusobj = email; } if (suggestion.value.length==0) { Show('spSug'); if (! focusobj) focusobj = suggestion; } if (! focusobj) { submit(); } } }