	// tab to next box in IE
	function TabNext(obj,event,len,next_field) {
	   var field_length=0;
	   if (event == "down") {
	      field_length=obj.value.length;
	   } else if (event == "up") {
	      if (obj.value.length != field_length) {
		 	field_length=obj.value.length;
		 	if (field_length == len) {
		    		next_field.focus();
		 	}
	       }
	   }
	}

	function formatPhone(item) {
		phoneno = document.order.elements[item].value;
		if (phoneno.length == 3) {
			phoneno = phoneno + "-";
		} else if (phoneno.length == 7) {
			phoneno = phoneno + "-";
		}

		document.order.elements[item].value = phoneno;

	}

	function formatSSN(item) {
		ssn = document.order.elements[item].value;
		if (ssn.length == 3) {
			ssn += "-";
		} else if (ssn.length == 6) {
			ssn += "-";
		}

		document.order.elements[item].value = ssn;

	}

	function formatDate(item) {
		adate = document.order.elements[item].value;
		if (adate.length == 2) {
			adate += "/";
		} else if (adate.length == 5) {
			adate += "/";
		}

		document.order.elements[item].value = adate;

	}


	function makeFedTax(formame, obj1, obj2, obj) {
		var tax1 = eval("document." + formame + "." + obj1 + ".value");
		var tax2 = eval("document." + formame + "." + obj2 + ".value");
		tbox = eval("document." + formame + "." + obj);
		tbox.value = + tax1 + tax2;
		return;
	}

	function makeSSN(formame, obj1, obj2, obj3, obj) {
		var ssn1 = eval("document." + formame + "." + obj1 + ".value");
		var ssn2 = eval("document." + formame + "." + obj2 + ".value");
		var ssn3 = eval("document." + formame + "." + obj3 + ".value");
		tbox = eval("document." + formame + "." + obj);
		tbox.value = + ssn1 + ssn2 + ssn3;
		return;
	}

	function makePhone(formame, obj1, obj2, obj3, obj) {
		var phone1 = eval("document." + formame + "." + obj1 + ".value");
		var phone2 = eval("document." + formame + "." + obj2 + ".value");
		var phone3 = eval("document." + formame + "." + obj3 + ".value");
		tbox = eval("document." + formame + "." + obj);
		tbox.value = "(" + phone1 + ") " + phone2 + "-" + phone3;
		return;
	}

	function makePhoneExt(formame, obj1, obj2, obj3, obj4, obj) {
		var phone1 = eval("document." + formame + "." + obj1 + ".value");
		var phone2 = eval("document." + formame + "." + obj2 + ".value");
		var phone3 = eval("document." + formame + "." + obj3 + ".value");
		var phone4 = eval("document." + formame + "." + obj4 + ".value");
		tbox = eval("document." + formame + "." + obj);
		tbox.value = "(" + phone1 + ") " + phone2 + "-" + phone3 + " " + phone4;
		return;
	}

	function makeDate(date1,date2,date3,hidden) {
		var date = eval(date1.value + "/" + date2.value + "/" + date3.value);
		eval(hidden.value = date);
	}

	function checkClosingFields() {
		if (document.app.Name.value == "") {
			alert("A value is required for Name");
			document.app.Name.focus();
			return false;
		}

		if (document.app.Email_Address.value == "") {
			alert("A value is required for Email Address");
			document.app.Email_Address.focus();
			return false;
		}
		if (document.app.Contact_Name.value == "") {
			alert("A value is required for Contact Name");
			document.app.Contact_Name.focus();
			return false;
		}

		if (document.app._FedTax1.value == "" && document.app._SSN1.value == "") {
			alert("A value is required for either the Fed Tax ID or the SSN field");
			document.app._FedTax1.focus();
			return false;
		}
		if (document.app.Maximum_Daily_Orders_You_Can_Accept_From_Us.value == "") {
			alert("A value is required for Max Daily Orders");
			document.app.Maximum_Daily_Orders_You_Can_Accept_From_Us.focus();
			return false;
		}

		if (document.app.Witness_Only_Fee.value == "") {
			alert("A value is required for Witness Only Fee");
			document.app.Witness_Only_Fee.focus();
			return false;
		}
		if (document.app.Trip_Fee.value == "") {
			alert("A value is required for Trip Fee");
			document.app.Trip_Fee.focus();
			return false;
		}
		if (document.app.Notary_Fee.value == "") {
			alert("A value is required for Notary Fee");
			document.app.Notary_Fee.focus();
			return false;
		}
		
		if(window.confirm("Do you want to submit this application to Urban?")) {
			return(true);
		}
		return(false);
	}


	function checkAppraiserFields() {
		if (document.app.Name.value == "") {
			alert("A value is required for Name");
			document.app.Name.focus();
			return false;
		}

		if (document.app.Email_Address.value == "") {
			alert("A value is required for Email Address");
			document.app.Email_Address.focus();
			return false;
		}
		if (document.app.Company_Name.value == "") {
			alert("A value is required for Company Name");
			document.app.Company_Name.focus();
			return false;
		}

		if (document.app._FedTax1.value == "" && document.app._SSN1.value == "") {
			alert("A value is required for either the Fed Tax ID or the SSN field");
			document.app._FedTax1.focus();
			return false;
		}

		if (document.app._Office_Phone1.value == "" || document.app._Office_Phone2.value == "" || document.app._Office_Phone3.value == "") {
			alert("A value is required for Office Phone");
			document.app._Office_Phone1.focus();
			return false;
		}

		if (document.app.Maximum_Daily_Orders_You_Can_Accept_From_Us.value == "") {
			alert("A value is required for Max Daily Orders");
			document.app.Maximum_Daily_Orders_You_Can_Accept_From_Us.focus();
			return false;
		}
		if (document.app.Form_1004_1073.value == "") {
			alert("A value is required for 1004 1073 Form");
			document.app.Form_1004_1073.focus();
			return false;
		}
		if (document.app.Form_Exterior_2055.value == "") {
			alert("A value is required for 2055 Exterior Form");
			document.app.Form_Exterior_2055.focus();
			return false;
		}
		if (document.app.Form_Interior_2055.value == "") {
			alert("A value is required for 2055 Interior Form");
			document.app.Form_Interior_2055.focus();
			return false;
		}

		if (document.app.Re_Final_Inspection.value == "") {
			alert("A value is required for Reinspection or Final Inspection");
			document.app.Re_Final_Inspection.focus();
			return false;
		}

		if (document.app.Recertification.value == "") {
			alert("A value is required for Recertification");
			document.app.Recertification.focus();
			return false;
		}

		if (document.app.Form_442.value == "") {
			alert("A value is required for Form 442");
			document.app.Form_442.focus();
			return false;
		}
		if (document.app.FNMA_2000.value == "") {
			alert("A value is required for FNMA 2000");
			document.app.FNMA_2000.focus();
			return false;
		}

		if (document.app.Form_Multi_1025.value == "") {
			alert("A value is required for Multi Family: (1025 Form)");
			document.app.Form_Multi_1025.focus();
			return false;
		}
		if (document.app.Form_FHA_Appraisal_1004.value == "") {
			alert("A value is required for FHA HUD Appraisal URAR: (1004 Form)");
			document.app.Form_FHA_Appraisal_1004.focus();
			return false;
		}
		if (document.app.FNMA_2006.value == "") {
			alert("A value is required for FNMA 2006");
			document.app.FNMA_2006.focus();
			return false;
		}
		
		if(window.confirm("Do you want to submit this application to Urban?")) {
			return(true);
		}
		return(false);
	}


	function checkAbstractorFields() {
		if (document.app.Name.value == "") {
			alert("A value is required for Name");
			document.app.Name.focus();
			return false;
		}

		if (document.app.Email_Address.value == "") {
			alert("A value is required for Email Address");
			document.app.Email_Address.focus();
			return false;
		}
		if (document.app.Company.value == "") {
			alert("A value is required for Company Name");
			document.app.Company.focus();
			return false;
		}

		if (document.app._FedTax1.value == "" && document.app._SSN1.value == "") {
			alert("A value is required for either the Fed Tax ID or the SSN field");
			document.app._FedTax1.focus();
			return false;
		}

		if (document.app._Office_Phone1.value == "" || document.app._Office_Phone2.value == "" || document.app._Office_Phone3.value == "") {
			alert("A value is required for Office Phone");
			document.app._Office_Phone1.focus();
			return false;
		}

		if (document.app.Maximum_Daily_Orders_You_Can_Accept_From_Us.value == "") {
			alert("A value is required for Max Daily Orders");
			document.app.Maximum_Daily_Orders_You_Can_Accept_From_Us.focus();
			return false;
		}
		if (document.app.Update_Fee.value == "") {
			alert("A value is required for Update Fee");
			document.app.Update_Fee.focus();
			return false;
		}
		if (document.app.One_Owner_Fee.value == "") {
			alert("A value is required for One Owner Fee");
			document.app.One_Owner_Fee.focus();
			return false;
		}
		if (document.app.Two_Owner_Fee.value == "") {
			alert("A value is required for Two Owner Fee");
			document.app.Two_Owner_Fee.focus();
			return false;
		}

		if (document.app.Three_Owner_Fee.value == "") {
			alert("A value is required for Three Owner Fee");
			document.app.Three_Owner_Fee.focus();
			return false;
		}
		if (document.app.Full_Search_Fee.value == "") {
			alert("A value is required for Full Search Fee");
			document.app.Full_Search_Fee.focus();
			return false;
		}
		if (document.app.Tax_Search_Fee.value == "") {
			alert("A value is required for Tax Search Fee");
			document.app.Tax_Search_Fee.focus();
			return false;
		}

		if (document.app.Update_Record_Fee.value == "") {
			alert("A value is required for Update Record Fee");
			document.app.Update_Record_Fee.focus();
			return false;
		}
		if (document.app.Judgment_Fee.value == "") {
			alert("A value is required for Judgment_Fee");
			document.app.Judgment_Fee.focus();
			return false;
		}
		if (document.app.Record_Only_Fee.value == "") {
			alert("A value is required for Record Only Fee");
			document.app.Record_Only_Fee.focus();
			return false;
		}
		if (document.app.Deed_Report_Fee.value == "") {
			alert("A value is required for Deed Report Fee");
			document.app.Deed_Report_Fee.focus();
			return false;
		}
		if (document.app.Mini_Search_Fee.value == "") {
			alert("A value is required for Mini Search Fee");
			document.app.Mini_Search_Fee.focus();
			return false;
		}
		if (document.app.Mortgage_Report_Fee.value == "") {
			alert("A value is required for Mortgage Report Fee");
			document.app.Mortgage_Report_Fee.focus();
			return false;
		}
		
		if(window.confirm("Do you want to submit this application to Urban?")) {
			return(true);
		}
		return(false);
	}


	function checkNewCustomerFields() {
		if (document.app.Company.value == "") {
			alert("A value is required for Company");
			document.app.Company.focus();
			return false;
		}

		if (document.app.Street.value == "") {
			alert("A value is required for Address");
			document.app.Street.focus();
			return false;
		}
		if (document.app.City.value == "") {
			alert("A value is required for City");
			document.app.City.focus();
			return false;
		}

		if (document.app.State.value == "") {
			alert("A value is required for State");
			document.app.State.focus();
			return false;
		}

		if (document.app.Zip.value == "") {
			alert("A value is required for Zip");
			document.app.Zip.focus();
			return false;
		}
		if (document.app.Contact_Name_1.value == "") {
			alert("A value is required for Contact #1 Name");
			document.app.Contact_Name_1.focus();
			return false;
		}
		if (document.app._Phone11.value == "" || document.app._Phone12.value == "" || document.app._Phone13.value == "") {
			alert("A value is required for Phone Number");
			document.app._Phone11.focus();
			return false;
		}

		app.submit();
	}


	function checkCurrentCustomerFields() {
		if (document.app.Customer_No.value == "") {
			alert("A value is required for Customer No");
			document.app.Customer_No.focus();
			return false;
		}

		if (document.app.Contact.value == "") {
			alert("A value is required for Contact");
			document.app.Contact.focus();
			return false;
		}

		if (document.app._Phone1.value == "" || document.app._Phone2.value == "" || document.app._Phone3.value == "") {
			alert("A value is required for Phone Number");
			document.app._Phone1.focus();
			return false;
		}

		if (document.app.Email_Address.value == "") {
			alert("A value is required for Email Address");
			document.app.Email_Address.focus();
			return false;
		}

		if (document.app.Password.value == "") {
			alert("A value is required for Password");
			document.app.Password.focus();
			return false;
		}

		if (document.app.Password2.value == "") {
			alert("A value is required for Password2");
			document.app.Password2.focus();
			return false;
		}

		if (document.app.Password.value != document.app.Password2.value) {
			alert("Both passwords must match");
			document.app.Password.value = '';
			document.app.Password2.value = '';
			document.app.Password.focus();
			return false;
		}

		if(window.confirm("Do you want to submit this application to Ubran?")) {
			return(true);
		}
		return(false);
	}


	function checkCustomerAppFields() {
		if (document.app.Name.value == "") {
			alert("A value is required for Name");
			document.app.Name.focus();
			return false;
		}

		if (document.app.Email_Address.value == "") {
			alert("A value is required for Email Address");
			document.app.Email_Address.focus();
			return false;
		}

		if (document.app._SSN1.value == "" || document.app._SSN2.value == "" || document.app._SSN3.value == "") {
			alert("A value is required for SSN");
			document.app._SSN1.focus();
			return false;
		}

		if (document.app._Phone1.value == "" || document.app._Phone2.value == "" || document.app._Phone3.value == "") {
			alert("A value is required for Phone Number");
			document.app._Phone1.focus();
			return false;
		}

		if(window.confirm("Do you want to submit this application to Urban?")) {
			return(true);
		}
		return(false);
	}


	//do fed tax and ssn check
	function checkSSN(fed_tax1,fed_tax2,ssn1,ssn2,ssn3) {
		if (eval("document.app." + fed_tax1 + ".value != ''") || eval("document.app." + fed_tax2 + ".value == !''")){
			eval("document.app."  + fed_tax1 + ".disabled = false");
			eval("document.app."  + fed_tax2 + ".disabled = false");
			eval("document.app."  + ssn1     + ".disabled = true");
			eval("document.app."  + ssn2     + ".disabled = true");
			eval("document.app."  + ssn3     + ".disabled = true");
		} else if (eval("document.app." + ssn1 + ".value != ''") || eval("document.app." + ssn2 + ".value == !''") || eval("document.app." + ssn3 + ".value == !''")){
			eval("document.app."  + fed_tax1 + ".disabled = true");
			eval("document.app."  + fed_tax2 + ".disabled = true");
			eval("document.app."  + ssn1     + ".disabled = false");
			eval("document.app."  + ssn2     + ".disabled = false");
			eval("document.app."  + ssn3     + ".disabled = false");
		} else {
			eval("document.app."  + fed_tax1 + ".disabled = false");
			eval("document.app."  + fed_tax2 + ".disabled = false");
			eval("document.app."  + ssn1     + ".disabled = false");
			eval("document.app."  + ssn2     + ".disabled = false");
			eval("document.app."  + ssn3     + ".disabled = false");
		}
	}


