     var ie=false;
	 //var ErrorBox="showError";
     var ConfirmBox="";
     var ControlToRefresh="";
     var TypeToRefresh="";
	 var key="";	
	 var message="Sending data... <img src=\"../images/indicator.gif\" />";
	 var PostPathJS="";
     var PostPath="";
	 
	 if (document.all) { ie = true; }
	 
	 function getObj(id) {
		if (ie) { return document.all[id]; } 
		else {	return document.getElementById(id);	}
	 }

         function SendRequest(data,showIn,RefreshControl,type) 
      { 
           if(ConfirmBox=="")
          {
            ConfirmBox=showIn;
            ControlToRefresh = RefreshControl;
            TypeToRefresh=type;
            message="Sending request... <img src='../images/indicator.gif' />";
            http.open("POST",PostPath,true);
			http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			http.onreadystatechange = handleHttpResponse;
			http.send(data);
            getObj(showIn).innerHTML=message;

          }
            else alert("One request already in queue. Please wait for a moment");
      }
	
	function handleHttpResponse() {
		
	
		if (http.readyState == 4) {
			
			       if(http.responseText.length<4) {
					   
			            
				
	           		} else {
				
		                	    if(http.responseText.indexOf("success:")!=-1)
                             {
 								var success=http.responseText.replace("success:","");		
								getObj(ConfirmBox).innerHTML=success;
								if(ControlToRefresh=="" && key!="") { getObj(ConfirmBox).value=key; } 
                                 ConfirmBox="";

                                 if(ControlToRefresh!="")
                                {
 										var data="refresh="+TypeToRefresh;
										ConfirmBox=ControlToRefresh;
										ControlToRefresh="";	
										message="Refreshing Property types... <img src='../images/indicator.gif' />";
 			                            http.open("POST",PostPathJS,true);
 			                            http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
 			                            http.onreadystatechange = handleHttpResponse;
										http.send(data);		
													
                                }
                             }
                               else if(http.responseText.indexOf("Error:")!=-1)
                                {
                                    var err=http.responseText.replace("Error:","");		
								    getObj(ConfirmBox).innerHTML="<span class='error'>"+err+"<span>";
									ConfirmBox="";
									ControlToRefresh="";	
                                } 

				            // if( msgBox!="showInfo") {getObj('showInfo').innerHTML=""; }
				   	       }
				  
				 // if(submission && http.responseText.indexOf("Error:")==-1 ) {refresh();}
			} //End of readystate
	}

    function RefreshControl(control,data)
   {
									    
										ControlToRefresh=control;
										message="Refreshing data... <img src='images/indicator.gif' />";
 			                            http.open("POST",PostPathJS,true);
 			                            http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
 			                            http.onreadystatechange = handleHttpResponse_Refresh;
										http.send(data);
   }
	
	function handleHttpResponse_Refresh() {
		
			
		if (http.readyState == 4) {
			
          
                                  if(http.responseText.indexOf("success:")!=-1)
                             {
 								      var success=http.responseText.replace("success:","");	
 
                                        if(ControlToRefresh=="suburb")
                                      {
  												
                                         success=success.split("||");
                                         getObj(ControlToRefresh).innerHTML =success[0];
                                         getObj("property_category").innerHTML=success[1];
                                      }
                                         else
                                      {
								         getObj(ControlToRefresh).innerHTML =success;		
                                      }
                                         if(ControlToRefresh=="Suburb") { updateValues(); }
                               
                             }
                               else {
                                       //alert(http.responseText);
                                    }
		    
				  
		} //End of readystate
	}
	
   function handleHttpResponse_Request(){

      if (http.readyState == 4) {
			
          
                                  if(http.responseText.indexOf("success:")!=-1)
                             {
                                     
 								      var success=http.responseText.replace("success:","");	
 										getObj(ControlToRefresh).innerHTML =success;
									  var ServerError=getObj("ServerError");
										 if(ServerError!=null) {	ServerError.innerHTML ="";	}
                                         
                             }
                                         else if(http.responseText.indexOf("remove:")!=-1)
                                      {
  										var remove=http.responseText.replace("remove:","");
										var tempControl=getObj(ControlToRefresh);
                                         if(ie) { getObj(remove).style.display="none"; } else {	getObj(remove).innerHTML=""; }
                                      } 
 											else
                                      {
								         var ServerError=getObj("ServerError");
										 if(ServerError!=null) {	ServerError.innerHTML =success;	}	
                                      }
                                         
                             
		} //End of readystate
   }
	


	function getHTTPObject() {
		var xmlhttp;
		/*@cc_on
		@if (@_jscript_version >= 5)
			try {
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (E) {
					xmlhttp = false;
				}
			}
		@else
		xmlhttp = false;
		@end @*/
		if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
			try {
				xmlhttp = new XMLHttpRequest();
			} catch (e) {
				xmlhttp = false;
			}
		}
		return xmlhttp;
	}
	var http = getHTTPObject(); // We create the HTTP Object