


<!--// 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)
}

///////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
// fieldname, warningname, remainingname, maxchars
function CheckFieldLength(fn,wn,rn,mc) {
  var len = fn.value.length;
  if (len > mc) {
    fn.value = fn.value.substring(0,mc);
    len = mc;
  }
  document.getElementById(wn).innerHTML = len;
  document.getElementById(rn).innerHTML = mc - len;
}

///////////////////////////////////////// 

//hides and shows areas
			function showLevel( _levelId) {
				var thisLevel = document.getElementById( _levelId );
					if ( thisLevel.style.display == "none") {
						thisLevel.style.display = "block";
						thisLevel.style.visibility = "visible";
					 }
				else {
					thisLevel.style.display = "none";
					thisLevel.style.visibility = "hidden";
				}
			}


//********************************************************
//chekc login in form
function CheckLogin(){

			var tmpValid = "0"
			document.getElementById("userID_label").innerHTML = ""
			document.getElementById("password_Label").innerHTML = ""
			
			
			if (isWhitespace(document.form1.UserID.value))
				{
				document.getElementById("userID_label").innerHTML = " * Required"
				//document.FormLogin.UserID.focus();
				tmpValid++
				}
				
			if  (isWhitespace(document.getElementById("password").value))
					{
					document.getElementById("password_Label").innerHTML = " * Required"
				//	document.FormLogin.password.focus();
					tmpValid++
					}
				
				
			
			if (tmpValid == "0") {
    			
			    document.getElementById("Main_Label").innerHTML = ""
			    document.getElementById("submitbutton").disabled = true
			    //document.getElementById("inpContent").value = oEdit1.getHTMLBody();
			    return (true);
		    }   
			
			else {
			    document.getElementById("Main_Label").innerHTML = "<span style='font-family:Verdana; font-size=12px; color=CC0000'><b>Required fields are missing.</b></span><BR><BR>"
			    return (false)
			}
	}
		
	//////////////////////////////////////////////////////////////////
	
	//////////////////////////////////////////////////////////
function HighlightRow(Level_id1,Level_id2,Level_id3) {
		
			var thisLevel1 = document.getElementById(Level_id1);
			var thisLevel2 = document.getElementById(Level_id2);
			var thisLevel3 = document.getElementById(Level_id3);
			
				thisLevel1.className = 'tdHighlight'
				thisLevel2.className = 'tdHighlight'
				thisLevel3.className = 'tdHighlight'	
						
				
			}
			
function ResetRow(Level_id1,Level_id2,Level_id3) {
			var thisLevel1 = document.getElementById(Level_id1);
			var thisLevel2 = document.getElementById(Level_id2);
			var thisLevel3 = document.getElementById(Level_id3);
			
				thisLevel1.className = 'tdNormal'
				thisLevel2.className = 'tdNormal'
				thisLevel3.className = 'tdNormal'
				
			}


///////////////////////////////////////////////////////////////////
	
	///////////////////////////////////////////////////////////////////
//this function opens and center a window
	function winBRopen(theURL, Name, popW, popH, scroll, resize) { // V 1.0
	var winleft = (screen.width - popW) / 2;
	var winUp = (screen.height - popH) / 2;
	winProp = 'width='+popW+',height='+popH+',left='+winleft+',top='+winUp+',scrollbars='+scroll+',resizable='+resize+'';
	Win = window.open(theURL, Name, winProp);
	Win.window.focus();
}