function isEmail(formname, inString) {
	var str = eval("document." + formname + "." + inString + ".value");

	if (Trim(str) == "") {
		// Return false if number is empty
		return;
	}

  	// are regular expressions supported?
  	var supported = 0;
  	if (window.RegExp) {
    	var tempStr = "a";
    	var tempReg = new RegExp(tempStr);
    	if (tempReg.test(tempStr)) supported = 1;
  	}
  	if (!supported)
    	return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  	if(!(!r1.test(str) && r2.test(str))){
		eval("document." + formname + "." + inString + ".value = ''");
		eval("document." + formname + "." + inString + ".focus()");
		alert("You must enter a valid email address");
		return;
  	}
}

function IsNumber(formname,inString) {
	var TheNumber = eval("document." + formname + "." + inString + ".value");

	if (Trim(TheNumber) == "") {
		// Return false if number is empty
		return;
	}
  	var r1 = new RegExp("^[0-9]+$");
  	if(!r1.test(Trim(TheNumber))){
		eval("document." + formname + "." + inString + ".value = ''");
		eval("document." + formname + "." + inString + ".focus()");
		alert("You must enter a numerical value");
		return;
  	}
}



function IsFullDate(formname,inString) {
	var TheDate = eval("document." + formname + "." + inString + ".value");

	if (Trim(TheDate) == "") {
		// Return false if number is empty
		return;
	}
  	var r1 = new RegExp("^(0?[1-9]|1[0-2])/([12][0-9]|3[01]|0?[1-9])/([0-9]{2})");
  	if(!r1.test(Trim(TheDate))){
		eval("document." + formname + "." + inString + ".value = ''");
		eval("document." + formname + "." + inString + ".focus()");
		alert("You must enter a valid date");
		return;
  	}
}

