	var _app_id = 31;
	var _append = "301";

	//var _app_id = 1;
	//var _append = "";

	function initHomePage() {
		initForm();
		//inithotproperties();
		//inithotprojects();
	}
	
	function initPostRequirementForm() {
		
		populatePropertyChildType();
		populateCity();
		populateAreaInit();
	}
	
	function initOtherPage() {
		initForm();
		
	}
	
	function initForm() {
		
		populatePropertyChildType();
		populateCity();
		populateAreaInit();
	}

	function initPostPropertyForm() {
		populatePropertyChildType();
		populateCity();
		populateAreaInit();
	}
	
	function getXMLHTTP() {
		var xmlhttp;
		if (window.XMLHttpRequest) {
  			// code for IE7+, Firefox, Chrome, Opera, Safari
		    xmlhttp=new XMLHttpRequest();
		    return xmlhttp;
  		}
		else if (window.ActiveXObject) {
  			// code for IE6, IE5
	  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  		return xmlhttp;
  		}
		else {
  			alert("Your browser does not support XMLHTTP!");
  			return;
  		}
	}
	
    //http://localhost:8080/RealtyRedefined/Request/query.htm?Type=PROP_SUB_TYPE&ParentValue=Residential&ReqType=LOV&JSPFileName=/populatepropertychildtype.jsp
    function populatePropertyChildType() {
    	var comboPropertyType = document.getElementById("PropertyType");
		var val = comboPropertyType.options[comboPropertyType.selectedIndex].text;
		
		var xmlhttp = getXMLHTTP();
		if(val == "Residential") {
			xmlhttp.onreadystatechange=function() {
					if(xmlhttp.readyState==4) {
						document.getElementById("spanPropertyChildType").innerHTML = xmlhttp.responseText;
						if(document.getElementById("NumberOfBedrooms") != null) {
							document.getElementById("NumberOfBedrooms")[0].selected = 1;
							document.getElementById("NumberOfBedrooms").disabled=false;
						}
//						if(document.getElementById("pptchtype") != null)
//							document.getElementById("PropertyChildType").selectedIndex = document.getElementById("pptchtype").value;
  					}
			}
			xmlhttp.open("GET","AJAX/populatepropertychildtype.jsp?Type=PROP_SUB_TYPE&ParentValue=" + _append + "103&ReqType=LOV&APP_ID=" + _app_id,true);
			xmlhttp.send(null);
		}
		else {
			xmlhttp.onreadystatechange=function(){
					if(xmlhttp.readyState==4) {
						document.getElementById("spanPropertyChildType").innerHTML = xmlhttp.responseText;
						if(document.getElementById("NumberOfBedrooms") != null) {
							document.getElementById("NumberOfBedrooms")[0].selected = 1;
							document.getElementById("NumberOfBedrooms").disabled=true;
						}
//						if(document.getElementById("pptchtype") != null)
//							document.getElementById("PropertyChildType").selectedIndex = document.getElementById("pptchtype").value;
  					}
				}
				xmlhttp.open("GET","AJAX/populatepropertychildtype.jsp?Type=PROP_SUB_TYPE&ParentValue=" + _append + "104&ReqType=LOV&APP_ID=" + _app_id,true);
				xmlhttp.send(null);
		}
    }
    
    function populateCity(){
    	var xmlhttp = getXMLHTTP();
    	xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4){
				document.getElementById("spanCity").innerHTML = xmlhttp.responseText;
//				if(document.getElementById("pptchtype") != null)
//					document.getElementById("CityName").selectedIndex = document.getElementById("ctnm").value;		
  			}
		}
		xmlhttp.open("GET","AJAX/populatecity.jsp?State=Maharashtra&ReqType=CSCAL&APP_ID=" + _app_id,true);
		xmlhttp.send(null);
    }
    
    function populateAreaInit(){
    	var xmlhttp = getXMLHTTP();
    	var comboCity = document.getElementById("CityName");
		var city = "Mumbai";
    	xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4){
				document.getElementById("spanArea").innerHTML = xmlhttp.responseText;
//				if(document.getElementById("arnm") != null)
//					document.getElementById("AreaName").selectedIndex = document.getElementById("arnm").value;		
  			}
		}
		xmlhttp.open("GET","AJAX/populatearea.jsp?City="+ city +"&ReqType=CSCAL&APP_ID=" + _app_id,true);
		xmlhttp.send(null);
    }
    
    function populateArea(){
    	var xmlhttp = getXMLHTTP();
    	var comboCity = document.getElementById("CityName");
		var city = comboCity.options[comboCity.selectedIndex].text;
    	xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4){
				document.getElementById("spanArea").innerHTML = xmlhttp.responseText;
//				if(document.getElementById("arnm") != null)
//  					document.getElementById("AreaName").selectedIndex = document.getElementById("arnm").value;		
  			}
		}
		xmlhttp.open("GET","AJAX/populatearea.jsp?City="+ city +"&ReqType=CSCAL&APP_ID=" + _app_id,true);
		xmlhttp.send(null);
    }
    
    function populatePropertyChildTypeInit(kkk) {
    	var comboPropertyType = document.getElementById("PropertyType");
		var val = comboPropertyType.options[comboPropertyType.selectedIndex].text;
		
		var xmlhttp = getXMLHTTP();
		if(val == "Residential") {
			xmlhttp.onreadystatechange=function() {
					if(xmlhttp.readyState==4) {
						document.getElementById("spanPropertyChildType").innerHTML = xmlhttp.responseText;
						for (var i=0; i<document.getElementById("PropertyChildType").length; i++)
		  				{
		  					if(document.getElementById("PropertyChildType").options[i].text == kkk)
		  					{
		  						document.getElementById("PropertyChildType").selectedIndex = i;
		  						break;
		  					}
		  				}
  					}
			}
			xmlhttp.open("GET","AJAX/populatepropertychildtype.jsp?Type=PROP_SUB_TYPE&ParentValue=" + _append + "103&ReqType=LOV&APP_ID=" + _app_id, true);
			xmlhttp.send(null);
		}
		else {
			xmlhttp.onreadystatechange=function()
			{
					if(xmlhttp.readyState==4) 
					{
						document.getElementById("spanPropertyChildType").innerHTML = xmlhttp.responseText;
						for (var i=0; i<document.getElementById("PropertyChildType").length; i++)
		  				{
		  					if(document.getElementById("PropertyChildType").options[i].text == kkk)
		  					{
		  						document.getElementById("PropertyChildType").selectedIndex = i;
		  						break;
		  					}
		  				}
  					}
				}
				xmlhttp.open("GET","AJAX/populatepropertychildtype.jsp?Type=PROP_SUB_TYPE&ParentValue=" + _append + "104&ReqType=LOV&APP_ID=" + _app_id, true);
				xmlhttp.send(null);
		}
    }
    
    function populateCityInit(kkk){
    	var xmlhttp = getXMLHTTP();
    	xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4){
				document.getElementById("spanCity").innerHTML = xmlhttp.responseText;
				for (var i=0; i<document.getElementById("CityName").length; i++)
  				{
  					if(document.getElementById("CityName").options[i].text == kkk)
  					{
  						document.getElementById("CityName").selectedIndex = i;
  						break;
  					}
  				}		
  			}
		}
		xmlhttp.open("GET","AJAX/populatecity.jsp?State=Maharashtra&ReqType=CSCAL&APP_ID=" + _app_id, true);
		xmlhttp.send(null);
    }
  				
  	function populateAreaInitPrev(area, city){
    	var xmlhttp = getXMLHTTP();
    	var comboCity = document.getElementById("CityName");
    	xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4){
				document.getElementById("spanArea").innerHTML = xmlhttp.responseText;
				for (var i=0; i<document.getElementById("AreaName").length; i++)
				{
					if(document.getElementById("AreaName").options[i].text == area)
					{
						document.getElementById("AreaName").selectedIndex = i;
						break;
					}
				}	
  			}
		}
		xmlhttp.open("GET","AJAX/populatearea.jsp?City="+ city +"&ReqType=CSCAL&APP_ID=" + _app_id, true);
		xmlhttp.send(null);
    }