//////////////////////////////////////////////////////////////////
//chekc login in form
function CheckAgent(){

			var tmpValid = "0"
			document.getElementById("firstname_label").innerHTML = ""
			document.getElementById("lastname_label").innerHTML = ""
			document.getElementById("company_Label").innerHTML = ""
			document.getElementById("email_Label").innerHTML = ""
			document.getElementById("password_Label").innerHTML = ""
			document.getElementById("directPhone_Label").innerHTML = ""
			document.getElementById("SMS_Label").innerHTML = ""
			
			
			
			
			if (isWhitespace(document.getElementById("firstname").value))
				{
				document.getElementById("firstname_label").innerHTML = " * Required"
				//document.FormLogin.UserID.focus();
				tmpValid++
				}
		    
		    if (isWhitespace(document.getElementById("lastname").value))
				{
				document.getElementById("lastname_label").innerHTML = " * Required"
				//document.FormLogin.UserID.focus();
				tmpValid++
				}
			
			if  (!(isEmail(document.getElementById("email").value)))
					{
					document.getElementById("email_Label").innerHTML = " * Required"
				//	document.FormLogin.password.focus();
					tmpValid++
					}
					
			if (isWhitespace(document.getElementById("company").value))
				{
				document.getElementById("company_Label").innerHTML = " * Required"
				//document.FormLogin.UserID.focus();
				tmpValid++
				}
		    
		    if (isWhitespace(document.getElementById("directPhone").value))
				{
				document.getElementById("directPhone_Label").innerHTML = " * Required"
				//document.FormLogin.UserID.focus();
				tmpValid++
				}
				
			if  (isWhitespace(document.getElementById("password").value))
					{
					document.getElementById("password_Label").innerHTML = " * Required"
				//	document.FormLogin.password.focus();
					tmpValid++
					}
		    
		    if  (  (document.getElementById("sms").checked == true) &&  isWhitespace(document.getElementById("smsnumber").value)   )
				    {
					document.getElementById("SMS_Label").innerHTML = "<br> <b>Cell Number and Carrier Required when activating SMS Messaging</b><br><br>"
				//	document.FormLogin.password.focus();
					tmpValid++
					}
				
			
			if (tmpValid == "0") {
    			
			    document.getElementById("Main_Label").innerHTML = ""
			    document.getElementById("submitbutton").disabled = true
			    //document.getElementById("inpContent").value = oEdit1.getHTMLBody();
			    return (true);
		    }   
			
			else {
			    document.getElementById("Main_Label").innerHTML = "<span style='font-family:Verdana; font-size=12px; color=CC0000'><b>Required fields are missing.</b></span><BR><BR>"
			    return (false)
			}
	}
		
	//////////////////////////////////////////////////////////////////
	
	
function OpenPic(WhatField,whatfolder){
				var nW = window.open("", "PicFileUpload", "resizable=no,scrollbars=yes,width=650,height=350");
				nW.location.href = "/renformPic.asp?whatfield=" + WhatField + "&whatfolder=" + whatfolder
				nW = null;
			}

