
 
  
function fillcities(){
 
	
	var cityArray = new Array();
	var len = null;
	
 
  
 //window.alert("Inside AJAXCITY FUNTION fillCityArray");
     var xmlHttp;
   try
      { 
        xmlHttp = new XMLHttpRequest();  }
     catch (e)
      { 
      try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
      
     catch (e)
    {   
     try
      {      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");  
      }
    catch (e)
      {   //  window.alert( "Your browser does not support AJAX!");  
          return false;   
      }  
    } 
    
    }
    
 var url="./citylist";
  //window.alert("calling citylist URL is"+url);
   xmlHttp.open("GET", url , true );
  xmlHttp.onreadystatechange= function()
    {
    if(xmlHttp.readyState==4 && xmlHttp.status == 200)
      {
       
        var cityData = eval( "(" +xmlHttp.responseText + ")" );   
	  
	    len = cityData.ResultSet.Result.length;
	   // window.alert("CITY DATA length IS:"+ len);
	     
	    for(var i=0;i<len;i++)
	    {
	 
	    cityArray[i]=cityData.ResultSet.Result[i].City;
	     
        	            
	    }
	    
	      }
    }
  
 
 
	
 
     // Instantiate first JS Array DataSource   
   //  window.alert("HI form step one");
     this.oACDS = new YAHOO.widget.DS_JSArray(cityArray);   
 //     window.alert("HI form step two");
     
     // Instantiate first AutoComplete   
     this.oAutoComp = new YAHOO.widget.AutoComplete('citystart','citycontainer', this.oACDS);   
     this.oAutoComp.prehighlightClassName = "yui-ac-prehighlight";   
     this.oAutoComp.typeAhead = true;   
     this.oAutoComp.useShadow = true;   
     this.oAutoComp.minQueryLength = 0;   
   this.oAutoComp.textboxFocusEvent.subscribe(function(){  
     
         var sInputValue = YAHOO.util.Dom.get('citystart').value;   
         if(sInputValue.length === 0) {   
             var oSelf = this;   
             setTimeout(function(){oSelf.sendQuery(sInputValue);},0);   
        
         }                   
     }); 
    
    
     
                                                            var displayBelowThisObject = document.getElementById('citystart'); 
                                                            var x = displayBelowThisObject.offsetLeft;
                                                            var y = displayBelowThisObject.offsetTop + displayBelowThisObject.offsetHeight ;
                                                            var z = displayBelowThisObject.offsetWidth - 4.6;
                                                            var pickerDiv = document.getElementById('citycontainer');
                                                        
                                                            pickerDiv.style.position = "absolute";
                                                            pickerDiv.style.left = x + "px";
                                                            pickerDiv.style.top = y + "px";
                                                            pickerDiv.style.width = z + "px";
                                                            displayBelowThisObject.className="text";
                                                            
                                                             xmlHttp.send(null);  
   

   }
    




 