<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->


// creamos una instancia de CRequest para la peticion AJAX

var hndRequestCities=new CRequest();


// Se llama cuando se selecciona un pais.
// Si el pais es Espaņa (indice=73) se desbloquea el combo de las provincias

	
function select_Pais()
{
var indice = document.form1.country.value; 
	if (indice==73)
	{
		document.form1.province.disabled=false;
		document.form1.cities.disabled=true;
    }
	else 
	{
	   document.form1.province.disabled=true;
       document.form1.cities.disabled=false;
       var hndCombo=document.getElementById('cities');
	   hndCombo.options.length = 0;
	   hndCombo.options[0]=new Option(document.getElementById("litLocalidad").value,0);

    }
}


// hacemos la peticion AJAX para recoger la lista de paises,provincias o pueblos

function CargaCombo(idCombo,idSelected,country)
{

    if(document.getElementById(idCombo.id).options.length<3)
	{
		var strAccion='get_data';
		var strNomTabla='';
		var strData = "{'ac':'" + strAccion + "','tabla':''";
		strData+=",'country':'"+country+"','id_selected':'"+idSelected+"','id_combo':'"+idCombo.id+"'}"; 
		hndRequestCities.Enviar("response.php",strData,FillCombo,"POST");
	}
}



function EmptyCities(id)
{
	
	var hndCombo=document.getElementById(id);
	hndCombo.options.length = 0;
	hndCombo.options[0]=new Option('- Localidades -',0);
	if (id=='f_city')
	{
		document.form1.f_city.disabled=false;
	}
	else
	{
		
		document.form1.cities.disabled=false;
	}
	
}

function FillCombo(strMensaje)
{
	arrDatos=new Array();
	arrDatos=eval(strMensaje);
	idCombo=arrDatos[2];
	idSelected=arrDatos[1];
	if (idCombo=='f_country' || idCombo=='country')
	{
		$strLiteral=document.getElementById("litPais").value;
	}
	else if (idCombo=='f_province' || idCombo=='province')
	{
		$strLiteral=document.getElementById("litProvincia").value;
	}
	else if (idCombo=='f_city'|| idCombo=='cities')
	{
		$strLiteral=document.getElementById("litLocalidad").value;
	}
	else
	{
		
	}
	var hndCombo=document.getElementById(idCombo);
	hndCombo.options.length = 0;
	hndCombo.options[0]=new Option($strLiteral,0);
	if(arrDatos[0])
	{
		iNElements=arrDatos[0].length;
		hndCombo.disabled=true;
		for (var i=0;i<iNElements-1;i++)
		{
			hndCombo.options[i+1]=new Option(arrDatos[0][i]['name'],arrDatos[0][i]['id']);
			if (arrDatos[0][i]['id'] == idSelected) {
				hndCombo.options[i+1]=new Option(arrDatos[0][i]['name'],arrDatos[0][i]['id'],"0");
				hndCombo.selectedIndex = i+1;
				hndCombo.options[i+1].selected = true;
			}
			else
			{
				hndCombo.options[i+1]=new Option(arrDatos[0][i]['name'],arrDatos[0][i]['id']);
			}
		}
		hndCombo.disabled=false;
			
	}
	hndCombo.name=idCombo; 

}

