﻿var lastTable="";var phone1=new phoneInfo();alertIcon=new Image();alertIcon.src="/common/Form/Images/alert.gif";clearIcon=new Image();clearIcon.src="/common/Form/Images/alert.clear.gif";function SetAlert(pTurnOn,pFieldID){var iName;iName="i"+pFieldID;if(pTurnOn){document[iName].src=eval("alertIcon.src");return 1}else{document[iName].src=eval("clearIcon.src");return 0}return}function AdviceAndValidate(pField,pFieldID,pType,pMin,pMax,pFormat){var wasError=0;hideAdvice();if($(pField).val()==undefined|!pField){return false}if((pType!="DDL")&&(pType!="PHN")){wasError=validateLength(pField,pFieldID,pMin,pMax)}switch(pType){case"DDL":if(pFormat==pField[pField.selectedIndex].value){SetAlert(true,pFieldID);return true}else{SetAlert(false,pFieldID);return false}break;case"OIN":if(pField.checked){SetAlert(false,pFieldID);return false}else{SetAlert(true,pFieldID);return true}break;case"DTE":if(validateDate(pField,pFormat)){SetAlert(true,pFieldID);return true}else{SetAlert(false,pFieldID);return false}break;case"NUM":if(validateNum(pField,pFormat)){SetAlert(true,pFieldID);return true}else{SetAlert(false,pFieldID);return false}break;case"PHN":if(validateNumberOfLengthMax(pField,pMax)){if(pFieldID.indexOf("1")!=-1){phone1.setgood()}return false}else{if(pFieldID.indexOf("1")!=-1){phone1.setbad(pFieldID)}return true}break;case"EML":if(!validateEmail(pField)){SetAlert(true,pFieldID);return true}else{SetAlert(false,pFieldID);return false}break}phone1.setAlertDisplay("Phone1AreaCode");return wasError}function validateLength(pField,pFieldID,pMin,pMax){var minOK,maxOK,iName;iName="i"+pFieldID;minOK=maxOK=true;if(pField.value.length<pMin&&pMin!=0){minOK=false}if(pField.value.length>pMax&&pMax!=0){maxOK=false}if(!minOK||!maxOK){SetAlert(true,pFieldID);return true}else{SetAlert(false,pFieldID);return false}}function validateAlpha(pField){var err;for(i=0;i<pField.length;i++){if(pField.charAt(i)==" "){err=1}if(pField.charAt(i)=="-"){err=1}if(pField.charAt(i)=="!"){err=1}if(pField.charAt(i)=="@"){err=1}if(pField.charAt(i)=="."){err=1}if(pField.charAt(i)>"="){err=1}if(pField.charAt(i)>")"){err=1}}if(err==1){return 1}else{return 0}}function validateNumberOfLengthMax(pField,pLength){var regex=new RegExp("[0-9]{"+pLength+"}");return(regex.test(pField.value))}function showAdvice(message,title,tableName,displayheight){var cell;var s="";if(message.length==0){return}cell=document.getElementById("help");s=s+"<table border=0 cellspacing=0 cellpadding=0>";s=s+"<tr><td><img src=/common/images/blank.gif height="+displayheight+" width=1></td></tr>";s=s+"<tr class='bydform'>";s=s+"<td width='3%' height='2'><img src='/common/Form/images/frame.topleft.gif' width=20 height=12></td>";s=s+"<td background='/common/Form/images/frame.top.gif' width='91%' height=2><img src='/common/Form/images/cleardot.gif' width='2' height='2'></td>";s=s+"<td width='6%' height=2><img src='/common/Form/images/frame.topright.gif' width='20' height='12'></td>";s=s+"</tr>";s=s+"<tr height=1 bgcolor='F5F5F5'>";s=s+"<td width='3%' background='/common/Form/images/frame.left.upper.gif'><img src='/common/Form/images/cleardot.gif' width='2' height='2'></td>";s=s+"<td width='91%' bgcolor='F5F5F5' align='center'>";s=s+"<font face='verdana' size='1'><b>";s=s+title+"</b></font>";s=s+"</td>";s=s+"<td width='6%' background='/common/Form/images/frame.right.upper.gif'><img src='/common/Form/images/cleardot.gif' width='2' height='2'></td>";s=s+"</tr>";s=s+"<tr class='bydform'>";s=s+"  <td width='3%'><img src='/common/Form/images/frame.mid.left.gif' width='20' height='5'></td>";s=s+"  <td width='91%' background='/common/Form/images/frame.mid.gif'><img src='/common/Form/images/cleardot.gif' width='2' height='2'></td>";s=s+"  <td width='6%'><img src='/common/Form/images/frame.mid.right.gif' width='20' height='5'></td>";s=s+"</tr>";s=s+"<tr>";s=s+"  <td width='3%' background='/common/Form/images/frame.left.low.gif'><img src='/common/Form/images/cleardot.gif' width='2' height='2'></td>";s=s+"  <td width='91%' bgcolor=#FFFFFF>";s=s+"<!-- FORM BEGIN -->";s=s+"<table border=0  cellpadding=0 cellspacing=0 id='groupTable' width='100%'> ";s=s+"<tr>";s=s+"<td colspan='3'></td>";s=s+"</tr>";s=s+"<!-- FIELDS BEGIN -->";s=s+"<tr><td background=''><table border=0 >";s=s+"<tr><td background=''>"+message;s=s+"</td></tr>";s=s+"</TD></TR></TABLE>";s=s+"</TD></TR></TABLE>";s=s+"<td width='6%' background='/common/Form/images/frame.right.lower.gif'><img src='/common/Form/images/cleardot.gif' width=2 height=2></td>";s=s+"</tr>";s=s+"<tr>";s=s+"<td width='3%'><img src='/common/Form/images/frame.bottomleft.gif' width=20 height=20></td>";s=s+"<td width='91%' background='/common/Form/images/frame.bottom.gif'><img src='/common/Form/images/cleardot.gif' width=2 height=2></td>";s=s+"<td width='6%'><img src='/common/Form/images/frame.bottomright.gif' width=20 height=20></td>";s=s+"</tr>";s=s+"</table>";cell.innerHTML=s;lastTable=tableName}function hideAdvice(){var cell;if(lastTable!=""){cell=document.getElementById("help");cell.innerText=""}lastTable=""}function validateEmail(pField){if(!validateEmailRegex(pField.value)){alert("Please enter a valid email address.");return(false)}if(!validateEmailBlacklist(pField.value)){alert("Please enter a valid email address.");return(false)}if(!validationEmailTypos(pField.value)){alert("Please enter a valid email address.");return(false)}return(true)}function matchFields(field1,field2,message){if(field1.value!=field2.value){alert(message);return false}return true}function checkURLandEmail(){var email=F.FSendToEmail.value;var url=F.FApplyURL.value;if(email.length==0&&url.length==0){alert("Enter an Email Address or URL");return false}if(url.length>0&&url.indexOf("http://")==-1&&url.indexOf("https://")==-1){alert('Invalid Apply URL:  A valid Apply URL should contain "http://"');return false}return true}function disableSubmit(F){F.submitbutton.value="   Processing...   ";F.submitbutton.disabled=true;return true}function checkEmail(F){var toReturn;toReturn=true;var email=F.FEmailAddress.value;if(email.length==0){toReturn=true}else{if(email.indexOf("@")<0){alert("Email must have an '@'");toReturn=false}if(email.indexOf(".")<0){alert("Email must have an a '.'");toReturn=false}}return toReturn}function validateBoolean(){var keywords=document.F.FKeywords.value;var searchType=document.F.FSearchType.value;var numQuotes=0;var openParens=0;var closedParens=0;var goodQuotes=false;var goodParens=false;if(keywords){if(searchType==5||searchType=="BOOLEAN"){keywords=keywords.replace(/'/g,'"');numQuotes=keywords.replaceAll('[^"]',"").length;if((numQuotes%2)!=0){alert("A boolean keyword search must contain an even number of quotes.");return false}else{openParens=keywords.replaceAll("[^(]","").length;closedParens=keywords.replaceAll("[^)]","").length;if(openParens!=closedParens){alert("A boolean keyword search must contain an equal number of open and closed parenthesis.");return false}else{document.F.FKeywords.value=keywords;return true}}}else{return true}}else{return true}}function validateAll(){var keywords=document.F.FKeywords.value;var searchType=document.F.FSearchType.value;if(keywords){if((searchType==2||searchType=="ALL")||(searchType==3||searchType=="ANY")||(searchType==6||searchType=="TITLE-ANY")||(searchType==0||searchType=="ANY")||(searchType==1||searchType=="FREE")){keywords=keywords.replace(/['"]/g,"");document.F.FKeywords.value=keywords;return true}else{return false}}}String.prototype.replaceAll=function(s1,s2){return this.replace(new RegExp(s1,"g"),s2)};function containsDigit(str){var regex=/\d/g;return regex.test(str)}function valButton(btn){var cnt=-1;for(var i=btn.length-1;i>-1;i--){if(btn[i].checked){cnt=i;i=-1}}if(cnt>-1){return btn[cnt].value}else{return null}}function validFieldLength(strValue,strName,iMin,iMax){if((iMin<=strValue.length)&&(strValue.length<=iMax)){return true}else{alert("Please verify your "+strName+". A valid "+strName+" is "+iMin+" to "+iMax+" characters long.");return false}}function clickClear(thisfield,defaulttext){if(thisfield.value==defaulttext){thisfield.value=""}}function clickRecall(thisfield,defaulttext){if(thisfield.value==""){thisfield.value=defaulttext}}function validateEmailRegex(email){var filter=/^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;if(filter.test(email)){return true}else{return false}}function validateMultiEmail(email){email=email.replace(/[\s]|[ ]/g,"");var filter=/^(([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+([\,]|[\;]){0,1}([\n])*)+$/;if(filter.test(email)){return true}else{return false}}function validateEmailBlacklist(email){if(email.indexOf("@hotjobs")>=0){return(false)}if(email.indexOf("@monster")>=0){return(false)}if(email.indexOf("blacklist@")>=0){return(false)}if(email.indexOf("bulkmail@")>=0){return(false)}if(email.indexOf("devnull@")>=0){return(false)}if(email.indexOf("mailer-daemon@")>=0){return(false)}if(email.indexOf("@mailinator.com")>=0){return(false)}if(email.indexOf("@mytrashmail.com")>=0){return(false)}return true}function validationEmailTypos(email){email=email.toLowerCase();if(email.indexOf("@gmial.com")>=0){return(false)}if(email.indexOf("@gmail.cm")>=0){return(false)}if(email.indexOf("@hotmaill.com")>=0){return(false)}if(email.indexOf("@htomail.com")>=0){return(false)}if(email.indexOf("@yahoomail.com")>=0){return(false)}if(email.indexOf("@a0l.com")>=0){return(false)}if(email.indexOf("@ahoo.com")>=0){return(false)}if(email.indexOf("@ayahoo.com")>=0){return(false)}if(email.indexOf("@ayhoo.com")>=0){return(false)}if(email.indexOf("@cocast.net")>=0){return(false)}if(email.indexOf("@cocmast.net")>=0){return(false)}if(email.indexOf("@comast.net")>=0){return(false)}if(email.indexOf("@comcas.net")>=0){return(false)}if(email.indexOf("@comcst.net")>=0){return(false)}if(email.indexOf("@concast.net")>=0){return(false)}if(email.indexOf("@gamil.com")>=0){return(false)}if(email.indexOf("@gmai.com")>=0){return(false)}if(email.indexOf("@gmaill.com")>=0){return(false)}if(email.indexOf("@gmal.com")>=0){return(false)}if(email.indexOf("@homail.com")>=0){return(false)}if(email.indexOf("@homtail.com")>=0){return(false)}if(email.indexOf("@hotamil.com")>=0){return(false)}if(email.indexOf("@hotmai.com")>=0){return(false)}if(email.indexOf("@hotmal.com")>=0){return(false)}if(email.indexOf("@hotmial.com")>=0){return(false)}if(email.indexOf("@hotmil.com")>=0){return(false)}if(email.indexOf("@yaahoo.com")>=0){return(false)}if(email.indexOf("@yah00.com")>=0){return(false)}if(email.indexOf("@yahaoo.com")>=0){return(false)}if(email.indexOf("@yahho.com")>=0){return(false)}if(email.indexOf("@yaho.com")>=0){return(false)}if(email.indexOf("@yahool.com")>=0){return(false)}if(email.indexOf("@yahooo.com")>=0){return(false)}if(email.indexOf("@yahpp.com")>=0){return(false)}if(email.indexOf("@yaoo.com")>=0){return(false)}if(email.indexOf("@yayoo.com")>=0){return(false)}if(email.indexOf("@yhaoo.com")>=0){return(false)}if(email.indexOf("@yhoo.com")>=0){return(false)}if(email.indexOf("@yohoo.com")>=0){return(false)}if(email.indexOf("@yahoo.cm")>=0){return(false)}if(email.indexOf("@yshoo.com")>=0){return(false)}if(email.indexOf("@aol.ocm")>=0){return(false)}if(email.indexOf("@aol.om")>=0){return(false)}if(email.indexOf("@aol.con")>=0){return(false)}if(email.indexOf("@gail.com")>=0){return(false)}if(email.indexOf("@gmail.con")>=0){return(false)}if(email.indexOf("@gmail.om")>=0){return(false)}if(email.indexOf("@gnail.com")>=0){return(false)}if(email.indexOf("@hotmail.cm")>=0){return(false)}if(email.indexOf("@hotmail.con")>=0){return(false)}if(email.indexOf("@hotmail.om")>=0){return(false)}if(email.indexOf("@verion.net")>=0){return(false)}if(email.indexOf("@yahoo.cim")>=0){return(false)}if(email.indexOf("@yahoo.come")>=0){return(false)}if(email.indexOf("@yahoo.comm")>=0){return(false)}if(email.indexOf("@yahoo.con")>=0){return(false)}if(email.indexOf("@yahoo.coom")>=0){return(false)}if(email.indexOf("@yahoo.cpm")>=0){return(false)}if(email.indexOf("@yahoo.ocm")>=0){return(false)}if(email.indexOf("@yahoo.om")>=0){return(false)}if(email.indexOf("@yahoo.vom")>=0){return(false)}if(email.indexOf("@tahoo.com")>=0){return(false)}var filter=/^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+(cmo|hotmial|htomail|yhoo|hotmial|ogr|eud|rog|deu|nte|txt)+$/;if(filter.test(email)){return false}else{return true}return true}function phoneInfo(){this.goodcount=0;this.badcount=0;this.setbad=setPhoneBad;this.setgood=setPhoneGood;this.setAlertDisplay=setPhoneAlertDisplay}function setPhoneBad(fieldid){this.badcount++}function setPhoneGood(){this.goodcount++}function setPhoneAlertDisplay(phonefield){if(this.badcount>0){SetAlert(true,phonefield)}if(this.goodcount==3){SetAlert(false,phonefield)}this.goodcount=0;this.badcount=0};
