MOON
Server: Apache
System: Linux 54-179-220-51.cprapid.com 3.10.0-1160.144.1.el7.tuxcare.els4.x86_64 #1 SMP Tue Apr 7 08:40:40 UTC 2026 x86_64
User: thehunarfound (1001)
PHP: 7.4.29
Disabled: NONE
Upload Files
File: /home/thehunarfound/public_html/sms/lib/Jfunctions.php
<script language="javascript">

var xmlHttp

function chkListing(listval,webid)
{
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request");
 		return
 	}
	
	var url = " chklisting.php"
	url = url+"?listid="+listval+"&webid="+webid
	xmlHttp.onreadystatechange=listing_changed 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function rtest(sval)
{
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request");
 		return
 	}
	
	var url = " regional_market.php"
	url = url+"?stateid="+sval
	xmlHttp.onreadystatechange=reg_market_changed 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function prop_subtype(proptype)
{

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request");
 		return
 	}
	
	var url = " prop_subtype.php"
	url = url+"?propid="+proptype;
	xmlHttp.onreadystatechange=prop_subtype_changed 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}


function lease_subtype(proptype)
{

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request");
 		return
 	}
	
	var url = " lease_subtype.php"
	url = url+"?propid="+proptype;
	
	xmlHttp.onreadystatechange=lease_subtype_changed 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}

function chkEmail(email)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 	return
 	}
	var email = email;
	var url = "chkemail.php"
	url = url+"?email="+email
	xmlHttp.onreadystatechange=setMessage 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}
function chk_agent_Email()
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 	return
 	}
	var email = document.getElementById("agent_uname").value;
	var url = "chkemail.php"
	url = url+"?email="+email
	xmlHttp.onreadystatechange=set_agentMessage 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}

function rsState(cntryid,sel)
{

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 	return
 	}
	var cntid = cntryid;
	var url = " resState.php"
	if(sel!='')
	url = url+"?cntid="+cntid+"&sel="+sel
	else
	url = url+"?cntid="+cntid
	xmlHttp.onreadystatechange=rsStateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}

function mapState(cntryid)
{

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 	return
 	}
	var cntid = cntryid;
	var url = " mapState.php"
	url = url+"?cntid="+cntid
	xmlHttp.onreadystatechange=mapStateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}

function relState(cntryid)
{

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 	return
 	}
	var cntid = cntryid;
	var url = " relState.php"
	url = url+"?cntid="+cntid
	xmlHttp.onreadystatechange=relStateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}

function mvgState(cntryid)
{

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 	return
 	}
	var cntid = cntryid;
	var url = " mvgState.php"
	url = url+"?cntid="+cntid
	xmlHttp.onreadystatechange=mvgStateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}

function brokstate(cntryid,sel)
{

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 	return
 	}
	var cntid = cntryid;
	var url = "brState.php"
	if(sel!='')
		url = url+"?cntid="+cntid+"&sel="+sel
	else
		url = url+"?cntid="+cntid
	
	xmlHttp.onreadystatechange=brStateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}

function agentstate(cntryid)
{

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 	return
 	}
	var cntid = cntryid;
	var url = "agentState.php"
	url = url+"?cntid="+cntid
	xmlHttp.onreadystatechange=agentStateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}

function get_broker_County(state)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 		return
 	}
	
	var url = "county_list.php"
	url = url+"?state="+state
	xmlHttp.onreadystatechange = show_county
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function show_state(countryid,county)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 		return
 	}
	
	var url = "statelist.php"
	url = url+"?country="+countryid+"&cval="+county
	xmlHttp.onreadystatechange=showstate 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}

function multi_state(countryid)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 		return
 	}
	
	var url = "multistate.php"
	url = url+"?country="+countryid
	xmlHttp.onreadystatechange=showmultistate 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}


function lease_state(countryid)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 	return
 	}
	
	var url = " lease_statelist.php"
	url = url+"?country="+countryid
	xmlHttp.onreadystatechange=lease_statechanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}

function regional_market(val_state)
{
	alert("hi");
	alert(val_state);
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 		return
 	}
	
	var url = "regional_market.php"
	url = url+"?stateid="+val_state
	xmlHttp.onreadystatechange=reg_market_changed 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}

function l_state(countryid)
{

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 		return
 	}
	
	var url = "l_state.php"
	url = url+"?country="+countryid
	xmlHttp.onreadystatechange=lstate_changed 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}


