// JavaScript Document
<!--


function win_pop(url) {

theWindow = window.open(url,"newWin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=600,height=480,left=0,top=0");

}


function invalidEmail(text){
var badFlag = 0
if ((text.indexOf("@") == -1) || (text.indexOf(".")== -1) || (text.indexOf(" ") != -1) || text.substring(text.length-1, text.length) == "@" || text.substring(0,1) == "@" || text.substring(text.length-1, text.length) == "." || text.substring(0,1) == "." ) {
	badFlag = 1
	}
	return badFlag
}



function validateForm(form) {
	if (form.business_name.value == "") {
		alert("Please enter the Producer's Business Name !")
		form.business_name.focus()
		return false
	}
	
	if (form.business_address.value == "") {
		alert("Please enter the Producer's Business Address !")
		form.business_address.focus()
		return false
	}
	
	if (form.city.value == "") {
		alert("Please enter the City !")
		form.city.focus()
		return false
	}
	
	if (form.state.selectedIndex == 0) {
		alert("Please select the State !")
		form.state.focus()
		return false
	}
	
	if (form.zip_code.value == "") {
		alert("Please enter the Zip Code !")
		form.zip_code.focus()
		return false
	}
	
	var theZip = form.zip_code.value;
	var theLength = theZip.length;
	var goodZip = true;
	if (theLength != 5 && theLength != 0) {
		goodZip = false;
	}
	if (theLength == 5) {
		for (var i = 0; i < 5; i++) {
			var theChar = theZip.substring(i, i+1);
			if (theChar < "0" || theChar > "9") {
				goodZip = false;
			}
		}
	}
	if (goodZip == false) {
		alert("The zip code must be a 5 digit number !")
		form.zip_code.focus()
		form.zip_code.select()
		return false
	}
	
	if (form.signed_by_officer.value == "") {
		alert("Please enter the Officer's Name !")
		form.signed_by_officer.focus()
		return false
	}
	
	if (form.tax_id_or_ss_number.value == "") {
		alert("Please enter the Tax ID or Social Security Number !")
		form.tax_id_or_ss_number.focus()
		return false
	}	
	
	if (form.phone_area_code.value == "") {
		alert("Please enter the area code for the phone number !")
		form.phone_area_code.focus()
		return false
	}
	
	if (form.phone1.value == "") {
		alert("Please enter the first three digits of the phone number !")
		form.phone1.focus()
		return false
	}
	
	if (form.phone2.value == "") {
		alert("Please enter the last four digits of the phone number !")
		form.phone2.focus()
		return false
	}
	
	var theAreaCode = form.phone_area_code.value;
	var theLength = theAreaCode.length;
	var goodAreaCode = true;
	if (theLength != 3 && theLength !=0) {
		goodAreaCode = false;
	}
	if (theLength == 3) {
		for (var i = 0; i < 3; i++) {
			var theChar = theAreaCode.substring(i, i+1);
			if (theChar < "0" || theChar > "9") {
				goodAreaCode = false;
			}
		}
	}
	
	if (goodAreaCode == false) {
		alert("This does not appear to be a valid phone number !")
		form.phone_area_code.focus()
		form.phone_area_code.select()
		return false
	}
	
	var theFirstThree = form.phone1.value;
	var theLength = theFirstThree.length;
	var goodFirstThree = true;
	if (theLength != 3 && theLength !=0) {
		goodFirstThree = false;
	}
	if (theLength == 3) {
		for (var i = 0; i < 3; i++) {
			var theChar = theFirstThree.substring(i, i+1);
			if (theChar < "0" || theChar > "9") {
				goodFirstThree = false;
			}
		}
	}
	
	if (goodFirstThree == false) {
		alert("This does not appear to be a valid phone number !")
		form.phone1.focus()
		form.phone1.select()
		return false
	}
	
	var theLastFour = form.phone2.value;
	var theLength = theLastFour.length;
	var goodLastFour = true;
	if (theLength != 4 && theLength !=0) {
		goodLastFour = false;
	}
	if (theLength == 4) {
		for (var i = 0; i < 4; i++) {
			var theChar = theLastFour.substring(i, i+1);
			if (theChar < "0" || theChar > "9") {
				goodLastFour = false;
			}
		}
	}
	
	if (goodLastFour == false) {
		alert("This does not appear to be a valid phone number !")
		form.phone2.focus()
		form.phone2.select()
		return false
	}
	
	if (form.fax_area_code.value == "") {
		alert("Please enter the area code for the fax number !")
		form.fax_area_code.focus()
		return false
	}
	
	if (form.fax1.value == "") {
		alert("Please enter the first three digits of the fax number !")
		form.fax1.focus()
		return false
	}
	
	if (form.fax2.value == "") {
		alert("Please enter the last four digits of the fax number !")
		form.fax2.focus()
		return false
	}
	
	var theAreaCode = form.fax_area_code.value;
	var theLength = theAreaCode.length;
	var goodAreaCode = true;
	if (theLength != 3 && theLength !=0) {
		goodAreaCode = false;
	}
	if (theLength == 3) {
		for (var i = 0; i < 3; i++) {
			var theChar = theAreaCode.substring(i, i+1);
			if (theChar < "0" || theChar > "9") {
				goodAreaCode = false;
			}
		}
	}
	
	if (goodAreaCode == false) {
		alert("This does not appear to be a valid fax number !")
		form.fax_area_code.focus()
		form.fax_area_code.select()
		return false
	}
	
	var theFirstThree = form.fax1.value;
	var theLength = theFirstThree.length;
	var goodFirstThree = true;
	if (theLength != 3 && theLength !=0) {
		goodFirstThree = false;
	}
	if (theLength == 3) {
		for (var i = 0; i < 3; i++) {
			var theChar = theFirstThree.substring(i, i+1);
			if (theChar < "0" || theChar > "9") {
				goodFirstThree = false;
			}
		}
	}
	
	if (goodFirstThree == false) {
		alert("This does not appear to be a valid fax number !")
		form.fax1.focus()
		form.fax1.select()
		return false
	}
	
	var theLastFour = form.fax2.value;
	var theLength = theLastFour.length;
	var goodLastFour = true;
	if (theLength != 4 && theLength !=0) {
		goodLastFour = false;
	}
	if (theLength == 4) {
		for (var i = 0; i < 4; i++) {
			var theChar = theLastFour.substring(i, i+1);
			if (theChar < "0" || theChar > "9") {
				goodLastFour = false;
			}
		}
	}
	
	if (goodLastFour == false) {
		alert("This does not appear to be a valid fax number !")
		form.fax2.focus()
		form.fax2.select()
		return false
	}
	
	if (form.email.value == "") {
		alert("Please enter a valid email address !")
		form.email.focus()
		form.email.select()
		return false
	}
		
	if (invalidEmail(form.email.value)) {
		alert("The email address you have entered appears to be invalid. Please use a properly formatted email address containing the @ symbol, a period, and no spaces !")
		form.email.focus()
		form.email.select()
		return false
	}
	
	if (form.email2.value == "") {
		alert("Please enter a valid email address !")
		form.email2.focus()
		form.email2.select()
		return false
	}		
	if (form.email2.value != form.email.value) {
		alert("The email address you have entered does not match please re-enter !")
		form.email2.focus()
		form.email2.select()
		return false
	}	
	if (invalidEmail(form.email2.value)) {
		alert("The email address you have entered appears to be invalid. Please use a properly formatted email address containing the @ symbol, a period, and no spaces !")
		form.email.focus()
		form.email.select()
		return false
	}
	if (form.FaxApprove.checked== false) {
		alert("We insist you accept Fax and Email communications to become a producer with SAIS.\nIt is important that our producers are equipped with all of the tools necessary to succeed\nWe apologize but, if you do not accept these terms and conditions you will not be processed as a SAIS producer !")
		form.FaxApprove.focus()
		return false
	}
	if (form.license_number.value == "") {
		alert("Please enter the License Number !")
		form.license_number.focus()
		return false
	}
	
	if (form.e_and_o_carrier.value == "") {
		alert("Please enter the E & O Carrier !")
		form.e_and_o_carrier.focus()
		return false
	}
	
	if (form.total_volume.value == "") {
		alert("Please enter the Total Annual Premium Volume !")
		form.total_volume.focus()
		return false
	}
	
	if (form.agency_established.value == "") {
		alert("Please enter the Date your Agency was Established !")
		form.agency_established.focus()
		return false
	}
	
	var test=new String(form.agency_established.value);
	var bool = null;

	if (test!=""){	
		bool = test.match(/[0-9]+[-\\\/][0-9]+[-\\\/][0-9]{2,}/);
		if (! bool){
			alert("The date format you have entered is incorrect.  Please enter in the format: mm/dd/yyyy.");
			form.agency_established.focus();
			form.agency_established.select();
			return false
		}
	if (form.transfers.value == "") {
		alert("Please indicate interest in book policy transfers !")
		form.transfers.focus()
		return false
	}
	}

	else
	return true
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
