<!--

//Courtesy of SmartWebby.com
var digits = "0123456789";
var phoneNumberDelimiters = "()- ";
var validWorldPhoneChars = phoneNumberDelimiters + "+";
var minDigitsInIPhoneNumber = 10;

function isInteger(s){   
var i;
for (i = 0; i < s.length; i++){   
// Check that current character is number.
var c = s.charAt(i);
if (((c < "0") || (c > "9"))) return false;
}
// All characters are numbers.
return true;
}

function stripCharsInBag(s, bag){   var i;
var returnString = "";
// Search through string's characters one by one.
// If character is not in bag, append to returnString.
for (i = 0; i < s.length; i++){   
// Check that current character isn't whitespace.
var c = s.charAt(i);
if (bag.indexOf(c) == -1) returnString += c;
}
return returnString;
}

function checkInternationalPhone(strPhone){
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

function validate_phone(a){
var g=eval(a).value;
if ((g==null)||(g=="")){
alert("Please enter your Phone Number");
eval(a).focus();
return false;
}
if (checkInternationalPhone(g)==false){
alert("Please enter Phone Number in the format shown.");
eval(a).value="";
eval(a).focus();
return false;
}
return true;
}

// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
var i;
for (i = 0; i < s.length; i++){   
// Check that current character is number.
var c = s.charAt(i);
if (((c < "0") || (c > "9"))) return false;

// All characters are numbers.
return true;
}
}

function stripCharsInBag(s, bag){
var i;
var returnString = "";
// Search through string's characters one by one.
// If character is not in bag, append to returnString.
for (i = 0; i < s.length; i++){   
var c = s.charAt(i);
if (bag.indexOf(c) == -1) returnString += c;
}
return returnString;
}

function daysInFebruary (year){
// February has 29 days in any year evenly divisible by four,
// EXCEPT for centurial years which are not also divisible by 400.
return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
for (var i = 1; i <= n; i++) {
this[i] = 31
if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
if (i==2) {this[i] = 29}
} 
return this
}

function isDate(a){
var dtStr=eval(a).value;
var daysInMonth = DaysArray(12)
var pos1=dtStr.indexOf(dtCh)
var pos2=dtStr.indexOf(dtCh,pos1+1)
var strMonth=dtStr.substring(0,pos1)
var strDay=dtStr.substring(pos1+1,pos2)
var strYear=dtStr.substring(pos2+1)
strYr=strYear
if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
for (var i = 1; i <= 3; i++) {
if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
}
month=parseInt(strMonth)
day=parseInt(strDay)
year=parseInt(strYr)
if (pos1==-1 || pos2==-1){
alert("The date format should be : mm/dd/yyyy")
return false
}
if (strMonth.length<1 || month<1 || month>12){
alert("Please enter a valid month")
eval(a).value="";
return false
}
if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
alert("Please enter a valid day")
eval(a).value="";
return false
}
if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
eval(a).value="";
return false
}
if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
alert("Please enter a valid date")
eval(a).value="";
return false
}
return true
}

function check_email(a) {
var x = eval(a).value;
var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
if (!(filter.test(x))) {
alert("Please enter a valid Email address");
eval(a).focus();
eval(a).value="";
return false;
}
return true;
}

function check_alphanum(a) {
var x = eval(a).value;
// space is also present in the string
var filter=/^([ a-zA-Z0-9,.-])+$/;
if (!(filter.test(x))) {
alert("Please enter only letters and/or numbers.");
eval(a).value="";
eval(a).focus();
return false;
}
return true;
}

function check_num(a,b) {
var x = eval(a).value;
// space is also present in the string
var filter  = /^([0-9])+$/;
if (!(filter.test(x))) {
alert("Please enter only a number(s).");
eval(a).value="";
eval(a).focus();
return false;
}
if ((b=="ssn") && (x.length != 9)){
alert("Please enter a valid social security number.");
eval(a).value="";
eval(a).focus();
return false;
}
return true;
}

function verify(){
// Modified per Audra 1/22 (SPF)
//if (document.hear.how1.checked==false && document.hear.how2.checked==false && document.hear.how3.checked==false && document.hear.how4.checked==false && document.hear.how5.checked==false && document.hear.how6.checked==false && document.hear.how7.checked==false && document.hear.how8.checked==false && document.hear.how9.value==""){
if (document.hear.how1.checked==false && document.hear.how2.checked==false && document.hear.how3.checked==false && document.hear.how4.checked==false && document.hear.how5.checked==false && document.hear.how9.value==""  && document.hear.how11.value==""  ){
alert("Please enter referral information to continue");
return;
} 

 
if ((document.hear.how1.checked==true || document.hear.how2.checked==true || document.hear.how3.checked==true || document.hear.how4.checked==true || document.hear.how5.checked==true) && document.hear.adcode.value==""){
alert("Your selection requires a Ad Code. Please enter an Ad Code to continue");
document.hear.adcode.focus();
return;

}
//Commented Sujith,
//if ((document.hear.how6.checked==true) && document.hear.how11.value==""){
//alert("Please specify your referral in the box provided.");
//return;
//}
document.hear.submit();
}


function verifynew(){
// Modified per Audra 1/22 (SPF)
//if (document.hear.how1.checked==false && document.hear.how2.checked==false && document.hear.how3.checked==false && document.hear.how4.checked==false && document.hear.how5.checked==false && document.hear.how6.checked==false && document.hear.how7.checked==false && document.hear.how8.checked==false && document.hear.how9.value==""){
if (document.hear.how1.checked==false && document.hear.how2.checked==false && document.hear.how3.checked==false && document.hear.how4.checked==false && document.hear.how5.checked==false ){
alert("Please enter referral information to continue");
return;
} 

 
if ((document.hear.how1.checked==true || document.hear.how2.checked==true || document.hear.how3.checked==true || document.hear.how5.checked==true) && document.hear.adcode.value==""){
alert("Your selection requires a Ad Code. Please enter an Ad Code to continue");
document.hear.adcode.focus();
return;
}

if (document.hear.how4.checked==true && document.hear.referer.value==""){
alert("Your selection requires Referring Persons Name. Please enter the information");
document.hear.referer.focus();
return;

}
//Commented Sujith,
//if ((document.hear.how6.checked==true) && document.hear.how11.value==""){
//alert("Please specify your referral in the box provided.");
//return;
//}
document.hear.submit();
}

function choose(a){
	if(a!=1){document.hear.how1.checked=false;}
	if(a!=2){document.hear.how2.checked=false;}
	if(a!=3){document.hear.how3.checked=false;}
	if(a!=4){document.hear.how4.checked=false;}
	if(a!=5){document.hear.how5.checked=false;}
	//if(a!=6){document.hear.how6.checked=false;}
	//if(a!=7){document.hear.how7.checked=false;}
	//if(a!=8){document.hear.how8.checked=false;}
	if(a!=9){document.hear.how9.value="";}
}

function check_clear(){
var ret_val = confirm("Are you sure you want to clear\nall information from this form?");
if (ret_val ==true){
document.app.reset();
}else{
return;
}
}

function gourl(a){
document.entry.flag.value="1";
location.href=a;
//window.open('http://www.legacyjobline.com/unload.asp','MyWindow','width=360,height=280,left=225,top=150,screenX=225,screenY=150,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no');
}

function checkurl(){
var a=document.cookie;
if ( (document.entry.flag.value!="1") && (a.indexOf("applied")==-1) ){
self.location.href = "unload.php";
}
}

function resetflag(){
document.entry.flag.value="";
}
//-->