function show_market(reg_market_id)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 	return
 	}
		
	var url = "market.php"
	url = url+"?reg_market_id="+reg_market_id
	xmlHttp.onreadystatechange=market_changed 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}

function show_market1(reg_market_id)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 	return
 	}
		
	var url = "market1.php"
	url = url+"?reg_market_id="+reg_market_id
	xmlHttp.onreadystatechange=market_changed1
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}

/*function submarket(marketid)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 	return
 	}
	alert(marketid);
	var url = " submarket.php"
	url = url+"?marketid="+marketid
	xmlHttp.onreadystatechange=submarket_changed 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}*/

function test(testid)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 	return
 	}
	
	var url = " submarket.php"
	url = url+"?marketid="+testid
	
	xmlHttp.onreadystatechange=submarket_changed 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function submarket1()
{

	var total ="";
	for(var i=0; i < document.search_lease_more.market.length; i++){
	if(document.search_lease_more.market[i].selected)
	total +=document.search_lease_more.market[i].value + ","
	}
	
	//alert (total);
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 	return
 	}
	
	var url = " submarket1.php"
	url = url+"?marketid="+total
	
	xmlHttp.onreadystatechange=submarket_changed1
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function showCatList()
{ 

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }

//var webid = valButton(addImage.website, 'Please Select Website');
var webid = valButton();
var rowid = document.addImage.wRow.value;

if(webid!='' && rowid!='')
{
var url="getCatList.php"
url=url+"?webid="+webid+"&rowid="+rowid
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
}


function valButton() {
	
    var cnt = -1;
    for (var i=document.addImage.website.length-1; i > -1; i--) {
        if (document.addImage.website[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return document.addImage.website[cnt].value;
	else{
	alert("Please Select Website");
	return false;
	}
   
}


function showWebCategory(website)
{ 

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }

if(website!='')
{
var url=" getWebCatList.php"
url=url+"?website="+website
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}else{
document.uploadListing.webcategory.value='';

}
}

function propertyType(website)
{ 

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }

if(website!='')
{
var url=" getPropList.php"
url=url+"?website="+website
xmlHttp.onreadystatechange=propChanged 
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}
}

function get_comm_property(prop_status)
{ 

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }

if(prop_status!='')
{
var url=" get_commprop.php"
url=url+"?pstatus="+prop_status
xmlHttp.onreadystatechange=comm_property 
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}
}

	
	function getCity(strURL) {		
		
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
		
		if(strURL!='')
		{
		var url=" findcity.php"
		url=url+"?county="+strURL
		xmlHttp.onreadystatechange=cityChanged 
		xmlHttp.open("POST",url,true)
		xmlHttp.send(null)
		}

	}
	

	
	function agentCity(strURL) {		
		
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
		
		if(strURL!='')
		{
		var url=" agentcity.php"
		url=url+"?county="+strURL
		xmlHttp.onreadystatechange=agentcityChanged 
		xmlHttp.open("POST",url,true)
		xmlHttp.send(null)
		}

	}	

function rsStateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 

 document.getElementById("state").style.display = 'none';
 document.getElementById("state1").style.display = 'block';
 document.getElementById("state1").innerHTML=xmlHttp.responseText 
 } 
}	

function mapStateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 

 document.getElementById("map_span").style.display = 'none';
 document.getElementById("map_span1").style.display = 'block';
 document.getElementById("map_span1").innerHTML=xmlHttp.responseText 
 } 
}	

function relStateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("rel_span").style.display = 'none';
 document.getElementById("rel_span1").style.display = 'block';
 document.getElementById("rel_span1").innerHTML=xmlHttp.responseText 
 } 
}	

function mvgStateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("sell_span").style.display = 'none';
 document.getElementById("sell_span1").style.display = 'block';
 document.getElementById("sell_span1").innerHTML=xmlHttp.responseText 
 } 
}

function brStateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 

 document.getElementById("state_span").style.display = 'none';
 document.getElementById("state_span1").style.display = 'block';
 document.getElementById("state_span1").innerHTML=xmlHttp.responseText 
 } 
}	

function agentStateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 

 document.getElementById("state_span").style.display = 'none';
 document.getElementById("state_span1").style.display = 'block';
 document.getElementById("state_span1").innerHTML=xmlHttp.responseText 
 } 
}

	
	function cityChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	var result = xmlHttp.responseText;
	
	if(result!='')
	{
	document.getElementById("canada").style.display = 'none';
	document.getElementById("usa").style.display = 'block';
	document.getElementById("citydiv").style.display = 'block';
 	document.getElementById("citydiv").innerHTML=xmlHttp.responseText;
	}else{
	document.getElementById("usa").style.display = 'none';
	document.getElementById("canada").style.display = 'block';
	}
 } 
}
	

	function agentcityChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	var result = xmlHttp.responseText;
	
	if(result!='')
	{
	document.getElementById("canada").style.display = 'none';
	document.getElementById("usa").style.display = 'block';
	document.getElementById("citydiv").style.display = 'block';
 	document.getElementById("citydiv").innerHTML=xmlHttp.responseText;
	}else{
	document.getElementById("usa").style.display = 'none';
	document.getElementById("canada").style.display = 'block';
	}
 } 
}
	


function getCounty(strURL) {		
		
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }

if(strURL!='')
{
var url=" findcounty.php"
url=url+"?state="+strURL
xmlHttp.onreadystatechange=countyChanged 
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}

}

function agentCounty(strURL) {		
		
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }

if(strURL!='')
{
var url=" agentcounty.php"
url=url+"?state="+strURL
xmlHttp.onreadystatechange=agentcountyChanged 
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}

}



function msa_county(strURL) {		
			
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }

if(strURL!='')
{
var url=" msa_county.php"
url=url+"?state="+strURL
xmlHttp.onreadystatechange = msa_county_changed
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}

}

function msa(strURL) {
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }

var url=" msa.php"
url=url+"?state="+strURL
xmlHttp.onreadystatechange = msa_changed
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}

function multi_msa()
{

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }

var seltotal ="";
	for(var i=0; i < document.sale_search_more.mlstate.length; i++){
	if(document.sale_search_more.mlstate[i].selected)
	seltotal +=document.sale_search_more.mlstate[i].value + ",";
	}

var url=" msa.php"
url=url+"?state="+seltotal
xmlHttp.onreadystatechange = msa_changed
xmlHttp.open("POST",url,true)
xmlHttp.send(null)

}

function reg_market_county(strURL) {		
			
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }

if(strURL!='')
{
var url=" market_county.php"
url=url+"?state="+strURL
xmlHttp.onreadystatechange = market_county_changed
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}

}


function countyChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	
	var result1 = xmlHttp.responseText
	var result_split1 = result1.split("|");
	//alert(result_split1[1]);
	if(result_split1[0]!='')
	{
	document.getElementById("canada").style.display = 'none';
	document.getElementById("usa").style.display = 'block';
	document.getElementById("countydiv").style.display = 'block';
 	document.getElementById("countydiv").innerHTML=result_split1[0];
	}else{
	document.getElementById("usa").style.display = 'none';
	document.getElementById("canada").style.display = 'block';
	document.getElementById("canada_citydiv").innerHTML = result_split1[1];
	}
 } 
}

function agentcountyChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	
	var result1 = xmlHttp.responseText
	var result_split1 = result1.split("|");
	//alert(result_split1[1]);
	if(result_split1[0]!='')
	{
	document.getElementById("canada").style.display = 'none';
	document.getElementById("usa").style.display = 'block';
	document.getElementById("countydiv").style.display = 'block';
 	document.getElementById("countydiv").innerHTML=result_split1[0];
	}else{
	document.getElementById("usa").style.display = 'none';
	document.getElementById("canada").style.display = 'block';
	document.getElementById("canada_citydiv").innerHTML = result_split1[1];
	}
 } 
}



function msa_county_changed() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	
	var result1 = xmlHttp.responseText
	var result_split1 = result1.split("|");
	
	if(result_split1[0]!='')
	{
	document.getElementById("canada").style.display = 'none';
	document.getElementById("usa").style.display = 'block';
	document.getElementById("countydiv").style.display = 'block';
 	document.getElementById("countydiv").innerHTML=result_split1[0];
	}else{
	document.getElementById("usa").style.display = 'none';
	document.getElementById("canada").style.display = 'block';
	document.getElementById("canada_citydiv").innerHTML = result_split1[1];
	}
	document.getElementById("msa").innerHTML = result_split1[2];
	if(result_split1[3] == "1")
	{
		document.getElementById("chk_msa").value="1";
	}
	else
	{
		document.getElementById("chk_msa").value="0";
	}
 } 
}

