<!--
// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in a phone no.
var minDigitsInIPhoneNumber = 7;

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 checkPhone(strPhone){
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}
function ValidateForm(){
	var Phone=document.sndInfo.Phone1
	
	if ((Phone.value==null)||(Phone.value=="")){
		return true
	}
	if (checkPhone(Phone.value)==false){
		return true
	}
	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&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_setTextOfTextfield(objName,x,newText) { //v3.0
  var obj = MM_findObj(objName); if (obj) obj.value = newText;
}

function button1_onclick() {
	if(document.sndInfo.Fname.value =="" || document.sndInfo.Fname.value =="First Name")
	{
		//No first name -Stop Submission
		alert("You have not entered a First Name.");
		return;
	}
	if(document.sndInfo.Lname.value =="" || document.sndInfo.Lname.value =="Last Name")
	{
		//No last name -Stop Submission
		alert("You have not entered a Last Name.");
		return;
	}
	if(checkEmail(document.sndInfo.email.value) && (ValidateForm()))
	{
		//No mail Address -Stop Submission
		alert("You have not provided a valid Email address\nnor a valid primary Phone number");
		return;
	}
	if(document.sndInfo.City.value =="" || document.sndInfo.City.value =="City")
	{
		//No from Address -Stop Submission
		alert("You have not provided your city.");
		return;
	}
	if(document.sndInfo.DlClass.value =="Select...")
	{
		//No first name -Stop Submission
		alert("You have not entered Drivers License Class");
		document.sndInfo.DlClass.focus();
		return;
	}
	SubmitForm();
}
function SubmitForm()
{
	document.sndInfo.action = 'Careers2.asp';
	if(checkEmail(document.sndInfo.email.value))
		{
			document.sndInfo.email.value="Not_Provided@somehost.com";
		}
	//The encoding must be set to a different type in order to not
	//use the upload component.
	document.sndInfo.encoding = 'application/x-www-form-urlencoded';
	document.sndInfo.submit();
};

function checkEmail(str) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(str))
	{
	return (false)
	}
	return (true)
	}

//-->