<!--// 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)
}






	
	
//******* CHECKS FIELDS ON Angent Info page
function CheckNewListing(){
	var display = "The following fields are required:\n"
	var failed=false	
	
		
		if (document.form1.ln.value=='') {
	  	display = display + "Listing Number\n"
	 	 failed=true	
		}
		
		if (document.form1.listprice.value=='') {
	  	display = display + "List Price\n"
	 	 failed=true	
		}
		
		if (document.form1.listAgentName.value=='') {
	  	display = display + "Listng Agents Name\n"
	 	 failed=true	
		}
		

	
	if (failed==true){
		alert(display)
		return(false)
	}
	else {
		
	return(true)
}



	}
			


//******* CHECKS FIELDS ON Agent assistant.asp
function CheckAssistantListing(){
	var display = "The following fields are required:\n"
	var failed=false	
	
		
		if (document.form1.ln.value=='') {
	  	display = display + "Listing Number\n"
	 	 failed=true	
		}
		
		if (document.form1.listprice.value=='') {
	  	display = display + "List Price\n"
	 	 failed=true	
		}
		
		if (document.form1.listAgentpick.value=='') {
	  	display = display + "Listng Agents Name\n"
	 	 failed=true	
		}
		

	
	if (failed==true){
		alert(display)
		return(false)
	}
	else {
		
	return(true)
}



	}







	//******* CHECKS FIELDS ON Agent Info page
function CheckAgentUpdate(){
	var display = "The following fields are required:\n"
	var failed=false	
	
		
		if (document.formagent.First_Name.value=='') {
	  	display = display + "First Name\n"
	 	 failed=true	
		}
		
		if (document.formagent.last_Name.value=='') {
	  	display = display + "Last Name\n"
	 	 failed=true	
		}
		
		if (document.formagent.emailaddress.value=='') {
	  	display = display + "Email Address\n"
	 	 failed=true	
		}
		
		if (document.formagent.password.value=='') {
	  	display = display + "Password\n"
	 	 failed=true	
		}	
		
			if (document.formagent.Office_ext.value=='') {
	  	display = display + "Office ext.\n"
	 	 failed=true	
		}	
		
	
	if (failed==true){
		alert(display)
		return(false)
	}
	else {
		
	return(true)
}



	}
	
	
	
	//******* CHECKS FIELDS ON add new agent
function CheckAddAgent(){
	var display = "The following fields are required:\n"
	var failed=false	
	
		
		if (document.form2.First_Name.value=='') {
	  	display = display + "First Name\n"
	 	 failed=true	
		}
		
		if (document.form2.last_Name.value=='') {
	  	display = display + "Last Name\n"
	 	 failed=true	
		}
		
		if (document.form2.emailaddress.value=='') {
	  	display = display + "Email Address\n"
	 	 failed=true	
		}
		
		if (document.form2.password.value=='') {
	  	display = display + "Password\n"
	 	 failed=true	
		}	
		
		if (document.form2.Office_ext.value=='') {
	    display = display + "Office ext.\n"
	 	 failed=true	
		}	
		
		if (document.form2.MLSid.value=='') {
	  	display = display + "MLS ID\n"
	 	 failed=true	
		}	
		
	
	if (failed==true){
		alert(display)
		return(false)
	}
	else {
		
	return(true)
}



	}


//**** checks form on appointment page appointment.asp
function CheckAppointment(){
	var display = "The following fields are required:\n"
	var failed=false
	
		if (document.form1.AgentID.value=='') {
	  	display = display + "Agent ID\n"
	 	 failed=true	
		}
		
	if (document.form1.aptDate.value=='') {
	  	display = display + "Appointment Date\n"
	 	 failed=true	
		}
		
	if (document.form1.aptStartTime.value=='') {
	  	display = display + "Appointment Time\n"
	 	 failed=true	
		}


if (failed==true){
		alert(display)
		return(false)
		}
	else {
	return(true)
	}

}


//******* CHECKS Feed back FIELDS FeedBack/default.asp
function CheckFeedBack(){
	var display = "You have to specify a general client opinion,\n a specific comment, or both\n please try again"
	var failed=false	
	var Ocount = 0
		for (i=0;i<3;i++)
			{
				if (document.formfeedback.opinion[i].checked==true) {
					Ocount = Ocount+1
					 //failed=true
					//alert(Ocount)
	  	 		 }
	  	 	 
	  		}
	  		
	  		if (Ocount == 0 && document.formfeedback.comments.value=='') {
	  			//alert(Ocount)
	  			failed=true
	  		}
		
			
if (failed==true){
		alert(display)
		return(false)
		}
	else {
	return(true)
	}

}





// ***** only allow one search param to look up listing info showtime/home.asp
function clearOne(str_value,fieldToClear) {
	if (str_value != '') {
	//	alert(str_value)
		fieldToClear.value==''
		layerName.style.visibility="visible";
		fieldToClear.disabled = true
		
		
	}
	if (str_value =='') {
	fieldToClear.disabled = false
	}
}
	

//***working on it
function detailss() {
alert("ooo")
dtl.style.visibility="visible";

}




//********* look up LN for auto fill listings/default.asp
function getln(listnum) {
	if (listnum != '') {
		location.href="default.asp?ln=" + listnum
		}
	}
	
	
	//********* look up LN for auto fill listings/assistant.asp
function assistgetln(listnum) {
	if (listnum != '') {
		location.href="assistant.asp?ln=" + listnum
		}
	}
	
	


//********* look up agent ID for showing appointment showing/appointment.asp
function GetShowAgent(AID,listID) {
	if (AID != '') {
		location.href="overview.asp?ID=" + listID + "&ShowAID=" + AID
		}
	}


		
//********* Open Calendar.aspx page
function OpenCal() {
	document.form1.aptDate.blur()
	calendar_window = window.open('cal.aspx','calendar_window','width=265,height=190');
	calendar_window.focus()
	
}


//****** scrolls appointment.asp
function goGo(){
				document.form1.FirstName.focus();
				window.scrollTo(0,500);
				//alert("hello")
				}		


//opens calc page

function calc(strlp,strtax){
	var strgoTax
	if (strtax == 'NEW' || strtax=='EXEMPT') {
		strtax=0
	}
		strgoTax = strtax
		
window.open('http://www.listandshow.com/Calc.asp?lp='+strlp+'&tax='+strgoTax,'calcpage','width=450,height=440,');
}


//******* 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)
}



	}

//-->