<!--// format the Search price field on the propsearch form

function CheckPrice (which_field,strValue) {

        if (strValue == "") {
                return ("");
        }
        
        // Take out dollar sign
        if (strValue.substr (0, 1) == "$") {
                strValue = strValue.substr (1);
        }

        // take out commas
        do 
        {
                iPos = strValue.indexOf (",");
                if (iPos > 0) {
                        strValue = strValue.substr (0, iPos) + strValue.substr (iPos + 1);
                }
        } 
        while (iPos > 0);
        
        iPodd = strValue.indexOf (".");
                if (iPodd >= 1) {
                        alert ("Please use only whole numbers");
                which_field.value="";
                which_field.focus();
                return (0);
                
                }
        
        if (isNaN(strValue)) {
                alert ("Please do not user dollar signs ($), decimals (.), or commas (,) in price fields");
                which_field.value="";
                which_field.focus();
                return (0);
                
        }
        

        // Check if price is below 1000
         
        if (parseInt (strValue) < 1000) {
                strValue = strValue + "000";
        }

        
        return (FormatCurrency (strValue,which_field));
}

function FormatCurrency (strValue,which_field) {
        iLen = strValue.length
        strRight3 = strValue.substr (iLen - 3);
        if (iLen > 6) {
                strMid3 = strValue.substr (iLen - 6, 3);
                strLeft3 = strValue.substr (0, iLen - 6);
                strValue = "$" + strLeft3 + "," + strMid3 + "," + strRight3;
        } 
        else {
			if (strValue == "0")
			{
				strValue = "$" + strValue;
			}
			else
			{
                strMid3 = strValue.substr (iLen - 6, iLen - 3);
                strLeft3 = "";
                strValue = "$" + strMid3 + "," + strRight3;
            }
        }

        
        which_field.value=strValue
        //alert(strformfield)
}



<!--// Creates User ID

function CreateID(lname,fname) {
	if(document.NewAccountInfo.LogID.value=='') {
		newid = fname.substr (0, 1)
		newid = newid + lname
		document.NewAccountInfo.LogID.value=newid
	}
}


//*************check fields on addnew account form

function check_NewAccount() {
	var failed = false
	var display = "All Fields are required\nPlease try again"
	
	if(document.NewAccountInfo.FirstName.value==''|| document.NewAccountInfo.LastName.value=='' || document.NewAccountInfo.officeid.value=='' || document.NewAccountInfo.LogID.value=='' || document.NewAccountInfo.password.value=='') {
		failed = true
	}
	if (failed==true){
		alert(display)
		return(false)
	}
	else {
		
	return(true)
}



	}
	

// ***********do the math for the commision and auto enter it on the form
function DoCommMath(which_field,FullAmount) {
	var rAmount
	if(which_field.value=='') {
		rAmount = FullAmount * .025
		which_field.value = rAmount
	}
}

	//|| document.NewAccountInfo.LastName.value=='' || document.NewAccountInfo.officeid.value=='' || document.NewAccountInfo.LogID.value=='' || document.NewAccountInfo.password.value==''	




//******* CHECKS FIELDS ON Prop search registration
function check_form(){
	var display = "The following fields are required:\n"
	var failed=false
	
	
		
		if (document.Regform1.Fname.value=='') {
	  	display = display + "First Name\n"
	 	 failed= true	
		}
		
		if (document.Regform1.Lname.value=='') {
	  	display = display + "Last Name\n"
	 	 failed= true	
		}
		
		if (document.Regform1.email.value=='') {
	  	display = display + "Email Address\n"
	 	 failed= true	
		}
		
		if (document.Regform1.Password.value=='') {
	  	display = display + "Password\n"
	 	 failed= true	
		}
		
		if (document.Regform1.TOSCheck.checked==0) {
	  	display = display + "Terms of Service agreement\n"
	 	 failed= true	
		}
		
		if (document.Regform1.TYP.checked==0) {
	  	display = display + "Property type\n"
	 	 failed= true	
		}
		
		if (document.Regform1.PriceMin.value=='') {
	  	display = display + "Min Price\n"
	 	 failed= true	
		}				
	
	if (failed==true){
		alert(display)
		return(false)
	}
	else {
		
	return(true)
}



	}




//******* CHECKS FIELDS ON Prop search criteria page
function check_criteria(){
	var display = "The following fields are required:\n"
	var failed=false
	
	
		
		if (document.searchform.area.value=='') {
	  	display = display + "Search Area\n"
	 	 failed= true	
		}
		
		if (document.searchform.TYP.value=='') {
	  	display = display + "Property Type"
	 	 failed= true	
		}
		
			
	if (failed==true){
		alert(display)
		return(false)
	}
	else {
		
	return(true)
}



	}



//opens calc page

function calc(strlp,strtax){
	var strgoTax
	var strlp80
	strgoTax = strtax
	strlp80=strlp * .80
	if (typeof strtax == 'number') 	 {
		strgoTax = strtax
	}
	
window.open('http://www.sharkhomesearch.com/homesearch/Calc.asp?lp='+strlp80+'&tax='+strgoTax,'calcpage','width=450,height=440,');
}


//opens set up a showing page
var intln
function show(intln){
		
window.open('http://www.sharkhomesearch.com/homesearch/showing.asp?ln='+intln+'&create=1','showpage','width=550,height=440,');
}



//******* CHECKS FIELDS ON set up a showing page (showing.asp)
function check_Showemail(){
	var display = "The following fields are required:\n"
	var failed=false
	
	
		
		if (document.SetShowing.fromName.value=='') {
	  	display = display + "Your Name\n"
	 	 failed= true	
		}
		
		if (document.SetShowing.fromEmail.value=='') {
	  	display = display + "Your Email Addrress"
	 	 failed= true	
		}
		
		if (document.SetShowing.Ebody.value=='') {
	  	display = display + "Your Email message"
	 	 failed= true	
		}
		
			
	if (failed==true){
		alert(display)
		return(false)
	}
	else {
		
	return(true)
}



	}



//-->