function showCities(n)
{
	e = document.forms[n].state.selectedIndex;
	document.forms[n].city.selectedIndex = -1;
	document.forms[n].city.options.length = 1;
	document.forms[n].district.selectedIndex = 0;
	document.forms[n].district.options.length = 1;
	
	if (e < 0)
		return false;

	a = cities[e];
	if (a.length <= 0)
		return false;

	document.forms[n].city.options.length = a.length+1;
	for (i = 0; i < a.length; i++)
		document.forms[n].city.options[i+1].text = a[i];
}

function showDistricts(n)
{
	e = document.forms[n].state.selectedIndex;
	c = document.forms[n].city.selectedIndex;
	if (e < 0 || c < 0)
		return false;

	d = districts[e][c-1];
	if (d.length <= 0)
		return false;

	document.forms[n].district.options.length = d.length+1;
	for (i = 0; i < d.length; i++)
		document.forms[n].district.options[i+1].text = d[i];
}

function go(n)
{
	e = document.forms[n].state.selectedIndex;
	c = document.forms[n].city.selectedIndex;
	d = document.forms[n].district.selectedIndex;

	/*if (e < 0 || c <= 0 || d < 0)
	{
		alert ('Debe elegir al menos el estado y la ciudad para realizar la búsqueda');
		return false;
	}*/

	document.location = "index.php?type=locate&file=dealer_results.tp&estado=" + document.forms[n].state.options[e].text + "&ciudad=" + document.forms[n].city.options[c].text + "&municipio=" + document.forms[n].district.options[d].text;
}

function go2(n)
{
	document.location = "index.php?type=locate&file=consultant_results.tp&estado=" + document.forms[n].state.options[document.forms[n].state.selectedIndex].text;
}