////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////
//chekc login in form
function CheckReg(){

			var tmpValid = "0"
			document.getElementById("firstname_label").innerHTML = ""
			document.getElementById("lastname_label").innerHTML = ""
			document.getElementById("company_Label").innerHTML = ""
			document.getElementById("email_Label").innerHTML = ""
			document.getElementById("password_Label").innerHTML = ""
			document.getElementById("directPhone_Label").innerHTML = ""
			document.getElementById("LAG_Label").innerHTML = ""
			document.getElementById("LO_Label").innerHTML = ""
			document.getElementById("MLS_Label").innerHTML = ""
			
			
			
			if (isWhitespace(document.getElementById("firstname").value))
				{
				document.getElementById("firstname_label").innerHTML = " * Required"
				//document.FormLogin.UserID.focus();
				tmpValid++
				}
		    
		    if (isWhitespace(document.getElementById("lastname").value))
				{
				document.getElementById("lastname_label").innerHTML = " * Required"
				//document.FormLogin.UserID.focus();
				tmpValid++
				}
			
			if (isWhitespace(document.getElementById("company").value))
				{
				document.getElementById("company_Label").innerHTML = " * Required"
				//document.FormLogin.UserID.focus();
				tmpValid++
				}
		    
		    if (isWhitespace(document.getElementById("directPhone").value))
				{
				document.getElementById("directPhone_Label").innerHTML = " * Required"
				//document.FormLogin.UserID.focus();
				tmpValid++
				}
				
			if  (!(isEmail(document.getElementById("email").value)))
					{
					document.getElementById("email_Label").innerHTML = " * Required"
				//	document.FormLogin.password.focus();
					tmpValid++
					}
			
			if  (isWhitespace(document.getElementById("password").value))
					{
					document.getElementById("password_Label").innerHTML = " * Required"
				//	document.FormLogin.password.focus();
					tmpValid++
					}
		    
		    if  (isWhitespace(document.getElementById("LAG").value))
					{
					document.getElementById("LAG_Label").innerHTML = " * Required"
				//	document.FormLogin.password.focus();
					tmpValid++
					}
			
			if  (isWhitespace(document.getElementById("LO").value))
					{
					document.getElementById("LO_Label").innerHTML = " * Required"
				//	document.FormLogin.password.focus();
					tmpValid++
					}
			
			if  (document.getElementById("MLS").selectedIndex <=0)
					{
					document.getElementById("MLS_Label").innerHTML = " * Required"
				//	document.FormLogin.password.focus();
					tmpValid++
					}
				
				
			
			if (tmpValid == "0") {
    			
			    document.getElementById("Main_Label").innerHTML = ""
			    document.getElementById("submitbutton").disabled = true
			    //document.getElementById("inpContent").value = oEdit1.getHTMLBody();
			    return (true);
		    }   
			
			else {
			    document.getElementById("Main_Label").innerHTML = "<span style='font-family:Verdana; font-size=12px; color=CC0000'><b>Required fields are missing.</b></span><BR><BR>"
			    return (false)
			}
	}
		
	//////////////////////////////////////////////////////////////////

            function checkForm(){
                var err = "";
                if (document.getElementById("fname").value == "") {
                    alert('You must enter your first name.');
                    err = "true";
                    return (false)
                }
                                
                if (document.getElementById("lname").value == "") {
                        alert('You must enter your lname.');
                        err = "true";
                        return (false)
                }
                
                if (document.getElementById("address").value == "") {
                        alert('You must enter your address.');
                        err = "true";
                        return (false)           
                }
                
               if (document.getElementById("city").value == "") {
                        alert('You must enter your city.');
                        err = "true";
                        return (false)           
                }
                
                if (document.getElementById("state").options[document.getElementById("state").selectedIndex].value == "") {
                        alert('You must select a state.');
                        err = "true";
                        return (false)           
                }
                
                if (document.getElementById("zipcode").value == "") {
                        alert('You must enter your zipcode.');
                        err = "true";
                        return (false)           
                }
                
                if (document.getElementById("listing").value == "") {
                        alert('You must enter a listing number.');
                        err = "true";
                        return (false)           
                }
                
                if (document.getElementById("url1").value == "") {
                        alert('You must enter url option 1.');
                        err = "true";
                        return (false)           
                }
                
                if (document.getElementById("url2").value == "") {
                        alert('You must enter url option 2.');
                        err = "true";
                        return (false)           
                }
                
               // if (document.getElementById("url3").value == "") {
                 //       alert('You must enter url option 3.');
                   //     err = "true";
                     //   return (false)           
                //}
                //alert(document.getElementById("rider").checked);
                //if (document.getElementById("rider").checked){
                //&& document.getElementById("riderColor").options[document.getElementById("riderColor").selectedIndex].value == ""
                 //       alert('You must select a rider color.');
                 //       err = "true";
               //         return (false
              //  }
                
                if (document.getElementById("skin").options[document.getElementById("skin").selectedIndex].value == "") {
                        alert('You must select a skin option.');
                        err = "true";
                        return (false)           
                }
                
                if (document.getElementById("cardtype").options[document.getElementById("cardtype").selectedIndex].value == "") {
                        alert('You must select a card type.');
                        err = "true";
                        return (false)           
                }
                
                if (document.getElementById("accnumber").value == "") {
                        alert('You must enter your account number.');
                        err = "true";
                        return (false)           
                }
                
                if (document.getElementById("CCExpMonth").options[document.getElementById("CCExpMonth").selectedIndex].value == "") {
                        alert('You must select an expiration month.');
                        err = "true";
                        return (false)           
                }
                
                if (document.getElementById("CCExpYear").options[document.getElementById("CCExpYear").selectedIndex].value == "") {
                        alert('You must select a expiration year.');
                        err = "true";
                        return (false)           
                }
                
               if (err == ""){
               CheckMenu();
               return (true)
               }
                
            }
	
	//////////////////////////////////////////////////////////////////
	function formatCurrency(num) {
        num = num.toString().replace(/\$|\,/g,'');
        if(isNaN(num))
        num = "0";
        sign = (num == (num = Math.abs(num)));
        num = Math.floor(num*100+0.50000000001);
        cents = num%100;
        num = Math.floor(num/100).toString();
        if(cents<10)
        cents = "0" + cents;
        for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
        num = num.substring(0,num.length-(4*i+3))+','+
        num.substring(num.length-(4*i+3));
        return (((sign)?'':'-') + '$' + num + '.' + cents);
        }
	
	//////////////////////////////////////////////////////////////////
	function AddRiderToOrder(ridercost){

			var tmpValid = "0"
			document.getElementById("ototal_Label").innerHTML = ""
			document.getElementById("addrider_Label").innerHTML = ""
			var statictotal = document.getElementById("StaticTotal").value;
			var currentTotal = document.getElementById("total").value;
			
			
			// see if they are removing the rider
			if (document.getElementById("riderColor").options[document.getElementById("riderColor").selectedIndex].value == "0")
			    {
			        
			        document.getElementById("addrider_Label").innerHTML = ""
			        document.getElementById("ototal_Label").innerHTML = formatCurrency(statictotal)
			        document.getElementById("total").value = statictotal
			    }
			
			else
			{
			var newtotal = parseFloat(ridercost)  +  parseFloat(statictotal)
			
			document.getElementById("addrider_Label").innerHTML = "Add Rider : " + formatCurrency(ridercost) + "<br />"
			document.getElementById("total").value = newtotal
			document.getElementById("ototal_Label").innerHTML = formatCurrency(newtotal)
			}
			//alert(document.getElementById("total").value)
			
			
			}
	
	
	//////////////////////////////////////////////////////////////////
	
	
	function CheckListingData(){

			var tmpValid = "0"
			document.getElementById("LP_label").innerHTML = ""
			document.getElementById("ad_label").innerHTML = ""
			document.getElementById("city_label").innerHTML = ""
			document.getElementById("zip_label").innerHTML = ""
			document.getElementById("Tax_label").innerHTML = ""
			document.getElementById("Rmks_Label").innerHTML = ""
			document.getElementById("LP_label").innerHTML = ""
			document.getElementById("LP_label").innerHTML = ""
			document.getElementById("LP_label").innerHTML = ""
			
			
	
	        if (isWhitespace(document.getElementById("LP").value))
				{
				document.getElementById("LP_label").innerHTML = " * Required"
				//document.FormLogin.UserID.focus();
				tmpValid++
				}
				
			if (isWhitespace(document.getElementById("ad").value))
				{
				document.getElementById("ad_label").innerHTML = " * Required"
				//document.FormLogin.UserID.focus();
				tmpValid++
				}
				
			if (isWhitespace(document.getElementById("city").value))
				{
				document.getElementById("city_label").innerHTML = " * Required"
				//document.FormLogin.UserID.focus();
				tmpValid++
				}
		    
		    if (isWhitespace(document.getElementById("zip").value))
				{
				document.getElementById("zip_label").innerHTML = " * Required"
				//document.FormLogin.UserID.focus();
				tmpValid++
				}
	        
	        if (isWhitespace(document.getElementById("Tax").value))
				{
				document.getElementById("Tax_label").innerHTML = " * Required"
				//document.FormLogin.UserID.focus();
				tmpValid++
				}
			
			 if (isWhitespace(document.getElementById("Rmks").value))
				{
				document.getElementById("Rmks_Label").innerHTML = " * Required"
				//document.FormLogin.UserID.focus();
				tmpValid++
				}
	
	
	
			if (tmpValid == "0") {
    			
			    document.getElementById("Main_Label").innerHTML = ""
			    document.getElementById("submitbutton").disabled = true
			    //document.getElementById("inpContent").value = oEdit1.getHTMLBody();
			    return (true);
		    }   
			
			else {
			    document.getElementById("Main_Label").innerHTML = "<span style='font-family:Verdana; font-size=12px; color=CC0000'><b>Required fields are missing.</b></span><BR><BR>"
			    return (false)
			}
	}
	
	
	//////////////////////////////////////////////////////////////////
	function ChangeLinkTab() {
				if (document.getElementById("sms").checked == true)
					 {					
						
						document.getElementById("smsinfo").style.display = "block";
						document.getElementById("smsinfo").style.visibility = "visible";
						
						
						
											
					}
			    
			    if (document.getElementById("sms").checked == false)
					 {					
						
						
						document.getElementById("smsinfo").style.display = "none";
						document.getElementById("smsinfo").style.visibility = "hidden";
						
						document.getElementById("smsnumber").value =''
											
					}
		}
	
	
	
	//////////////////////////////////////////////////////////////////
	//////////////////////////////////////////////////////////////////
	//////////////////////////////////////////////////////////////////
	//////////////////////////////////////////////////////////////////
		//////////////////////////////////////////////////////////////////
	//////////////////////////////////////////////////////////////////
	//////////////////////////////////////////////////////////////////
	//////////////////////////////////////////////////////////////////
		//////////////////////////////////////////////////////////////////
	//////////////////////////////////////////////////////////////////
	//////////////////////////////////////////////////////////////////
	//////////////////////////////////////////////////////////////////
	
	
	//OLD STUFF below
	
	
	
	
	
	
	
	
		// ***** only allow one search param to look up listing info showtime/home.asp
		function clearOne(str_value,fieldToClear) {
			/*
			if (str_value != '') {
			//	alert(str_value)
			
			if (fieldToClear ='ln') {
				document.form1.ln.value ==''
				document.form1.ln.disabled = true
				}
			
			if(fieldToClear ='street') {
				document.form1.street.vallue ==''
				document.form1.Subdivision.value ==''
				document.form1.City.value ==''
				document.form1.agent.value ==''
				document.form1.street.disabled = true
				document.form1.Subdivision.disabled = true
				document.form1.City.disabled = true
				document.form1.agent.disabled = true
				}
				
			}
			
			if (str_value ='') {
				if (fieldToClear ='ln') {
				document.form1.ln.disabled = false
				}
				
				 if(fieldToClear ='street') {
				document.form1.street.disabled = false
				document.form1.Subdivision.disabled = false
				document.form1.City.disabled = false
				document.form1.agent.disabled = false
				}
			
			
			}*/
		}
		
	//******* 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\n"
	 	 failed= true	
		}
		
		if (document.searchform.LN.value!='') {
	  	//display = display + "Property Type"
	 	 failed= false	
		}
		
			
	if (failed==true){
		display = display + "Or MLS Number"
		alert(display)
		return(false)
	}
	else {
		
	return(true)
}



	}
	
	///////////////////////////////////////////////////////////////
	
	//****** moves area from list to text box??