function msa_changed() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
		
	document.getElementById("msa").innerHTML = xmlHttp.responseText;
 } 
}

function reg_market_changed()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 		var result1 = xmlHttp.responseText
		var result_split1 = result1.split("|")
		//alert(xmlHttp.responseText);
	//document.getElementById("reg_market").innerHTML = xmlHttp.responseText;
	document.getElementById("reg_market").innerHTML = result_split1[0];
	document.getElementById("market").innerHTML = result_split1[1];
	document.getElementById("submarket").innerHTML = result_split1[2];
 } 

}

function listing_changed()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
		var showmsg = xmlHttp.responseText
		//alert(xmlHttp.responseText);
		if(showmsg!='')
		{
			alert(showmsg);
		}
		//document.getElementById("listingid").focus();
		//document.getElementById("listingid").value ="";
	//document.getElementById("reg_market").innerHTML = xmlHttp.responseText;
 } 

}

function show_county()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
		
	document.getElementById("county").innerHTML = xmlHttp.responseText;
 } 

}

function lstate_changed()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 
 	var result1 = xmlHttp.responseText
	var result_split1 = result1.split("|")
	
	
	if(result_split1[1] == '1')
	{
		document.getElementById("txt1").style.display = 'none';
		document.getElementById("txt").style.display = 'block';
		document.getElementById("txt").innerHTML = 'State';
	}
	if(result_split1[1] == '2')
	{
		document.getElementById("txt").style.display = 'none';
		document.getElementById("txt1").style.display = 'block';
		document.getElementById("txt1").innerHTML = 'Province';
	}
	document.getElementById("state").style.display ='none';
	document.getElementById("state1").style.display ='block';
	document.getElementById("state1").innerHTML = result_split1[0];
	document.getElementById("reg_market").innerHTML = result_split1[2];
	document.getElementById("market").innerHTML = result_split1[3];
	document.getElementById("submarket").innerHTML = result_split1[4];
	
 } 

}

function prop_subtype_changed()
{
	if (xmlHttp.readyState == 4 && xmlHttp.status == 200) 
	{
	document.getElementById("subspan").style.display ='none';
	document.getElementById("subspan1").style.display ='block';
	document.getElementById("subspan1").innerHTML = xmlHttp.responseText;<!-- -->
	}
}

function lease_subtype_changed()
{
	if (xmlHttp.readyState == 4 && xmlHttp.status == 200) 
	{
	document.getElementById("subspan").style.display ='none';
	document.getElementById("subspan1").style.display ='block';
	document.getElementById("subspan1").innerHTML = xmlHttp.responseText
	}
}

function market_county_changed() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	
	var result1 = xmlHttp.responseText
	var result_split1 = result1.split("|");
	
	if(result_split1[0]!='')
	{
	document.getElementById("canada").style.display = 'none';
	document.getElementById("usa").style.display = 'block';
	document.getElementById("countydiv").style.display = 'block';
 	document.getElementById("countydiv").innerHTML=result_split1[0];
	}else{
	document.getElementById("usa").style.display = 'none';
	document.getElementById("canada").style.display = 'block';
	document.getElementById("canada_citydiv").innerHTML = result_split1[1];
	}
	document.getElementById("reg_market").innerHTML = result_split1[2];
	if(result_split1[3] == '1')
	{
		document.getElementById("chk_reg_market").value = '1';
	}
	else
	{
		document.getElementById("chk_reg_market").value = '0';
	}
 } 
}


function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 

	var result = xmlHttp.responseText
	var result_split = result.split("|");
	//alert(result_split[2]);

	document.getElementById("catlist").style.display = 'block';
 	document.getElementById("catlist").innerHTML=result_split[0];
	
	if(result_split[1]!='')
	{
	document.getElementById("pstatus1").style.display ="none";
	document.getElementById("proplist").style.display = 'block';
 	document.getElementById("proplist").innerHTML=result_split[1];
	}
	if(result_split[2]!='')
	{
		document.getElementById("pstatus").style.display ="none";
		document.getElementById("pstatus1").style.display ="block";
		document.getElementById("pstatus1").innerHTML = result_split[2];
		
	}else{
	document.getElementById("pstatus").style.display ="block";
	}
	
 } 
}

