<!-- funciones ABRIR VENTANA -->
var winName="titulo" 
function Abrir_Ventana(theURL,w,h) { 

var windowprops ="top=0,left=0,toolbar=no,location=no,status=no, menubar=no,scrollbars=yes, resizable=no, width=" + w + ", height=" + h;

window.open(theURL,winName,windowprops); 
} 

<!-- función para Abrir una ventana nueva para mostrar el foro -->
function Abrir_Ventana_Foro(theURL,w,h) { 

var windowprops ="top=0,left=0,toolbar=yes,location=no,status=no, menubar=yes,scrollbars=yes, resizable=yes, width=" + w + ", height=" + h;

window.open(theURL,'foro',windowprops); 
} 


<!-- funciones de gestión MENU -->
function ocultamenu(elemento){
  var menu = document.getElementById(elemento);
  menu.style.display = "none";
}

function despliega(elemento){
  var menu = document.getElementById(elemento);
    if(menu.style.display == "none"){
      menu.style.display = "block";
    }
    else{
      menu.style.display = "none";
    }
}



function validar(){
	if (document.correo.nombre.value=='' || document.correo.email.value=='' || document.correo.mensaje.value=='')	alert ("Por favor, rellene los campos marcados con *");
	else 	cargar_mensaje('envia.php')				
}		



function changeImage(name,ImgName){	document.images[name].src = ImgName;	}


/* quita borde punteado de los links ---------------------------------------------------------------------------*/
function noplink() {
	lnks=document.getElementsByTagName("a").length;
	for (i=0;i<lnks;i++)
	document.getElementsByTagName("a").item(i).onfocus=new Function(" (this.blur)?this.blur():NULL;")
}


/* ajusta la altura de la capa principal al contenido ---------------------------------------------------------------------------*/
function hCapa(capa) {
	var altura=(document.getElementById(capa).offsetHeight>300)?document.getElementById(capa).offsetHeight:300; 
	parent.parent.document.getElementById('ifr_de').style.height=(altura+150)+'px';
	parent.document.getElementById('ifr_content').style.height=(altura+30)+'px';

}

/* ajusta la altura de la capa principal al contenido ---------------------------------------------------------------------------*/
function hifr(ifr) {
	var altura=(ifr.offsetHeight>525)?ifr.offsetHeight:525;
	//alert(parent.document.getElementById('ifr_admin').style.height+'  '+altura);
	parent.document.getElementById('ifr_admin').style.height=(altura+50)+'px';
}

/* abre un POP-UP  ---------------------------------------------------------------------------*/
function peich(url){ window.open (url,"", "toolbar=no, location=no, directories=no, status=0, menubar=no, scrollbars=no, resizable=no,width=700, height=374");}


/* comprueba que la fecha tenga el formato [dd-mm-aaaa]  ---------------------------------------------------------------------------*/
function fecha(f){
		re=/^[0-9][0-9]\-[0-9][0-9]\-[0-9][0-9][0-9][0-9]$/;
		return (!re.exec(f))?0:1;		
}

function showCat(n){
	var i=1;
	var estado=document.getElementById('ulcat'+n).style.display;
	while(document.getElementById('ulcat'+i)) { 
		document.getElementById('pcat'+i).className='cat';
		document.getElementById('ulcat'+i).style.display='none'; 
		document.getElementById('pcat'+i).style.color='#999'; 
		i++;
	}
	//alert(document.getElementById('pcat'+n).style.color);
	document.getElementById('pcat'+n).style.color='#f60';
	if(estado=='block'){
			document.getElementById('ulcat'+n).style.display='none'; 
			document.getElementById('pcat'+n).className='cat';
	}
	else {
		document.getElementById('ulcat'+n).style.display='block';
		document.getElementById('pcat'+n).className='cat2';
	}
	
	hifr(document.getElementById('idcat'));
}


/* Crea una cookie ---------------------------------------------------------------------------*/
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}



/* Obtiene el valor de una determinada cookie ------------------------------------------------------------------------------ */
function getCookie(name) {
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
	begin = dc.indexOf(prefix);
	if (begin != 0) return null;
	} else {
	begin += 2;
	}
	var end = document.cookie.indexOf(";", begin);
	if (end == -1) {
	end = dc.length;
	}
	return unescape(dc.substring(begin + prefix.length, end));
}

