// JavaScript Document

var page=0;
function xmlhttpPost(strURL,qrystr,divid){
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            document.getElementById(divid).innerHTML=self.xmlHttpReq.responseText;
			document.getElementById('idloc').style.display='';
        }
    }
    self.xmlHttpReq.send(qrystr);
}
function getLocality(absolute_path,val,id,lname,lclass){
//
   var qstr;
  
	if(val){
	
		qstr = 'locality_of=' + escape(val)+'&lname='+escape(lname)+'&lclass='+escape(lclass);
		
		xmlhttpPost(absolute_path+'search_locality.php',qstr,id);
		
	}
}
function getmultipleLocality(absolute_path,val,id,lname,lclass){
//
   var qstr;
  
	if(val){
	
		qstr = 'locality_of=' + escape(val)+'&lname='+escape(lname)+'&lclass='+escape(lclass)+'&multiple=1';
		
		xmlhttpPost(absolute_path+'search_locality.php',qstr,id);
		
	}
}
function select_range(val,obj){
		
		if(val=='1' || val=='2'){
			
			document.form1.price.style.display='none';
			document.form1.rent_range.style.display='';
		}
		if(val=='3' || val=='4'){
			document.form1.price.style.display='';
			document.form1.rent_range.style.display='none';
		}
	
	}
function makeurl(absolute_path)
{
	
if(document.form1.city.value==""){
alert("Please select city");
document.form1.city.focus();
return false;
}
else if(document.form1.ptype.value==""){
alert("Please select property type");
document.form1.ptype.focus();
return false;
}
else if(document.form1['for'].value==""){
alert("Please select listing type");
document.form1['for'].focus();
return false;
}
	var qry=absolute_path+'property';
	
	if(document.form1.city.value)
	{
	var citi=document.form1.city.value;
		qry+='/city-'+citi;
	}
	if(document.form1.locality.value)
	{
	var locality=document.form1.locality.value;
		qry+='/locality-'+locality;
	}
	
	if(document.form1.ptype.value)
	{
		
		var restype='';

	if(document.form1.ptype.value=='r')
	{
	restype="residence";
	}
	if(document.form1.ptype.value=='c')
	{
	restype="commercial";
	}if(document.form1.ptype.value=='re')
	{
	restype="independence_house";
	}if(document.form1.ptype.value=='res')
	{
	restype="residential_land";
	}if(document.form1.ptype.value=='co')
	{
	restype="builder_floor";
	}if(document.form1.ptype.value=='co')
	{
	restype="farm_house";
	}if(document.form1.ptype.value=='o')
	{
	restype="other";
	}
	
		qry+='/ptype-'+document.form1.ptype.value;
	}
	if(document.form1.for.value)
	{
var	listtyp='';var budgt='';
	if(document.form1.for.value=='1')
	{
		listtyp='lease_rent_available';
		if(document.form1.rent_range.value)
			budgt=document.form1.rent_range.value;
	}	if(document.form1.for.value=='2')
	{
		listtyp='lease_rent_wanted';
		if(document.form1.rent_range.value)
			budgt=document.form1.rent_range.value;
	}	if(document.form1.for.value=='3')
	{
		listtyp='sale';
		if(document.form1.price.value)
			budgt=document.form1.price.value;
	}	if(document.form1.for.value=='4')
	{
		listtyp='purchase';
		if(document.form1.price.value)
			budgt=document.form1.price.value;
	}
	
		qry+='/for-'+listtyp;
		if(budgt)
			qry+='/price-'+budgt;
		
	}
	
/*	if(document.form1.price.value)
	{
	var budgt=document.form1.price.value;
		if(document.form1.price.value=='1')
		{
		budgt='upto_5000';
		}if(document.form1.price.value=='2')
		{
		budgt='5000_to_10000';
		}if(document.form1.price.value=='3')
		{
		budgt='10000_to_20000';
		}if(document.form1.price.value=='4')
		{
		budgt='20000_to_50000';
		}if(document.form1.price.value=='5')
		{
		budgt='50000_to_1_lac';
		}if(document.form1.price.value=='6')
		{
		budgt='1_lac_to_2_lac';
		}if(document.form1.price.value=='7')
		{
		budgt='above_lac';
		}if(document.form1.price.value=='8')
		{
		budgt='upto_5_lac';
		}if(document.form1.price.value=='9')
		{
		budgt='5_to_10_lac';
		}if(document.form1.price.value=='10')
		{
		budgt='10_to20_lac';
		}if(document.form1.price.value=='11')
		{
		budgt='20_to_50_lac';
		}if(document.form1.price.value=='12')
		{
		budgt='50_lac_to_1crore';
		}if(document.form1.price.value=='13')
		{
		budgt='1_crore_to_2_crore';
		}if(document.form1.price.value=='14')
		{
		budgt='above_2_Crore';
		}
	
	
		qry+='/price-'+budgt;
	}*/
	if(document.form1.postedby.value)
	{
		qry+='/postedby-'+document.form1.postedby.value;
	}
	if(document.form1.keywrd.value)
	{
		qry+='/keywords-'+document.form1.keywrd.value;
	}
	
	document.location=qry;
	
	
}