function showstate() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	
		var result1 = xmlHttp.responseText
	var result_split1 = result1.split("|")
	
	
	if(result_split1[1] == '1')
	{
		document.getElementById("txt1").style.display = 'none';
		document.getElementById("txt").style.display = 'block';
		document.getElementById("txt").innerHTML = 'State';
	}
	if(result_split1[1] == '2')
	{
		document.getElementById("txt").style.display = 'none';
		document.getElementById("txt1").style.display = 'block';
		document.getElementById("txt1").innerHTML = 'Province';
	}
	document.getElementById("state").style.display ='none';
	document.getElementById("state1").style.display ='block';
	
	document.getElementById("state1").innerHTML = result_split1[0];
	
 } 
}


function showmultistate() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	
	var result1 = xmlHttp.responseText
	var result_split1 = result1.split("|")
	
	
	if(result_split1[1] == '1')
	{
		document.getElementById("txt1").style.display = 'none';
		document.getElementById("txt").style.display = 'block';
		document.getElementById("txt").innerHTML = 'State';
	}
	if(result_split1[1] == '2')
	{
		document.getElementById("txt").style.display = 'none';
		document.getElementById("txt1").style.display = 'block';
		document.getElementById("txt1").innerHTML = 'Province';
	}
	document.getElementById("span_state").style.display ='none';
	document.getElementById("span_state1").style.display ='block';
	
	document.getElementById("span_state1").innerHTML = result_split1[0];
	
 } 
}


function lease_statechanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	var resulta = xmlHttp.responseText
	var result_splita = resulta.split("|")
	
	document.getElementById("state").style.display ='none';
	document.getElementById("state1").style.display ='block';
	//document.getElementById("state1").innerHTML=xmlHttp.responseText;
	document.getElementById("state1").innerHTML=result_splita[0];
	
	document.getElementById("reg_market").style.display ='block';
	document.getElementById("reg_market1").style.display ='none';
	document.getElementById("reg_market").innerHTML=result_splita[1];
	
	document.getElementById("market").style.display ='block';
	document.getElementById("mar").style.display ='none';
	document.getElementById("market").innerHTML=result_splita[2];
	
	document.getElementById("submarket").style.display ='block';
	document.getElementById("submar").style.display ='none';
	document.getElementById("submarket").innerHTML=result_splita[3];
	
 } 
}
function market_changed() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	var resulta = xmlHttp.responseText
	var result_splita = resulta.split("|")
	
	document.getElementById("market").style.display = 'none';
	document.getElementById("mar").style.display = 'block';
 	//document.getElementById("market1").innerHTML=xmlHttp.responseText;
	document.getElementById("mar").innerHTML=result_splita[0];
	
	if(result_splita[1] == '1')
	{
		document.getElementById('chk_market').value='1';
	}
	else
	{	
		document.getElementById('chk_market').value='0';
	}
 } 
}
function market_changed1() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 

	
	/*document.getElementById("market").style.display = 'none';
	document.getElementById("market1").style.display = 'block';*/
 	document.getElementById("market").innerHTML=xmlHttp.responseText;
	
 } 
}


function submarket_changed() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 

	var resulta = xmlHttp.responseText;
	var result_splita = resulta.split("|");
	
	document.getElementById("submarket").style.display = 'none';
	document.getElementById("submar").style.display = 'block';
 	document.getElementById("submar").innerHTML=result_splita[0];
	if(result_splita[1] == '1')
	{
		document.getElementById('chk_submarket').value='1';
	}
	else
	{	
		document.getElementById('chk_submarket').value='0';
	}
 } 
}

function submarket_changed1() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	//alert(xmlHttp.responseText);
 	document.getElementById("submarket").innerHTML=xmlHttp.responseText;
	
 } 
}

function propChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 

	
	document.getElementById("proplist").style.display = 'block';
 	document.getElementById("proplist").innerHTML=xmlHttp.responseText;
	
 } 
}


function comm_property() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	
	
	document.getElementById("proplist").style.display = 'block';
 	document.getElementById("proplist").innerHTML=xmlHttp.responseText;
	
 } 
}

function setMessage() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 //alert(xmlHttp.responseText);
 	if(xmlHttp.responseText!='')
	{
		document.getElementById("logemail").value = "";
		document.getElementById("logemail").focus();
		
	}
 	 document.getElementById("msg").style.display = 'block';
	 document.getElementById("msg").innerHTML=xmlHttp.responseText 
 } 
}

