// JavaScript Document var whitespace = " \t\n\r"; function isEmpty(s) //Checks whether string is Empty { return ((s == null) || (s.length == 0)) } function isWhitespace (s) //Checks for White spaces in the string { var i; if (isEmpty(s)) return true; for (i = 0; i < s.length; i++) { var c = s.charAt(i); if (whitespace.indexOf(c) == -1) return false; } return true; } function poplinks(url) { newwindow=window.open(url,'ImageDisplay','height=600,width=600,left=0,top=0,resizable=yes,scrollbars=yes'); if (window.focus) {newwindow.focus()} } function confirmMsg(msg){ if(!confirm(msg)){ return false; } else { return true; } } function ordervalidate() { Name=document.frmorder.txtname; if(Name.value=="") { alert("Enter the Name"); Name.focus(); return false; } Email=document.frmorder.txtemail; if(Email.value=="") { alert("Enter the Email"); Email.focus(); return false; } if (!validateEmail(Email.value,1,1)) { Email.focus(); return false; } txtcountry=document.frmorder.txtcountry; if(txtcountry.value=="") { alert("Enter the Country"); txtcountry.focus(); return false; } return true; } function order_validate() { Name=document.frm_order.txtname; if(Name.value=="") { alert("Enter the Name"); Name.focus(); return false; } Email=document.frm_order.txtemail; if(Email.value=="") { alert("Enter the Email"); Email.focus(); return false; } if (!validateEmail(Email.value,1,1)) { Email.focus(); return false; } txtcountry=document.frm_order.txtcountry; if(txtcountry.value=="") { alert("Select the Country"); txtcountry.focus(); return false; } return true; } function validateEmail(addr,man,db) { if (addr == '' && man) { if (db) alert('Email address is mandatory'); return false; } var invalidChars = '\/\'\\ ";:?!()[]\{\}^|'; for (i=0; i -1) { if (db) alert('Email address contains invalid characters'); return false; } } for (i=0; i127) { if (db) alert("Email address contains non ascii characters."); return false; } } var atPos = addr.indexOf('@',0); if (atPos == -1) { if (db) alert('Email address must contain an @'); return false; } if (atPos == 0) { if (db) alert('Email address must not start with @'); return false; } if (addr.indexOf('@', atPos + 1) > - 1) { if (db) alert('Email address must contain only one @'); return false; } if (addr.indexOf('.', atPos) == -1) { if (db) alert('Email address must contain a period in the domain name'); return false; } if (addr.indexOf('@.',0) != -1) { if (db) alert('period must not immediately follow @ in email address'); return false; } if (addr.indexOf('.@',0) != -1){ if (db) alert('period must not immediately precede @ in email address'); return false; } if (addr.indexOf('..',0) != -1) { if (db) alert('two periods must not be adjacent in email address'); return false; } var suffix = addr.substring(addr.lastIndexOf('.')+1); if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' & suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') { if (db) alert('invalid primary domain in email address'); return false; } return true; }