function IsMiniDate(formname,inString) {
	var TheDate = eval("document." + formname + "." + inString + ".value");

	if (Trim(TheDate) == "") {
		// Return false if number is empty
		return;
	}
  	var r1 = new RegExp("^(0?[1-9]|1[0-2])/([0-9]{2})");
  	if(!r1.test(Trim(TheDate))){
		eval("document." + formname + "." + inString + ".value = ''");
		eval("document." + formname + "." + inString + ".focus()");
		alert("You must enter a valid date");
		return;
  	}
}


function Trim(TRIM_VALUE){
	if(TRIM_VALUE.length < 1){
		return"";
	}
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	if(TRIM_VALUE==""){
		return "";
	}else{
		return TRIM_VALUE;
	}
} //End Function

function RTrim(VALUE){
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0){
		return"";
	}
	var iTemp = v_length -1;

	while(iTemp > -1){
		if(VALUE.charAt(iTemp) == w_space){
		}else{
			strTemp = VALUE.substring(0,iTemp +1);
			break;
		}
		iTemp = iTemp-1;

	} //End While
	return strTemp;

} //End Function

function LTrim(VALUE){
	var w_space = String.fromCharCode(32);
	if(v_length < 1){
		return"";
	}
	var v_length = VALUE.length;
	var strTemp = "";

	var iTemp = 0;

	while(iTemp < v_length){
		if(VALUE.charAt(iTemp) == w_space){
		}else{
			strTemp = VALUE.substring(iTemp,v_length);
			break;
		}
		iTemp = iTemp + 1;
	} //End While
	return strTemp;
} //End Function

function setCookie(){
    var the_date = new Date("December 31, 2025");
    var the_cookie_date = the_date.toGMTString();
    var the_cookie = "name=" + escape("username:" + document.login.username.value) + ";expires=" + the_cookie_date;
    document.cookie = the_cookie;
    return true;
}

function readCookie(){
	if(document.cookie == ''){
		return;
	}
	var the_cookie = document.cookie;
	var the_cookie = unescape(the_cookie);
	var broken_cookie = the_cookie.split(":");
	var the_name = broken_cookie[1];	

	if(the_name == null) {
		document.login.username.value = '';
	}else{
		var index1 = the_name.indexOf(";");
		if(index1 > -1) {
			the_name = the_name.substring(0,index1);
		}
		document.login.username.value = the_name;
	}
	return;
}