function set_agentMessage() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 	
 	if(xmlHttp.responseText!='')
	{
		alert(xmlHttp.responseText);
		document.getElementById("agent_uname").value = "";
		document.getElementById("agent_uname").focus();
		
	}
 	 //document.getElementById("alertmsg").style.display = 'block';
	 //document.getElementById("alertmsg").innerHTML=xmlHttp.responseText 
 } 
}

function showLease(ptype)
{
	if(ptype == 'For Rent')
	{
		document.getElementById("lease").style.display = 'block';
	}else{
		document.getElementById("lease").style.display = 'none';
	}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {

 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

	function chkImageType(pathField,fieldname)
	{
	
	var imgRe = /^.+\.(jpg|jpeg|gif|png)$/i;
	var path = pathField.value;
	if (path.search(imgRe) != -1)
	{
	}else{
		alert("Please Select JPG, PNG, and GIFs Images only!");
		document.getElementById(fieldname).value = "";
		document.addImage.wImage.value ="";
	} 	
	}

function changeRow()
{
	document.addImage.wRow.value = "";
}

function getLetter(letter)
{	
	if(document.agent_search.chkfaces.checked == true)
	{
		var face = 'Y';
		window.location = 'agents_search.php?alpha='+letter+'&face='+face
	}else{
		window.location = 'agents_search.php?alpha='+letter
	}
}

function getBLetter(letter)
{	
	if(document.agent_search.chkfaces.checked == true)
	{
		var face = 'Y';
		window.location = 'brokers_search.php?alpha='+letter+'&face='+face
	}else{
		window.location = 'brokers_search.php?alpha='+letter
	}
}




function showImage(hoveritem,Aid,x,y)
{
	
	//document.getElementById('agentImage'+Aid).style.visibility = 'visible';
	hp = document.getElementById('agentImage'+Aid);

		// Set popup to visible
		//hp.style.top = hoveritem.offsetTop + 18;
		//hp.style.left = hoveritem.offsetLeft + 100;
				
		
		if (document.layers && document.layers[hp] != null) {
			document.layers[hp].Left += x;
			document.layers[hp].Top += y;
			
			}
		
		
	hp.style.visibility = "Visible";
	
}
function hideImage(Aid)
{
	//document.getElementById('agentImage'+Aid).style.visibility = 'hidden';
	hp = document.getElementById('agentImage'+Aid);
	hp.style.visibility = "Hidden";	
}

function validate(form_id,email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = document.forms[form_id].elements[email].value;
   if(reg.test(address) == false) {
      alert('Invalid Email Address');
      return false;
   }
}


function searchFormatNum(what,cntrl) {
		var str = what;
		
		if(str.length == 0)return;
		var i;
		var newstr = "";
		var add;
		var started = false;
		var dot = false;
		for (i = 0; i < str.length; i++) {
			add = false;
			if (str.charAt(i) != ',' && str.charAt(i) >= '0' && str.charAt(i) <= '9') {
				add = true;
			}
			else
			if (str.charAt(i) == '.' && !dot) {
				started = true;
				dot = true
				add = true;
			}
			if (str.charAt(i) == '.' && i == 0) {
				newstr+='0';
			}
			if (add)
				newstr += str.charAt(i);
		}
		if (newstr.length == 0 || newstr == ".")
			newstr = "0";
	
		newstr = parseFloat(newstr).toString();
	
		if (newstr.charAt(0) == '.') {
			newstr = "0" + newstr;
		}
	
		var start = newstr.indexOf(".");
		if (start < 0) {
			start = newstr.length - 1;
		}
		else {
			start--;
		}
	
		var newstr2 = "";
		while (i >= 0) {
			if ( i > start) {
			}
			else {
				if ((start - i) % 3 == 0 && i !=start) {
					newstr2 += ",";
				}
			}
			newstr2 += newstr.charAt(i);
			i--;
		}
		var numvalue = searchReverseStr(newstr2);
		//alert(numvalue);
		document.getElementById(cntrl).value = numvalue;
	}


function searchReverseStr(str) {
		var newstr = "";
		for (i = str.length; i >= 0; i --) {
			newstr += str.charAt(i);
		}
		return newstr;
	}
function isInteger(s,cntrl)
	{
		var i;
		for (i = 0; i < s.length; i++)
		{   
			var c = s.charAt(i);
			if (((c < "0") || (c > "9"))) alert("Enter Numeric Value"); document.getElementById(cntrl).focus(); return false;
		}
		return true; // All characters are numbers.
	}

</script>