	//functions.js/////////////////////////////* Listado con la siguiente estructura * *	idListado *		idListado-sub0		 *			idListado-info0 *		idListado-sub1		 *			idListado-info1 *		idListado-sub2 *			idListado-info2 * * *	idListado -> id del div raiz *	nSub -> numero del elemnto seleccionado *	classSelected -> Nombre de la clase con el estilo para el elemento seleccionado *	classUnselected -> Nombre de la clase con el estilo para el elemento deseleccionado *	urlDatos -> url con los datos a cargar dentro del div de información del elemento */function ListadoClick(idListado, nSub, classSelected, classUnselected/*, urlDatos*/){	var listado = document.getElementById(idListado);	var elemento = document.getElementById(idListado+'-sub'+nSub);	var elemento_info = document.getElementById(idListado+'-info'+nSub); 	var seleccionado = elemento.className == classSelected;	// Guardo si estaba seleccionado o no el elemento  // Oculto todos los divs de 'info' menos el del seleccionado  // y deselecciono a todos los divs de 'sub' menos al seleccionado  	var divs = listado.getElementsByTagName('div');	var cuentaSubs = 0;	for (i=0; i<divs.length; i++) {		if(divs[i].id.search(idListado+'-sub') >= 0) {	// Si es un div 'sub' le pongo como 			divs[i].className = classUnselected + (cuentaSubs % 2);			cuentaSubs++;		}else if(divs[i].id.search(idListado+'-info') >= 0){	// Si es un div 'sub'			divs[i].style.display = 'none';		}	}	if (!seleccionado) // Si el elemento estaba seleccionado	{		elemento.className = classSelected;		/*alert(urlDatos);		makerequest(urlDatos, elemento_info);*/		elemento_info.style.display = 'block';	}}// ///////////////////////////////////////////////////////////////////////////////////// ////////////////////////////// MOSTRAR/OCULTAR MENU ///////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////function CambiarVisible(idMenu, nSub){		menu = document.getElementById(idMenu);	submenu = document.getElementById(idMenu+'-sub'+nSub);  // Oculto los divs de submenú visibles del menú indicado, menos el seleccionado, q cambia de estado	divs = menu.getElementsByTagName('div');	for (i=0; i<divs.length; i++) {		if(divs[i].id.search(idMenu) >= 0) {			if (divs[i].id == submenu.id){	// Si es el seleccionado				if(divs[i].style.display == 'none' || divs[i].style.display == ''){					divs[i].style.display = 'block';				}else{					divs[i].style.display = 'none';				}			}else{				divs[i].style.display = 'none';			}		}	}}function CambiarVisibleSinOcultar(idMenu, nSub){		menu = document.getElementById(idMenu);	submenu = document.getElementById(idMenu+'-sub'+nSub);  // Oculto los divs de submenú visibles del menú indicado, menos el seleccionado, q cambia de estado	divs = menu.getElementsByTagName('div');	for (i=0; i<divs.length; i++) {		if(divs[i].id.search(idMenu) >= 0) {			if (divs[i].id == submenu.id){	// Si es el seleccionado				if(divs[i].style.display == 'none' || divs[i].style.display == ''){					divs[i].style.display = 'block';				}/*else{					divs[i].style.display = 'none';				}*/			}else{				divs[i].style.display = 'none';			}		}	}}// ///////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////// CAMBIAR IMAGEN //////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////	function CambiarImagen(esto, img){		esto.src = img;	}// ///////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////// CAMBIAR ESTILO //////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////	function CambiarEstilo(esto, clase){		esto.className = clase;	}// ///////////////////////////////////////////////////////////////////////////////////// ////////////////////////////// CREAR OBJETO xhmlhttp //////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////	//Funcion para realizar peticiones al Server	function makerequest(serverPage, objID) {		var xmlhttp = getxmlhttp();		var obj = document.getElementById(objID);		xmlhttp.open("GET", serverPage);		xmlhttp.onreadystatechange = function() {			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {				obj.innerHTML = xmlhttp.responseText;			}		}		xmlhttp.send(null);	}//xmlhttp.js//Function to create an XMLHttp Object.function getxmlhttp (){//Create a boolean variable to check for a valid Microsoft active x instance.var xmlhttp = false;//Check if we are using internet explorer.try {//If the javascript version is greater than 5.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {//If not, then use the older active x object.try {//If we are using internet explorer.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");} catch (E) {//Else we must be using a non-internet explorer browser.xmlhttp = false;}}// If not using IE, create a// JavaScript instance of the object.if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {xmlhttp = new XMLHttpRequest();}return xmlhttp;}//Function to process an XMLHttpRequest.function processajax (serverPage, obj, getOrPost, str){//Get an XMLHttpRequest object for use.xmlhttp = getxmlhttp ();if (getOrPost == "get"){xmlhttp.open("GET", serverPage);xmlhttp.onreadystatechange = function() {if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {obj.innerHTML = xmlhttp.responseText;}}xmlhttp.send(null);} else {xmlhttp.open("POST", serverPage, true);xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");xmlhttp.onreadystatechange = function() {if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {obj.innerHTML = xmlhttp.responseText;}}xmlhttp.send(str);}}//Functions to submit a form.function getformvalues (fobj, valfunc){var str = "";aok = true;var val;//Run through a list of all objects contained within the form.for(var i = 0; i < fobj.elements.length; i++){if(valfunc) {if (aok == true){val = valfunc (fobj.elements[i]);if (val == false){aok = false;}}}str += fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&";}//Then return the string values.return str;}function submitform (theform, serverPage, objID, valfunc){var file = serverPage;var str = getformvalues(theform,valfunc);//If the validation is ok.if (aok == true){obj = document.getElementById(objID);processajax (serverPage, obj, "post", str);}}function validarBuzon(element){	switch(element.name){		case 'remitente':			var regEx = /^(.)+@(.)+\.(.)+$/			if (element.value.search(regEx)!=0) {				alert('Debe indicar una dirección de correo válida')				element.focus()				return false			}			break;		case 'asunto':			if(element.value.length <= 0){				alert('Debe indicar el motivo de su consulta')				element.focus()				return false			}			break;		case 'contenido':			if(element.value.length <= 0){				alert('Debe indicar el contenido de su consulta')				element.focus()				return false			}			break;	}	return true;}
