function cmbCompanias (){
	
		if ((document.getElementById('celular').value.length==0)||(document.getElementById('celular1').value.length==0)){
			document.getElementById ('row-cmb_compania_cel').style.visibility = "hidden";
			document.getElementById ('row-cmb_compania_cel').style.display    = "none";
		}
		else {
			document.getElementById ('row-cmb_compania_cel').style.visibility = "visible";
			document.getElementById ('row-cmb_compania_cel').style.display    = "block";
		}
	
	}
	
	// ---------------------------------------------------------------
	// BERNI. 
	// ---------------------------------------------------------------
	function subOnChangeSelectFecha(intId)
	{
		document.getElementById ('fecha_' + intId).value = document.getElementById ('fecha_dd_' + intId).value + '-' + document.getElementById ('fecha_mm_' + intId).value + '-' + document.getElementById ('fecha_yyyy_' + intId).value;
	}  
	// ---------------------------------------------------------------
	
	// ---------------------------------------------------------------
	// BERNI. 
	// ---------------------------------------------------------------
	function subOnchangeCmbLocalidades()
	{
		var objCmbLocalidades = document.getElementById ('cmb_localidades');

		document.getElementById ('div_txt_otra_localidad').style.visibility = "hidden";
		document.getElementById ('div_txt_otra_localidad').style.display    = "none";
		
		if(document.getElementById ('cmb_localidades').length > 0)
		{
			if(objCmbLocalidades.selectedIndex + 1 == objCmbLocalidades.length || objCmbLocalidades[objCmbLocalidades.selectedIndex].text.toLowerCase() == 'gran buenos aires')
			{
				document.getElementById ('div_txt_otra_localidad').style.visibility = "visible";
				document.getElementById ('div_txt_otra_localidad').style.display    = "block";		
			}
		}
	}
	// ---------------------------------------------------------------

	// ---------------------------------------------------------------
	// BERNI. 
	// Cuando no hay seleccionada una provincia oculto el input de la localidad.
	// ---------------------------------------------------------------
	function subOnChangeProvincia()
	{
		function subLoadCmbLocalidades(strOptions)
		{
			var arrOpciones;
			var objCmbLocalidades = document.getElementById ('cmb_localidades');

			arrOpciones = strOptions.split (',');
			
			objCmbLocalidades.length = 0;

			for(var j = 0; j <= arrOpciones.length - 1; j ++)
			{
				objCmbLocalidades.length = objCmbLocalidades.length + 1;
				objCmbLocalidades[objCmbLocalidades.length - 1].value = arrOpciones[j];
				objCmbLocalidades[objCmbLocalidades.length - 1].text  = arrOpciones[j];
			}

			objCmbLocalidades.length = objCmbLocalidades.length + 1;
			objCmbLocalidades[objCmbLocalidades.length - 1].value = "Otra";
			objCmbLocalidades[objCmbLocalidades.length - 1].text  = "Otra";

			document.getElementById ('div_cmb_localidades').style.visibility = "visible";
			document.getElementById ('div_cmb_localidades').style.display    = "block";
		}

		var objCmbProvincias = document.getElementById ('campo_PROVINCIA_1');

		document.getElementById ('div_txt_localidad').style.visibility = "hidden";
		document.getElementById ('div_txt_localidad').style.display    = "none";

		document.getElementById ('div_cmb_localidades').style.visibility = "hidden";
		document.getElementById ('div_cmb_localidades').style.display    = "none";

		if(objCmbProvincias.selectedIndex > 0)
		{
			switch(objCmbProvincias[objCmbProvincias.selectedIndex].text.toLowerCase())
			{
				// Buenos Aires.
				case("buenos aires"):
				{
					subLoadCmbLocalidades("Gran Buenos Aires,La Plata,Mar del Plata");
					break;
				}
				// Santa Fé.
				case("santa fé"):
				{
					subLoadCmbLocalidades("Santa Fe,Rosario");
					break;
				}
				// Santa Fe.
				case("santa fe"):
				{
					subLoadCmbLocalidades("Santa Fe,Rosario");
					break;
				}				
				// Córdoba.
				case("córdoba"):
				{
					subLoadCmbLocalidades("Córdoba Capital");
					break;
				}
				// Río Negro.
				case("río negro"):
				{
					subLoadCmbLocalidades("Viedma,Bariloche");
					break;
				}
				// Mendoza.
				case("mendoza"):
				{
					subLoadCmbLocalidades("Ciudad de Mendoza");
					break;
				}
				// San Juan.
				case("san juan"):
				{
					subLoadCmbLocalidades("Ciudad de San Juan");
					break;
				}
				// Tucumán.
				case("tucumán"):
				{
					subLoadCmbLocalidades("San Miguel de Tucumán");
					break;
				}
				// Santiago del Estero.
				case("santiago del estero"):
				{
					subLoadCmbLocalidades("Ciudad de Santiago del Estero");
					break;
				}
				// Chaco.
				case("chaco"):
				{
					subLoadCmbLocalidades("Resistencia");
					break;
				}
				// Corrientes.
				case("corrientes"):
				{
					subLoadCmbLocalidades("Ciudad de Corrientes");
					break;
				}
				// Misiones.
				case("misiones"):
				{
					subLoadCmbLocalidades("Posadas");
					break;
				}
				//Ciudad Autonoma de Buenos aires
				case("ciudad autónoma de buenos aires"):
				{
					document.getElementById ('div_txt_localidad').style.visibility = "visible";
					document.getElementById ('div_txt_localidad').style.display    = "block";
					break;
				}
				default:
				{
					document.getElementById ('div_txt_localidad').style.visibility = "hidden";
					document.getElementById ('div_txt_localidad').style.display    = "none";					
				}
			}
		}

		subOnchangeCmbLocalidades();
	}
	// ---------------------------------------------------------------

	function showSelectProvincia(id_provincia,lista_paises) {
		var aPaises = lista_paises.split(",");
		var iCant 	= aPaises.length - 1;

		while(iCant >= 0){
			oProvincias = document.getElementById('div_PROVINCIA_' +  aPaises[iCant] + '');

			// Lo casteo a entero
			idActual 	= parseInt(aPaises[iCant],10);
			id_provincia = parseInt(id_provincia,10);
		
			if(idActual == id_provincia){

				oProvincias.style.visibility = 'visible';	
				oProvincias.style.display	 = 'block';

				oCampoProvincia = document.getElementById('campo_PROVINCIA_' +  aPaises[iCant] + '');
				oCampoProvincia.selectedIndex = 0;
			} else {
				oProvincias.style.visibility = 'hidden';
				oProvincias.style.display	 = 'none';

				oCampoProvincia = document.getElementById('campo_PROVINCIA_' +  aPaises[iCant] + '');
				oCampoProvincia.selectedIndex = 0;			
			}

			iCant--;
		}
	}

	function showSelectLocalidad(id_provincia){ 
		var oDivs=document.getElementsByTagName("div");

		id_provincia = parseInt(id_provincia,10);

		for(var i=0;i<oDivs.length;i++){ 
			sSubLocalidad = oDivs[i].id.substring(0,13);

			if(sSubLocalidad == 'div_LOCALIDAD'){
				iIdProvincia = parseInt(oDivs[i].id.substring(14),10);

				if(iIdProvincia == id_provincia){
					oDivs[i].style.visibility = 'visible';	
					oDivs[i].style.display = 'block';					

					oCampoLocalidad = document.getElementById('campo_LOCALIDAD_' +  iIdProvincia + '');
					oCampoLocalidad.selectedIndex = 0;			
				} else {
					oDivs[i].style.visibility = 'hidden';
					oDivs[i].style.display = 'none';						

					oCampoLocalidad = document.getElementById('campo_LOCALIDAD_' +  iIdProvincia + '');
					oCampoLocalidad.selectedIndex = 0;
				}
			}

		}
	}

	function seleccionarArgentina(){ 
		oPais = document.getElementById('campo_PAIS');

		iCant = oPais.length;
		for(i = 0;i < iCant; i++){
			if(oPais.options[i].text == 'Argentina'){
				oPais.options.selectedIndex = i;

				oProvincias = document.getElementById('div_PROVINCIA_1');	
				oProvincias.style.visibility = 'visible';	
				oProvincias.style.display	 = 'block';

				oCampoProvincia = document.getElementById('campo_PROVINCIA_1');

				// ---------------------------------------------------------------
				// BERNI. 
				// Selecciono por default la ciudad autonoma de Bs As (id = 3).
				// ---------------------------------------------------------------
				for(var j = 0; j <= oCampoProvincia.length - 1; j ++)
				{
					if(oCampoProvincia[j].value == "3")
					{
						oCampoProvincia.selectedIndex = j;
						break
					}
				}
				subOnChangeProvincia();
				// ---------------------------------------------------------------
			}
		}
	}