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{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
    }
	
	function getState(countryId) {		
		
		var strURL="findState.php?country="+countryId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('statediv').innerHTML=req.responseText;						
					} 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="findCity_home.php?country="+countryId+"&state="+stateId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('citydiv').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}
				
	}
	
	function getStatecom(countryId) {		
		
		var strURL="findState_com.php?country="+countryId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('statedivcom').innerHTML=req.responseText;
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
	function getCitycom(countryId,stateId) {		
		var strURL="findCity_home.php?country="+countryId+"&state="+stateId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('citydivcom').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}
				
	}
function init(){
	var stretchers = document.getElementsByClassName('box');
	var toggles = document.getElementsByClassName('tab');
	var myAccordion = new fx.Accordion(
		toggles, stretchers, {opacity: false, height: true, duration: 600}
	);
	//hash functions
	var found = false;
	toggles.each(function(h3, i){
		var div = Element.find(h3, 'nextSibling');
			if (window.location.href.indexOf(h3.title) > 0) {
				myAccordion.showThisHideOpen(div);
				found = true;
			}
		});
		if (!found) myAccordion.showThisHideOpen(stretchers[0]);
}

function minmaxcom() {
		imincom = document.getElementById("mincom").selectedIndex;
		imaxcom = document.getElementById("maxcom").selectedIndex;
		vmincom = document.getElementById("mincom").options[imincom].value;
		vmaxcom = document.getElementById("maxcom").options[imaxcom].value;
		if(vmincom>=vmaxcom) document.getElementById("maxcom").selectedIndex = imincom;
	}
	function dddcom(radio) {

		buycom = new Array("","Min Price","1000000","10 Lacs","1500000","15 Lacs","2000000","20 Lacs","3000000","30 Lacs","4000000","40 Lacs","5000000","50 Lacs","6000000","60 Lacs","7500000","75 Lacs","10000000","1 Crore","15000000","1.5 Crore","20000000","2 Crore","30000000","3 Crore","50000000","5 Crore","100000000","10 Crore","200000000","20 Crore");
		rentcom = new Array("","Min Price","5000","5000","10000","10000","15000","15000","20000","20000","25000","25000","40000","40000","70000","70000","100000","1 Lac","150000","1.5 Lacs","200000","2 Lacs","500000","5 Lacs","1000000","10 Lacs");

		odd = new Array();
		odd[0] = buycom;
		odd[1] = rentcom;

		minicom = document.getElementById("mincom");
		maxicom = document.getElementById("maxcom");

		for(i=minicom.options.length-1;i>=0;i--) {
			minicom.remove(i);
			maxicom.remove(i);
		}

		for(i=0;i<odd[radio].length-2;i+=2) {
			o = document.createElement("OPTION");
			o.text = odd[radio+0][i+1];
			o.value = odd[radio+0][i];
			minicom.options.add(o);
			o = document.createElement("OPTION");
			o.text = odd[radio][i+3];
			o.value = odd[radio][i+2];
			maxicom.options.add(o);
		}
	}
	
	function minmax() {
		imin = document.getElementById("min").selectedIndex;
		imax = document.getElementById("max").selectedIndex;
		vmin = document.getElementById("min").options[imin].value;
		vmax = document.getElementById("max").options[imax].value;
		if(vmin>=vmax) document.getElementById("max").selectedIndex = imin;
	}
	function ddd(radio) {

		buy = new Array("","Min Price","1000000","10 Lacs","1500000","15 Lacs","2000000","20 Lacs","3000000","30 Lacs","4000000","40 Lacs","5000000","50 Lacs","6000000","60 Lacs","7500000","75 Lacs","10000000","1 Crore","15000000","1.5 Crore","20000000","2 Crore","30000000","3 Crore","50000000","5 Crore","100000000","10 Crore","200000000","20 Crore");
		rent = new Array("","Min Price","5000","5000","10000","10000","15000","15000","20000","20000","25000","25000","40000","40000","70000","70000","100000","1 Lac","150000","1.5 Lacs","200000","2 Lacs","500000","5 Lacs","999999999","10 Lacs +");

		odd = new Array();
		odd[0] = buy;
		odd[1] = rent;

		mini = document.getElementById("min");
		maxi = document.getElementById("max");

		for(i=mini.options.length-1;i>=0;i--) {
			mini.remove(i);
			maxi.remove(i);
		}

		for(i=0;i<odd[radio].length-2;i+=2) {
			o = document.createElement("OPTION");
			o.text = odd[radio+0][i+1];
			o.value = odd[radio+0][i];
			mini.options.add(o);
			o = document.createElement("OPTION");
			o.text = odd[radio][i+3];
			o.value = odd[radio][i+2];
			maxi.options.add(o);
		}
	}
	
	