function MoveAreas(AreaValue,ListValue) {
		var NewAreaValule
		
		if (AreaValue=='') {
			NewAreaValule=ListValue
			}
		else {
			NewAreaValule = AreaValue +","+ ListValue
			}
		document.searchform.area.value=NewAreaValule
		}
	
	/////////////////////////////////////////////////////////////////////////////	
			//***** checks to make sure only one email address is in the agent email field
		function checkemail(which_field,email_address)
			{
				//var email_address = formagent.emailaddress.value;
  				var AtSign = 0;
				for (i = 0;  i < email_address.length;  i++)	
					if (email_address.charAt(i) == '@')
					{
						
						AtSign++;
						}
						
					if(AtSign >= 2){
					
					alert('Only one email address is allowed in this field.\n ');
						which_field.value="";
							which_field.focus();
					}
					
				}
///////////////////////////////////////////////////////////////////////
//******* CHECKS FIELDS ON Agent Info page
function CheckAgentUpdate(){
	var tmpValid = "0"
			
			
			
			if (isWhitespace(document.formagent.First_Name.value))
				{
				alert("First Name is Required")
				document.formagent.First_Name.focus();
				tmpValid++
				}
			
			else if  (isWhitespace(document.formagent.last_Name.value))
					{
					alert("Last Name is Required")
					document.formagent.last_Name.focus();
					tmpValid++
					}
			
			else if  (isWhitespace(document.formagent.password.value))
					{
					alert("Password is Required")
					document.formagent.password.focus();
					tmpValid++
					}
				
			else if (document.formagent.emailaddress.value.toLowerCase()!='none' && !(isEmail(document.formagent.emailaddress.value)))
				{
				alert("Please Enter a valid email address")
				document.formagent.emailaddress.focus();
				tmpValid++
				}	
			
			if (tmpValid == "0") {
				return (true);
			}
			else {
				return (false)
				}	
	
		



	}
	
	///////////////////////////////////////////////////////////////////////
