<!--
// Written by Dexter Zafra at www.ex-designz.net
//Handle Check Username Availability Using Ajax
var timerId = 0;

 var http = createRequestObject1();
 function createRequestObject1() 
     {
           var xmlhttp;
	 try 
                 { 
                    xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
                 }
	  catch(e) 
                 {
	    try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	    catch(f) { xmlhttp=null; }
	    }
	        if(!xmlhttp&&typeof XMLHttpRequest!="undefined") 
                        {
	  	   xmlhttp=new XMLHttpRequest();
	           }
		   return  xmlhttp;
 }

function sndRequest(id) 
{
	if (timerId != 0)
		return;
		
	timerId = window.setTimeout("processRequest ('" + id + "')", 600);
}

function processRequest(id) 
  {
	clearTimeout(timerId);
	timerId = 0;

	var txt = document.getElementById (id);
	if (!txt)
	  return;

	searchword = txt.value;
		try
		  {
			if (document.getElementById('servicediv').style.display == "block")
			  {
				http.open('GET', ajaxUrl + 'leftnav_Services.asp?searchword='+escape(searchword));
			  }
			  else
			  {
				http.open('GET', ajaxUrl + 'leftnav_Locations.asp?searchword='+searchword + '&r=' + Math.floor(Math.random()*10001));
			  }
			   http.onreadystatechange = handleResponseTextnew;
			   http.send(null);
			}
		catch(e){}
	    finally{}
 }

function handleResponseTextnew()
  {
     try
         {
             if((http.readyState == 4)&& (http.status == 200))
                {
				  var response = http.responseText;
				 if (document.getElementById('servicediv').style.display == "block")
				  {
					 document.getElementById('servicediv').innerHTML = response; //;
				  }
				  else
				  {
					 document.getElementById('locationdiv').innerHTML = response; 
				  }
            
				}
        }
	catch(e){}
	finally{}
}