
var ajaxdropdown = new Array();

function dropdownsModelo(sel)
{
	var marcaEscolhida = sel.options[sel.selectedIndex].value;
	document.getElementById('modeloSelect').options.length = 0;
	if(marcaEscolhida.length>0){
		var index = ajaxdropdown.length;
		ajaxdropdown[index] = new sack();
		
		ajaxdropdown[index].requestFile = '/dropdowns/modelos'+marcaEscolhida+'.html';
		ajaxdropdown[index].onCompletion = function(){ dropdownsModelos(index) };
		ajaxdropdown[index].runAJAX();
	}
}

function dropdownsModelos(index)
{
	var obj = document.getElementById('modeloSelect');
	obj.options[obj.options.length] = new Option('Modelo','0');
	eval(ajaxdropdown[index].response);
}

function dropdownsModeloN(sel)
{
	var marcaEscolhidaN = sel.options[sel.selectedIndex].value;
	document.getElementById('modeloSelectN').options.length = 0;
	if(marcaEscolhidaN.length>0){
		var index = ajaxdropdown.length;
		ajaxdropdown[index] = new sack();
		
		ajaxdropdown[index].requestFile = '/dropdowns/modelosN'+marcaEscolhidaN+'.html';
		ajaxdropdown[index].onCompletion = function(){ dropdownsModelosN(index) };
		ajaxdropdown[index].runAJAX();
	}
}

function dropdownsModelosN(index)
{
	var obj = document.getElementById('modeloSelectN');
	obj.options[obj.options.length] = new Option('Modelo','0');
	eval(ajaxdropdown[index].response);
}