//******* CHECKS FIELDS ON Agent Info page
function CheckAddAgent(){
	var tmpValid = "0"
			
			
			
			if (isWhitespace(document.form2.First_Name.value))
				{
				alert("First Name is Required")
				document.form2.First_Name.focus();
				tmpValid++
				}
			
			else if  (isWhitespace(document.form2.last_Name.value))
					{
					alert("Last Name is Required")
					document.form2.last_Name.focus();
					tmpValid++
					}
			
			else if  (isWhitespace(document.form2.password.value))
					{
					alert("Password is Required")
					document.form2.password.focus();
					tmpValid++
					}
			
			else if  (isWhitespace(document.form2.MLSid.value))
					{
					alert("MLS ID is Required")
					document.form2.MLSid.focus();
					tmpValid++
					}
				
			else if (document.form2.emailaddress.value.toLowerCase()!='none' && !(isEmail(document.form2.emailaddress.value)))
				{
				alert("Please Enter a valid email address")
				document.form2.emailaddress.focus();
				tmpValid++
				}	
			
			if (tmpValid == "0") {
				return (true);
			}
			else {
				return (false)
				}	
	
		



	}
	
	////////////////////////////////////////////////////
	
	//******* 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 {
	document.getElementById('AddIt').disabled = true
	return(true)
	}

}

