function filllocations(sel)


{


var dealerid = get_cookie ("vdealerid");


	var locationsCode = document.productsearch.DealerLocations.options[document.productsearch.DealerLocations.selectedIndex].value;
		document.getElementById('DealerLocations').options.length = 0;	// Empty Locations select box
	
		if(locationsCode.length>0){
			var index = ajax.length;
			ajax[index] = new sack();
		
				if (dealerid !='' && dealerid !=null){

					ajax[index].requestFile = host + '/vehicles/getmakes1.asp?startloc='+dealerid	// Specifying which file to get

				}
				else
				{
					ajax[index].requestFile = host + '/vehicles/getmakes1.asp?startloc=2'	// Specifying which file to get
globalholder = 0
				}		
		
			ajax[index].onCompletion = function(){ createlocations(index) };	// Specify function that will be executed after file has been found
			ajax[index].runAJAX();		// Execute AJAX function

 
	     fillmakes(dealerid);
 

	}
}



function createlocations(index)
{
	var obj = document.getElementById('DealerLocations');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}





function addLoadEvent(func) {   
  var oldonload = window.onload;   
   if (typeof window.onload != 'function') {   
     window.onload = func;   
   } else {   
     window.onload = function() {   
       if (oldonload) {   
         oldonload();   
      }          func();   
     }   
   }   
 }   

var globalholder = 1;
var url =""+window.location;
var urlparts = url.split('/');
var host = urlparts[0] + '//' + urlparts[2];
 addLoadEvent(filllocations); 
