//For type of dropdown
function getXMLHTTP() { //fuction to return the xml http object
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				req = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
    }
	
	function getState(countryId) {		
		
		var strURL="dropdownfile/findState.php?country="+countryId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
			var dis="<select name='city_auto_id' style='width:188px;' class='middlehead_txt'><option value='' selected='selected'>--- Select City ---</option></select>";
			var loc="<select name='location_auto_id' style='width:188px;' class='middlehead_txt'><option value='' selected='selected'>--- Select Location ---</option></select>";
				
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('statediv').innerHTML=req.responseText;		
						document.getElementById('citydiv').innerHTML=dis;
						document.getElementById('districtdiv').innerHTML=loc;					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
	function getCity(countryId,stateId) {
		var strURL="dropdownfile/findCity.php?country="+countryId+"&state="+stateId;
		var req = getXMLHTTP();
		if (req) {
		var loc="<select name='location_auto_id' style='width:188px;' class='middlehead_txt'><option value='' selected='selected'>--- Select Location ---</option></select>";
				
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						document.getElementById('citydiv').innerHTML=req.responseText;	
						document.getElementById('districtdiv').innerHTML=loc;					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}
				
	}
	
	function getDistrict(countryId,stateId,cityId) {
		var extraId = '1';
		var strURL="dropdownfile/finddistict.php?country="+countryId+"&state="+stateId+"&city="+cityId+"&extra="+extraId;
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('districtdiv').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}
				
	}


function cityInfo(cID){
 //alert(cID);
if(cID=="Comm")
{
 document.Main.src='images/featured_commercial.jpg';
 
 }
 else
 {
 document.Main.src='images/featured_residential.jpg'
 }
 
 var strURL="ajax.js.php?CID="+cID;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('cityIdArea').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}
				
 
 
 }


 function hidebedrooms(objid) {
if(objid=='90' || objid=='89' || objid=='86' || objid=='83' || objid=='80' || objid=='77' || objid=='76'){
document.getElementById('bedroomsdiv').style.display='none';
document.getElementById('bedroomsdiv1').style.display='none';
} else {
document.getElementById('bedroomsdiv').style.display='block';
document.getElementById('bedroomsdiv1').style.display='block';
}
}

function hidebedrooms1(objid) {
if(objid=='90' || objid=='89' || objid=='86' || objid=='83' || objid=='80' || objid=='77' || objid=='76'){
document.getElementById('bedroomsdiv1').style.display='none';
} else {
document.getElementById('bedroomsdiv1').style.display='block';
}
}




function hidebedroomsindex(objid) {
if(objid=='90' || objid=='89' || objid=='86' || objid=='83' || objid=='80' || objid=='77' || objid=='76'){
document.buyerssearch.bedrooms.disabled=true;
//document.buyerssearch.purpose[1].disabled = true;
} else {
document.buyerssearch.bedrooms.disabled=false;
//document.buyerssearch.purpose[1].disabled = false;
}
}






function hidebedroomsadmin(objid) {
if(objid=='90' || objid=='89' || objid=='86' || objid=='83' || objid=='80' || objid=='77' || objid=='76'){
document.form2.bedrooms.disabled=true;
document.form2.bathrooms.disabled=true;
document.form2.servantquarter.disabled=true;
document.form2.studyroom.disabled=true;

} else {
document.form2.bedrooms.disabled=false;
document.form2.bathrooms.disabled=false;
document.form2.servantquarter.disabled=false;
document.form2.studyroom.disabled=false;

}
}




function changeProjectCheckt(post_type){
if(post_type=='PROJ'){
document.buyerssearch.purpose[1].disabled = true;
}else{
document.buyerssearch.purpose[1].disabled = false;
}
}