//////////////////////////////////////////////////////////
//***** checks email on send feedback  feedback/emailfeedback.default.asp

	//******* CHECKS FIELDS ON LN Search criteria page
function CheckFeedbackEmails(){
	var display = "Error!\n"
	var failed=false
	var ToAddress = document.sendEmail.ToAddress.value
	var ToAgentAddress = document.sendEmail.AgentAddress.value
	var ToAtSign = 0;
	var AgentAtSign = 0;
	
	
		
		for (i = 0;  i < ToAddress.length;  i++)	
		if (ToAddress.charAt(i) == '@')
		{
			
			ToAtSign++;
			
			}
			
		if(ToAtSign != 1){
		//alert(ToAddress)
			display = display + "Only One email address is allowed in this field\n"
	 	 failed=true	
	 	 }
	
	
	for (i = 0;  i < ToAgentAddress.length;  i++)	
		if (ToAgentAddress.charAt(i) == '@')
		{
			
			AgentAtSign++;
			}
			
		if(AgentAtSign != 1){
		//alert(ToAgentAddress)
			display = display + "Only One email address is allowed in this field\n"
	 	 failed= true	
	 	 }
		
		
	 if (!(isEmail(ToAddress))){
			display = display + "You must supply a valid email for your client\n"
	 	 failed= true	
	 	 }
	 	 
	 if (!(isEmail(ToAgentAddress))){
			display = display + "You must supply a valid email for yourself\n"
	 	 failed= true	
	 	 }
		
					
	if (failed==true){
		alert(display)
		return(false)
	}
	else {
		
	return(true)
}



	}
	
/////////////////////////////////////
//********* 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 LN for auto fill listings/assistant.asp
function teamgetln(listnum) {
	if (listnum != '') {
		location.href="team.asp?ln=" + listnum
		}
	}

////////////////////////////////////////////////

//****** adds quick instruction to listing listings/default.asp//
function QuickPick(quickp,maintext) {
	//if maintext != "" {
		document.form1.instructions.value= quickp + "\n" + maintext
	//}
		
		//else {
		//document.form1.instructions.value= quickp 
		//}
}


////////////////////////////////////////////////

//****** adds quick notes to showing/appointment.asp//
function QuickPick2(stamp,quickp,maintext,doit) {
	var d=new Date()
	var day=d.getDate()
	var month=d.getMonth() + 1
	var year=d.getFullYear()

		document.form1.notes.value= stamp + ": \n" + quickp + "\n \n" + maintext + "\n \n"
		
		if (doit == '1') 
			{
				document.form1.ShowAgent_confirm.checked = true
			}
	
}

////////////////////////////////////////////////
//******* CHECKS FIELDS ON Angent Info page
function CheckEditListing(){
	var tmpValid = "0"

	
	 if (document.form1.Sellersemail.value!='' && !(isEmail(document.form1.Sellersemail.value)))
				{
				alert("Please Enter a valid email address for your seller or leave blank")
				document.form1.Sellersemail.focus();
				tmpValid++
				}	
	
if (tmpValid == "0") {
				//document.getElementById('Submit1').disabled = true
				return (true);
			}
			
			else {
				return (false)
				}



	}
	




////////////////////////////////////////////////
//******* CHECKS FIELDS ON Angent Info page
function CheckNewListing(){
	var tmpValid = "0"
			
	if (isWhitespace(document.form1.ln.value))
		{
		alert("Listing Number is Required")
		document.form1.ln.focus();
		tmpValid++
		}
	
	else if (isWhitespace(document.form1.listprice.value))
		{
		alert("Listing Price is Required")
		document.form1.listprice.focus();
		tmpValid++
		}
	
	else if (isWhitespace(document.form1.listAgentName.value))
		{
		alert("Listing Agent\'s Name is Required")
		document.form1.listAgentName.focus();
		tmpValid++
		}
	
	else if (document.form1.Sellersemail.value!='' && !(isEmail(document.form1.Sellersemail.value)))
				{
				alert("Please Enter a valid email address for your seller or leave blank")
				document.form1.Sellersemail.focus();
				tmpValid++
				}	
	
if (tmpValid == "0") {
				document.getElementById('Submit1').disabled = true
				return (true);
			}
			else {
				return (false)
				}



	}
	
	////////////////////////////////////////////////////////////
	//confimr beofre deleting a listing
		function confirm_delete(id,ln){
		 var whereto = "/listings/DeleteListing.asp?Delete=1&ID=" + id + "&ln=" + ln
	
    if (confirm("Deleting this Listing will completely remove it and all associated information (feedback, appointment history, etc.) from the system.\n Are you sure you want to continue? Click OK to Delete this Listing. Click Cancel to do nothing")) {
        window.open(whereto,'deletelistings','width=450,height=140,') 
        
    }
    else {
        //do nothing
    }       
}
///////////////////////////////////////
//print showing instruc
	//function printinst(listid) {
	//print_window = window.open('PrintInstructions.asp?id='+listid,'print_window','width=620,height=590');
	//print_window.focus()

	function printinst(theURL, Name, popW, popH, scroll, resize) { // V 1.0

	var winleft = (screen.width - popW) / 2;
	var winUp = (screen.height - popH) / 2;
	winProp = 'width='+popW+',height='+popH+',left='+winleft+',top='+winUp+',scrollbars='+scroll+',resizable='+resize+'';
	Win = window.open(theURL, Name, winProp);
	Win.window.focus();

	
}	



