function openNewWin(myUrl, w, h)
{
  var szFeatures;
  var x, y;
  x = window.screenX + (window.outerWidth-w)/2;
  y = window.screenY + (window.outerHeight-h)/2;
  if( x < 0 ) x = 0;
  if( y < 0 ) y = 0;
  szFeatures = 'width='+w+',height='+h+',screenx='+x+',screeny='+y+'status=no,help=no,resizable=no,scrollbars=yes';
  //alert(szFeatures);
  window.open(myUrl, "CarListing", szFeatures);
}

function MM_openBrWindow(theURL,winName,features) 
{ 
  window.open(theURL,winName,features);
}
				
function getModels()
{
	var MakeID = $F('makes');
	var url = 'makes.php';
	var pars = 'MakeID=' + MakeID;

	var myAjax = new Ajax.Request( url, { method: 'get', parameters: pars, onComplete: showResponse });
}

function showResponse(originalRequest)
{
	//xml object
	optionsObject = originalRequest.responseXML.documentElement;
	
	//number of children
	numNodes = optionsObject.childNodes.length;

	//options 
	models = $("models");
	
	//empty options select box
	models.options.length = 0;
	
	if(numNodes == 0)
	{
		models.options[0] = new Option('Not applicable',0);
	}
	else
	{
		models.options[0] = new Option('select',0);
	}
	
	for(i=0; i < numNodes; i++)
	{
		var id, description;
		id = optionsObject.childNodes[i].getAttribute("id");
		description = optionsObject.childNodes[i].getAttribute("name");
		//id = optionsObject.childNodes[i].getElementsByTagName("id")[0].firstChild.nodeValue;
		//description = optionsObject.childNodes[i].getElementsByTagName("name")[0].firstChild.nodeValue;
		models.options[i+1] = new Option(description,id);
	}
}
