function Abre(page) {	OpenWin = this.open(page, "Ventana", "toolbar=no,menubar=no,location=no,status=yes,scrollbars=yes,resizable=yes,width=560px,height=480px");}function Activacapa(nombrecapa,accion,retardo) {		if (!retardo || retardo=="") {		retardo=10;		}	var idcapa = document.getElementById(nombrecapa);			if ((document.getElementById(nombrecapa).style.display == "none" && accion!="mostrar" && accion!="ocultar") || (accion == "mostrar")) {      		setTimeout(document.getElementById(nombrecapa).style.display = "",retardo);	      	if (nombrecapa=='buscador') {	      		document.getElementById(nombrecapa+'txt').innerHTML="Ocultar";	      		}	     } else if ((document.getElementById(nombrecapa).style.display !== "none" && accion!="mostrar" && accion!="ocultar") || (accion == "ocultar")) {			 				retardar=setTimeout(function() {			        idcapa.style.display = 'none' 			    },retardo);			       if (nombrecapa=='buscador') {			       	document.getElementById(nombrecapa+'txt').innerHTML="Mostrar";			       }         	 }}function Enviar() {	setTimeout(	document.formulario.submit(),2000);}function vaciacampo(control){	if(!control.texto_predeterminado){		control.texto_predeterminado=control.value;	}		if(control.value==control.texto_predeterminado){		control.value='';	}}/* * Restaurar el contenido de un control de formulario, pero sólo si no se ha modificado * Nota: el control debe tener parámetro value */function campooriginal(control){	if(control.texto_predeterminado){	}		if(control.texto_predeterminado && control.value==''){		control.value=control.texto_predeterminado;	}}function muestracapaninos(valor){	if (valor=='0') {	document.getElementById("capan1").style.display = "none";	document.getElementById("capan2").style.display = "none";	}	if (valor=='1') {	document.getElementById("capan1").style.display = "";	document.getElementById("capan2").style.display = "none";	}	if (valor=='2') {	document.getElementById("capan1").style.display = "";	document.getElementById("capan2").style.display = "";	}}// Cuando una imagen no se ha cargado, la oculta.function ErrorCargarImagen(imagen) {		var fichero=imagen.src+'#';			//imagen.src='../../imagftp/imagnodisponible.jpg';			//setTimeout(imagen.src=../../imagftp/imagnodisponible.jpg,500);					imagen.onerror='null';		imagen.src='../imag_general/1pxtr.gif'		setTimeout(imagen.src=fichero,500);}// MONTA EL OBJETO DE AJAXvar peticion = false;var  testPasado = false;  try {   peticion = new XMLHttpRequest();   } catch (trymicrosoft) {   try {   peticion = new ActiveXObject("Msxml2.XMLHTTP");  } catch (othermicrosoft) { try {  peticion = new ActiveXObject("Microsoft.XMLHTTP");  } catch (failed) { peticion = false;  }     }   }   if (!peticion)   alert("ERROR AL INICIALIZAR!");   // AJAX . Reemplazar el contenido de un DIV con una URL   function cargarDIV (url, comboAnterior, element_id) {       //Obtenemos el contenido del div       //donde se cargaran los resultados    var element =  document.getElementById(element_id);    Activacapa(element_id,'mostrar',10);           //Obtenemos el valor seleccionado del combo anterior       if (comboAnterior) {	      var valordepende = document.getElementById(comboAnterior)	       var x = escape(valordepende.value)	       //construimos la url definitiva	       //pasando como parametro el valor seleccionado	       // habría que mirara que si url lleva ya ? añada & en vez de ? para encadenar el dato valor=X del formulario	       var fragment_url = url+'?valor='+x;         }      	else      	{      		var fragment_url = url      	}       element.innerHTML = '<img src="../imag_general/loading.gif" />';       //abrimos la url       peticion.open("GET", fragment_url);       peticion.onreadystatechange = function() {           if (peticion.readyState == 4 || peticion.readyState=="complete") {			   //escribimos la respuesta			   element.innerHTML = peticion.responseText;           }       }      peticion.send(null);   }/* ENVIA FORMULARIO POR AJAX */function enviarFormularioAJAX(url, formid,element_id){             var Formulario = document.getElementById(formid);             var longitudFormulario = Formulario.elements.length;             var cadenaFormulario = ""             var sepCampos             sepCampos = ""             for (var i=0; i <= Formulario.elements.length-1;i++) {                         if (Formulario.elements[i].tagName == "SELECT") {            				var sel = Formulario.elements[i];													var numopts = Formulario.elements[i].length				//alert(numopts+"/"+i);				//alert(Formulario.elements[i].options[0].value);							for(var conta=0;conta<=numopts-1;conta++){								cadenaFormulario += sepCampos+Formulario.elements[i].name+'='+encodeURI(Formulario.elements[i].options[conta].text);							 sepCampos="&";							}									} else if ('checkbox' == Formulario.elements[i].type.toLowerCase()) {								cadenaFormulario += sepCampos+Formulario.elements[i].name+'='+Formulario.elements[i].checked;				            } else {				cadenaFormulario += sepCampos+Formulario.elements[i].name+'='+encodeURI(Formulario.elements[i].value);            }             sepCampos="&";                }		vinter=url.indexOf("?")	if (vinter==-1) {		var fragment_url = url+'?'+cadenaFormulario;	} else {		var fragment_url = url+'&'+cadenaFormulario;	} 	 var element =  document.getElementById(element_id);     element.innerHTML = '<p class=avisoAJAX><img src="../imag_general/loading.gif" /> Cargando datos...</p>';       //abrimos la url       peticion.open("POST", fragment_url,true);       peticion.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=ISO-8859-1');       peticion.onreadystatechange = function() {           if (peticion.readyState == 4) {   			//escribimos la respuesta			element.innerHTML = peticion.responseText;   			}       }           peticion.send(cadenaFormulario);}/* Funciones de búsqueda en tiempo real */var tempora = null;function lanzabusquedareal() {if (tempora) { window.clearTimeout(tempora); }	tempora = window.setTimeout("busquedareal()",350);}function busquedareal(){	cargarDIV('../AJAX/AJAXbuscador.asp', 'cadena', 'resultadosajax');}function Compartir(type){	var title = encodeURIComponent(window.document.title);	var href = encodeURIComponent(window.document.location.href);	var components = window.document.location.href.split('/');	var tags = '';	if(components[6] != '')	{		tags += components[6]+' ';	}	if(components[7] != '')	{		tags += components[7]+' ';	}	if(components[8] != '')	{		tags += components[8]+' ';	}				tags = encodeURIComponent(tags);		switch(type)	{		case 'meneame' :					url = 'http://meneame.net/submit.php?url='+href;			break;					case 'digg' :					url = 'http://digg.com/submit?phase=2&url='+href+'&title='+title;			break;					case 'delicious' :					url = 'http://del.icio.us/post?url='+href+'&title='+title;			break;					case 'technorati' :					url = 'http://www.technorati.com/search/'+tags+'?sub=postcosm';			break;					case 'yahoo' :					url = 'http://myweb2.search.yahoo.com/myresults/bookmarklet?u='+href+'&t='+title+'&ei=UTF-8';			break;							case 'fresqui' :					url = 'http://tec.fresqui.com/post?url='+href+'&title='+title;			break;			}		window.open(url);}/* POdemos lanzar varios eventos con window.onload */function addOnLoad(nuevoOnLoad) {   var prevOnload = window.onload;if (typeof window.onload != 'function') { window.onload = nuevoOnLoad;} else { window.onload = function() { prevOnload();nuevoOnLoad();}}}function zoomText(Accion,Elemento){//inicializacion de variables y parámetrosvar obj=document.getElementById(Elemento);var max = 200 //tamaño máximo del fontSizevar min = 70 //tamaño mínimo del fontSizeif (obj.style.fontSize==""){obj.style.fontSize="100%";}actual=parseInt(obj.style.fontSize); //valor actual del tamaño del textoincremento=10;// el valor del incremento o decremento en el tamaño//accion sobre el textoif( Accion=="reestablecer" ){obj.style.fontSize="100%"}if( Accion=="aumentar" && ((actual+incremento) <= max )){valor=actual+incremento;obj.style.fontSize=valor+"%"}if( Accion=="disminuir" && ((actual+incremento) >= min )){valor=actual-incremento;obj.style.fontSize=valor+"%"}}function aceptoavisosms() {if (document.getElementById('protecciondatossms').value!=true){       alert("Tienes que aceptar el aviso legal");       document.getElementById('protecciondatossms').focus();       return false;    } else {	cargarDIV ('../AJAX/AJAXenviarSMS.asp', 'movil', 'suscribe');	}}function aceptoavisoemail() {if (document.getElementById('protecciondatosmail').value!=true){       alert("Tienes que aceptar el aviso legal");       document.getElementById('protecciondatosmail').focus();       return false;    } else {	cargarDIV ('../AJAX/AJAXsuscribe.asp', 'emailsuscribe', 'suscribeemail')	}}