//******* CHECKS FIELDS ON Agent assistant.asp
function CheckAssistantListing(){
		var tmpValid = "0"
			
	if (isWhitespace(document.form1.ln.value))
		{
		alert("Listing Number is Required")
		document.form1.ln.focus();
		tmpValid++
		}
		
	else if (isWhitespace(document.form1.listprice.value))
		{
		alert("Listing Price is Required")
		document.form1.listprice.focus();
		tmpValid++
		}
	
	else if (document.form1.listAgentpick.value=='')
		{
		alert("Listing Agent\'s Name is Required")
		tmpValid++
		}
	
	else if (document.form1.Sellersemail.value!='' && !(isEmail(document.form1.Sellersemail.value)))
				{
				alert("Please Enter a valid email address for your seller or leave blank")
				document.form1.Sellersemail.focus();
				tmpValid++
				}		
	
if (tmpValid == "0") {
				document.getElementById('Submit1').disabled = true
				return (true);
			}
			else {
				return (false)
				}



	}
	
/////////////////////////////////////////////////
	function CheckListingUpdateForm() {
		var display = "The following fields are required:\n"
		var failed=false
		
		
			if (document.form1.emailSubject.value=='') {
				display = display + "Email Subject\n"
	 			 failed= true	
			}


			if (document.form1.emailHeader.value=='') {
				display = display + "Email Header\n"
	 			 failed= true	
			}
			
			if (document.form1.EmailBody.value=='') {
				display = display + "Email Body\n"
	 			 failed= true	
			}
			
					

		if (failed==true){
		alert(display)
		return(false)
	}
	else {
		document.getElementById('SendIt').disabled = true
	return(true)
}



	}
	////////////////////////////////////////////////////////////////
	//**** checks form on appointment page appointment.asp
function CheckAppointment(){
	var tmpValid = "0"
			
	if (isWhitespace(document.form1.AgentID.value))
		{
		alert("Showing AgentID is Required")
		document.form1.AgentID.focus();
		tmpValid++
		}
	
	else if (isWhitespace(document.form1.FirstName.value))
		{
		alert("Agents Fist Name is Required")
		document.form1.FirstName.focus();
		tmpValid++
		}
		
	else if (isWhitespace(document.form1.LastName.value))
		{
		alert("Agents Last Name is Required")
		document.form1.LastName.focus();
		tmpValid++
		}
		
	else if (isWhitespace(document.form1.aptDate.value))
		{
		alert("Appointment date is Required")
		document.form1.LastName.focus();
		tmpValid++
		}
				
			
	else if (document.form1.aptStartTime.value=='') {
	  	alert("Appointment time  Required")
	 	 tmpValid++	
		}

else if (document.form1.agentEmail.value!='' && !(isEmail(document.form1.agentEmail.value)))
				{
				alert("Please Enter a valid showing agent email address or leave blank")
				document.form1.agentEmail.focus();
				tmpValid++
				}	

if (tmpValid == "0") {
				document.getElementById('AddIt').disabled = true
				return (true);
			}
			else {
				return (false)
				}


}
/////////////////////////////////////////////////////////
//********* look up agent ID for showing appointment showing/appointment.asp
function GetShowAgent(AID,listID) {
	if (AID != '') {
		location.href="overview.asp?ID=" + listID + "&ShowAID=" + AID
		}
	}
	
