// JavaScript Document
//============================================================
// scripts de los formularios (Visual)
//============================================================
	// no incluye validaciones
		
		var nsc6=document.getElementById && !document.all
		var previous=''
		var eventobj
		
		//Regular expression to highlight only form elements
		var intended=/INPUT|TEXTAREA|SELECT|OPTION/
		
		//Function to check whether element clicked is form element
		function checkel(which){
		if (which.style && intended.test(which.tagName)){
		if (nsc6 && eventobj.nodeType==3)
		eventobj=eventobj.parentNode.parentNode
		return true
		}
		else
		return false
		}
		


//---------------------------------------------
// funcion para departamentos y ciudades
//---------------------------------------------

function show_pais_formulario(nombre, valorc, dimension, semilla){
	
	
	 // alert(nombre + "-"+  valorc + "-"+  dimension + '-'+semilla);
	 if(dimension == 'p'){
		document.getElementById('d_' + nombre + semilla).innerHTML = '<img src="images/loadingAnimation.gif" height="10" align="absmiddle" /> Cargando ...';
 		document.getElementById('c_' + nombre + semilla).innerHTML = '<img src="images/loadingAnimation.gif" height="10" align="absmiddle" /> Cargando ...';
		 
	 }else if(dimension == 'd'){
		 var pasi_value = document.getElementById('p' + nombre).value;
 		document.getElementById('c_' + nombre + semilla).innerHTML = '<img src="images/loadingAnimation.gif" height="10" align="absmiddle" /> Cargando ...';

	 }
	 
	document.getElementById('iframe_cmnk').src = 'index.php?sub_cat=campos_pais_dep_ciudad&nombre=' + nombre + '&dimencion='+ dimension + '&valor='+ valorc + '&pais=' + pasi_value + '&semilla=' + semilla;
	
}


//---------------------------------------------
// funcion para mostrar y ocultar otro
//---------------------------------------------

function campo_otro_opcion_check(idc, valorc){
	
	//	alert(idc + "-"+  valorc);

	// VALIDAMOS SI EL VALOR ES OTRO
	if(valorc == 'Otro'){
 		document.getElementById('otro_' + idc).style.height = "";
 		document.getElementById('otro_' + idc).style.width = "";
 		document.getElementById('otro_' + idc).style.overflow = "";
 		document.getElementById('otro_' + idc).style.display = "table-cell";
	}else{
 		document.getElementById('otro_' + idc).style.height = "1px";
 		document.getElementById('otro_' + idc).style.width = "1px";
 		document.getElementById('otro_' + idc).style.overflow = "hidden";
 		document.getElementById('otro_' + idc).style.display = "none";
	}
	
}


		
//---------------------------------------------
// funcion para mostrar y ocultar otro
//---------------------------------------------

function campo_otro_opcion_check_box(form, idc, valorc){

	// alert(form + "-" + idc + "-" + valorc);

	
	var check_seleccion = false;
	var total = eval("document." + form + "." + idc + "." + "length");
	var valor_campo;
	
	for (c = 0; c < total ; c++){

		valor_campo = eval("document." + form + "." + idc + "[c].value");
		valor_campo_checked = eval("document." + form + "." + idc + "[c].checked");
		
		if(valor_campo == 'Otro' && valor_campo_checked){
			check_seleccion = true;
		}
	}
	
	//	alert(idc + "-"+  valorc);

	// VALIDAMOS SI EL VALOR ES OTRO
	if(check_seleccion){
 		document.getElementById('otro_' + idc).style.height = "";
 		document.getElementById('otro_' + idc).style.width = "";
 		document.getElementById('otro_' + idc).style.overflow = "";
 		document.getElementById('otro_' + idc).style.display = "table-cell";
	}else{
 		document.getElementById('otro_' + idc).style.height = "1px";
 		document.getElementById('otro_' + idc).style.width = "1px";
 		document.getElementById('otro_' + idc).style.overflow = "hidden";
 		document.getElementById('otro_' + idc).style.display = "none";
	}
	
}

