	//************* LOAD PROVINCE  ****************************//
	var custWidth = 0;
	var otherId = '';
	function changeCountry(value, othId){
		var AJ = new Ajax();

		if (othId == null)
			othId = '';

		otherId = othId;
		try{
			AJ.setUrl("../common/selCountry.php");
			AJ.setVar("selC", 1);
			AJ.setVar("cId", value);
			AJ.setMethod("POST");
			AJ.setOnLoading(provinceLoading);
			AJ.setOnComplete(provinceComplete);
			AJ.connect();
			AJ.getData();
		}catch(e){
			alert(e);
		}
	}


	function provinceLoading(){
		var spanP = document.getElementById("inputProvince" + otherId);

		if (custWidth == 0)
			custWidth = 186;

		spanP.innerHTML = "<select class='selInput' id='userProvince" + otherId + "' style='width: " + custWidth + "px'><option value='0'>Cargando...</select>";
	}

	function provinceComplete(httpRequest,AJ){
		var resp = httpRequest.responseText;
		var spanP = document.getElementById("inputProvince" + otherId);

		if (custWidth == 0)
			custWidth = 186;

		if (otherId != '')
			spanP.innerHTML = "<select class='selInput' id='userProvince" + otherId + "' style='width: " + custWidth + "px' onchange='javascript: changeProvince(this.value, " + otherId + ")'>" + resp + "</select>";
		else
			spanP.innerHTML = "<select class='selInput' id='userProvince' style='width: " + custWidth + "px' onchange='javascript: changeProvince(this.value)'>" + resp + "</select>";
		
		var selectedProvince = document.getElementById("userProvince" + otherId).value;
		changeProvince(selectedProvince, otherId);
	}


	//************* LOAD CITY ****************************//
	function changeProvince(value, othId){
		var AJ = new Ajax();
	
		if (othId == null)
			othId = '';

		otherId = othId;
		try{
			AJ.setUrl("../common/selCountry.php");
			AJ.setVar("selP", 1);
			AJ.setVar("pId", value);
			AJ.setMethod("POST");
			AJ.setOnLoading(cityLoading);
			AJ.setOnComplete(cityComplete);
			AJ.connect();
			AJ.getData();
		}catch(e){
			alert(e);
		}
	}


	function cityLoading(){
		var spanC = document.getElementById("inputCity" + otherId);

		if (custWidth == 0)
			custWidth = 186;

		spanC.innerHTML = "<select class='selInput' id='userCity" + otherId + "' style='width: " + custWidth + "px'><option value='0'>Cargando...</select>";
	}

	function cityComplete(httpRequest,AJ){
		var resp = httpRequest.responseText;
		var spanC = document.getElementById("inputCity" + otherId);

		if (custWidth == 0)
			custWidth = 186;

		spanC.innerHTML = "<select class='selInput' id='userCity" + otherId + "' style='width: " + custWidth + "px' onchange='showHideCity()'>" + resp + "</select>";

		showHideProvince();
		showHideCity();
	}



	function showHideProvince(){
		var sProvince = document.getElementById("userProvince" + otherId).value;

		if (sProvince == 0)
			$("#userOtherProvince" + otherId).css('display', 'block');
		else
			$("#userOtherProvince" + otherId).css('display', 'none');
	}

	function showHideCity(){
		var sCity = document.getElementById("userCity" + otherId).value;
		if (sCity == 0)
			$("#userOtherCity" + otherId).css('display', 'block');
		else
			$("#userOtherCity" + otherId).css('display', 'none');
	}