//////////////////////////////////////////////////////
function goGo(){
				document.form1.FirstName.focus();
				window.scrollTo(0,500);
				//alert("hello")
				}

/////////////////////////////////////////////////
//********* 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()
	
}
/////////////////////////////////////////////////
//********* Open Calendar.aspx page
function OpenCal3() {
	document.form1.PostDate.blur()
	calendar_window = window.open('cal.aspx','calendar_window','width=265,height=190');
	calendar_window.focus()
	
}

/////////////////////////////////////////////////
//********* Open Calendar2.aspx page
function OpenCal2() {
	document.form1.ArchiveDate.blur()
	calendar_window = window.open('cal2.aspx','calendar2_window','width=265,height=190');
	calendar_window.focus()
	
}

///////////////////////////////////////
function CheckAppointmentUpdate(){
	var tmpValid = "0"
	
	if (isWhitespace(document.form1.aptDate.value))
		{
		alert("Appointment date is Required")
		document.form1.LastName.focus();
		tmpValid++
		}
				
			
	else if (document.form1.aptStartTime.value=='') {
	  	alert("Appointment time  Required")
	 	 tmpValid++	
		}
	
	if (tmpValid == "0") {
				document.getElementById('mod1').disabled = true
				return (true);
			}
			else {
				return (false)
				}


}

////////////////////////////////////////////////////////////
	//confirm beofre deleting a post
		function confirm_delete_post(id){
		 var whereto = "/MessageBoard/DeletePost.asp?Delete=1&ID=" + id 
	
    if (confirm("Deleting this Message will completely remove it and all associated information from the system.\n Are you sure you want to continue? Click OK to Delete this Message. Click Cancel to do nothing")) {
        window.open(whereto,'deletePost','width=450,height=140,') 
        
    }
    else {
        //do nothing
    }       
}	

/////////////////////////////////

function CheckPost() {
	
	var tmpValid = "0"
	
	if (isWhitespace(document.form1.PostDate.value))
		{
		alert("Post Date is Required")
		document.form1.PostDate.focus();
		tmpValid++
		}
		
	else if (isWhitespace(document.form1.ArchiveDate.value))
		{
		alert("Archive Date is Required")
		document.form1.ArchiveDate.focus();
		tmpValid++
		}
	
	else if (isWhitespace(document.form1.subject.value))
		{
		alert("Subject is Required")
		document.form1.subject.focus();
		tmpValid++
		}
		
	if (tmpValid == "0") {
				document.getElementById('addPost').disabled = true
				document.getElementById("inpContent").value = oEdit1.getHTMLBody();
				return (true);
			}
			else {
				return (false)
				}


}

/////////////////////////////////

function CheckReplyTo() {
	
	var tmpValid = "0"
	
	if (isWhitespace(document.form1.subject.value))
		{
		alert("Subject is Required")
		document.form1.subject.focus();
		tmpValid++
		}
	
	else if (isWhitespace(document.form1.replytext.value))
		{
		alert("Your Response is Required")
		document.form1.replytext.focus();
		tmpValid++
		}
		
	
	
	else if (!(isEmail(document.form1.ReplyTo.value)))
			{
				alert("Please enter a valid Email Address")
				document.form1.ReplyTo.focus();
				tmpValid++
				}
	

		
	if (tmpValid == "0") {
				document.getElementById('SendReply').disabled = true
				//document.getElementById("inpContent").value = oEdit1.getHTMLBody();
				return (true);
			}
			else {
				return (false)
				}


}

///////////////////////////////////////////////////

function CheckOfficeUpdate() {
	
	var tmpValid = "0"

 if (!(isEmail(document.form1.OfficeEmail.value)))
			{
				alert("Please enter a valid office email address before proceeding")
				document.form1.OfficeEmail.focus();
				tmpValid++
				}

if (tmpValid == "0") {
				document.getElementById('submitbutton').disabled = true
				//document.getElementById("inpContent").value = oEdit1.getHTMLBody();
				return (true);
			}
			else {
				return (false)
				}


}

////////////////////////////////////

function OpenGenWindow(theURL, Name, popW, popH, scroll, resize) { // V 1.0
	var winleft = (screen.width - popW) / 2;
	var winUp = (screen.height - popH) / 2;
	winProp = 'width='+popW+',height='+popH+',left='+winleft+',top='+winUp+',scrollbars='+scroll+',resizable='+resize+'';
	Win = window.open(theURL, Name, winProp);
	Win.window.focus();
}

///////////////////////////////////

	
//-->



	