var NOTNULL = 0; var ISNUMERIC = 1; var ISALPHA = 2; var ISALPHANUM = 3; var ISEMAIL = 4; var ISTEL = 5; var REQD = 1; var NOTREQD = 0; var numericExp = /^[0-9]+$/; var telExp = /^[0-9\(\)\-\ \+]+$/; var alphaExp = /^[a-zA-Z]+$/; var alphanumExp = /^[0-9a-zA-Z]+$/; var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; function checkField2(thisForm, thisField, thisType, thisREQD) { var thisFieldText; thisFieldText = thisField.replace("_", " "); switch (thisType) { case NOTNULL : if (document.getElementById(thisField).value == null || document.getElementById(thisField).value.length == 0) { return '* You must complete the ' + thisFieldText + ' field!' + '\n\n'; } else { return ''; } break; case ISNUMERIC : if (thisREQD == NOTREQD && document.getElementById(thisField).value == null) { return ''; } else if (document.getElementById(thisField).value.match(numericExp)) { return ''; } else { { return '* You may only use numeric values to complete the ' + thisFieldText + ' field!' + '\n\n'; } } break; case ISTEL : if (thisREQD == NOTREQD && document.getElementById(thisField).value == null) { return ''; } else { if (document.getElementById(thisField).value.match(telExp)) { return ''; } else { return 'Please supply a valid telephone number as our preferred suppliers may need to call with question to ensure you receive the correct information.' + '\n\n'; } } break; case ISALPHA : if (thisREQD == NOTREQD && document.getElementById(thisField).value == null) { return ''; } else { if (document.getElementById(thisField).value.match(alphaExp)) { return ''; } else { return '* You may only use alpha values to complete the ' + thisFieldText + ' field!' + '\n\n'; } } break; case ISALPHANUM : if (thisREQD == NOTREQD && document.getElementById(thisField).value == null) { return ''; } else { if (document.getElementById(thisField).value.match(alphanumExp)) { return ''; } else { return '* You may only use alphanumeric values to complete the ' + thisFieldText + ' field!' + '\n\n'; } } break; case ISEMAIL : if (thisREQD == NOTREQD && document.getElementById(thisField).value == null) { return ''; } else { if (document.getElementById(thisField).value.match(emailExp)) { return ''; } else { return '*You may only use valid email addresses to complete the ' + thisFieldText + ' field!' + '\n\n'; } } break; default : return 'Error!'; }; } function checkField(thisForm, thisField, thisType, thisREQD) { var varForm = document.getElementById(thisForm); switch (thisType) { case NOTNULL : if (document.getElementById(thisField).value == null) { return true; } else { alert('You must complete the ' + thisField + ' field!'); return false; } break; case ISNUMERIC : if (thisREQD == NOTREQD && document.getElementById(thisField).value.length == 0) { return true; } else if (document.getElementById(thisField).value.match(numericExp)) { return true; } else { { alert('You may only use numeric values to complete the ' + thisField + ' field!'); return false; } } break; case ISTEL : if (thisREQD == NOTREQD && document.getElementById(thisField).value.length == 0) { return true; } else { if (document.getElementById(thisField).value.match(telExp)) { return true; } else { alert('Please supply a valid telephone number as our preferred suppliers may need to call with question to ensure you receive the correct information.'); return false; } } break; case ISALPHA : if (thisREQD == NOTREQD && document.getElementById(thisField).value.length == 0) { return true; } else { if (document.getElementById(thisField).value.match(alphaExp)) { return true; } else { alert('You may only use alpha values to complete the ' + thisField + ' field!'); return false; } } break; case ISALPHANUM : if (thisREQD == NOTREQD && document.getElementById(thisField).value.length == 0) { return true; } else { if (document.getElementById(thisField).value.match(alphanumExp)) { return true; } else { alert('You may only use alphanumeric values to complete the ' + thisField + ' field!'); return false; } } break; case ISEMAIL : if (thisREQD == NOTREQD && document.getElementById(thisField).value.length == 0) { return true; } else { if (document.getElementById(thisField).value.match(emailExp)) { return true; } else { alert('You may only use valid email addresses to complete the ' + thisField + ' field!'); return false; } } break; default : return false; }; } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i0) if (t==1){ //fromto ma=a[i+1].split('_');if(isNaN(v)||v ma[1]/1){err=true} } else if (t==2){ rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-zA-Z]{2,4}$");if(!rx.test(v))err=true; } else if (t==3){ // date ma=a[i+1].split("#");at=v.match(ma[0]); if(at){ cd=(at[ma[1]])?at[ma[1]]:1;cm=at[ma[2]]-1;cy=at[ma[3]]; dte=new Date(cy,cm,cd); if(dte.getFullYear()!=cy||dte.getDate()!=cd||dte.getMonth()!=cm){err=true}; }else{err=true} } else if (t==4){ // time ma=a[i+1].split("#");at=v.match(ma[0]);if(!at){err=true} } else if (t==5){ // check this 2 if(o1.length)o1=o1[a[i+1].replace(/(.*\[)|(\].*)/ig,"")]; if(!o1.checked){err=true} } else if (t==6){ // the same if(v!=MM_findObj(a[i+1]).value){err=true} } } else if (!o.type&&o.length>0&&o[0].type=='radio'){ at = a[i].match(/(.*)\[(\d+)\].*/i); o2=(o.length>1)?o[at[2]]:o; if (t==1&&o2&&o2.checked&&o1&&o1.value.length/1==0){err=true} if (t==2){ oo=false; for(j=0;j