// VARIABLES ·······················································································································

	// Fecha
	var fecha 	= new Date();
	var dia 	= new String (fecha.getDate()); if (dia.length==1) dia = "0"+dia;	
	var mes 	= new String (fecha.getMonth() + 1); if (mes.length==1) mes = "0"+mes;	
	var anio 	= new String (fecha.getFullYear());	
	var hoy 	= dia + ' / ' + mes + ' / ' + anio;


// FUNCIONES ·······················································································································

	// Functiones del Tooltip ***********************************************************************
	function muestraTooltip(texto) {//<div style="display:none; position:absolute; left:0; top:0;" id="tooltip"></div>
		document.getElementById("tooltip").style.display = "inline";
		document.getElementById("tooltip").innerHTML = texto;
	}
	
	function ocultaTooltip() {
		document.getElementById("tooltip").style.innerHTML = "";
		document.getElementById("tooltip").style.display = "none";
	}		
	// ***********************************************************************************************


	function carga_info(informacion,titulo,img_path,parar) {
		delayer = 3000;
		img_flecha = "&nbsp;<img src=\""+img_path+"/flecha_fondo_azul.gif\" align=\"absmiddle\">&nbsp;";
		
		if (titulo != "") 		{titulo = img_flecha+titulo;} 			else {titulo = "";} 
		if (informacion != "") 	{informacion = img_flecha+informacion;} else {informacion = "";} 

		if (parent.frames["head_menu"].document.getElementById("info_cabecera")) {
			parent.frames["head_menu"].document.getElementById("info_cabecera").innerHTML = titulo+informacion;
		}
	}
	

	// Funciones de Validación ***********************************************************************
	function esMail (email) {
		re = /^[a-z0-9_]{2,}([.|-][a-z0-9_]{2,})*@[a-z0-9_]{2,}([.|-][a-z0-9_]{1,})*\.[a-z0-9]{2,3}$/
		return (re.test(email))?true:false
	}		
	// ***********************************************************************************************
	
	function validaAltaUsuarioForm(formulario) {
		var ok = true;
		if (formulario.usuario.value == "") {
			ok = false;
			alert("Introduzca un nombre de usuario");
			formulario.usuario.focus();
		} else if(formulario.clave.value == "") {
			ok = false;
			alert("Introduzca una clave");
			formulario.clave.focus();
		} else if(formulario.clave2.value == "") {
			ok = false;
			alert("Repita la clave");
			formulario.clave2.focus();
		} else if(formulario.email.value == "") {
			ok = false;
			alert("Introduzca una dirección de correo");
			formulario.email.focus();
		} else {
			ok = esMail (formulario.email.value);
			if (ok == false) alert("La dirección de correo introducida no es correcta. Ejemplo: usuario@dominio.extension");
			formulario.email.select();
		}
		return ok;
		//return (ok)?true:false
	}

	// Funciones del Menu ****************************************************************************
	function show_hide (num) {
		for (i=1; i<=menu_items; i++) {
			document.getElementById("submenu_" + i).style.display = "none";		
		}	
		if (num != 0) {
			if (document.getElementById("submenu_" + num).style.display == "inline") {
				document.getElementById("submenu_" + num).style.display = "none";				
			} else {
				document.getElementById("submenu_" + num).style.display = "inline";			
			}
		}
	}
	
	function changeBgColor(menu, clase) {
		if (document.getElementById("menu_" + menu).className != "trMenuClick") {
			if (clase == 1) {
				document.getElementById("menu_" + menu).style.backgroundColor = ""; //trMenu
			} else {
				document.getElementById("menu_" + menu).style.backgroundColor = "D6E7F9"; // trMenuOver
			}			
		}
	}
	
	function marcarTr(num) {
		/*for (i=1; i<=menu_items; i++) {
			document.getElementById("menu_" + i).className = "trMenu";		
		}		
		if (document.getElementById("menu_" + num).className == "trMenuClick") {
			document.getElementById("menu_" + num).className = "trMenu";
		} else {
			document.getElementById("menu_" + num).className = "trMenuClick";
		}*/
	}
	// ************************************************************************************************
	
	
	// Funciones Varias *******************************************************************************
	function abrirVentana(page,w,h,destino){
		//var ventana = new window;
		window.open(page,destino,"width="+w+",height="+h+",left=100,top=100,scrollbars=yes,resizable=yes");
	}		


	// swapeo de imagenes	
	function swapImages(imgId, imgSrc){ 
		document.getElementById(imgId).src = imgSrc;
	}
	
	/* from feve.es */
	function MM_preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	function MM_findObj(n, d) { //v3.0
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
	}
	function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	/* end */
	
	/*
	function show_hide_all(num) {
		//alert(num);
		if (document.getElementById("open_all").title == "mostrar más información de todos los contactos") {
			display = "inline";
			document.getElementById("open_all").title = "ocultar las informaciones de todos los contactos";
		} else {
			display = "none";
			document.getElementById("open_all").title = "mostrar más información de todos los contactos";
		}
		for (i=1; i<=num; i++) {
			document.getElementById("info"+i).style.display = display;		
		}	
	}


	function cambiacursor(capa) {
		if (document.getElementById(capa).style.cursor == "hand") {
			document.getElementById(capa).style.cursor = "auto";
		} else {
			document.getElementById(capa).style.cursor = "hand"; 
		}			
	}		
	*/

/*

// 	GENERACIÓN y MOVIMIENTO del TOOLTIP  **************************************************************
	var A = document.getElementById;
	var B = document.all;
	var C = document.layers;
	var rate = 50;
	var ie5fix1 = 0;
	var ie5fix2 = 0;	
	var offsetx = 15; //x offset of trail from mouse pointer
	var offsety = 10; //y offset of trail from mouse pointer
	var rightedge = 0;
	var bottomedge = 0;


	//rightedge=!B? document.body.clientWidth-T1[1] : window.innerWidth-T1[1]-20
	//bottomedge=!B? document.body.scrollTop+document.body.clientHeight-T1[2] : window.pageYOffset+window.innerHeight-T1[2]

	createContainer("tooltip",10,10,250,50,"","");
	
	function createContainer(N,Xp,Yp,W,H,At,HT,Op,St){
		with (document){
			write((!A && !B) ? "<layer style='display:none;' id='"+N+"' left="+Xp+" top="+Yp+" width="+W+" height="+H : "<div id='"+N+"'"+" style='display:none;position:absolute;left:"+Xp+"; top:"+Yp+"; width:"+W+"; height:"+H+"; ");
			if(St){
				if (C)
					write(" style='");
				write(St+";' ")
			}
			else write((A || B)?"'":"");
			write((At)? At+">" : ">");
			write((HT) ? HT : "");
			if (!Op)
				closeContainer(N);
		}
	}
	
	function closeContainer(){
		document.write((A || B)?"</div>":"</layer>");
	}
	
	function getXpos(N){
		if (A)
			return parseInt(document.getElementById(N).style.left);
		else if (B)
			return parseInt(B[N].style.left);
		else
			return C[N].left;
	}
	
	function getYpos(N){
		if (A)
			return parseInt(document.getElementById(N).style.top);
		else if (B)
			return parseInt(B[N].style.top);
		else
			return C[N].top;
	}
	
	function moveContainer(N,DX,DY){
		c=(A)? document.getElementById(N).style : (B)? B[N].style : (C)? C[N] : "";
		if (!B){
			rightedge=window.innerWidth-20;
			bottomedge=window.pageYOffset+window.innerHeight;
		}
		c.left=Math.min(rightedge, DX+offsetx);
		c.top=Math.min(bottomedge, DY+offsety);
	}
	
	function cycle(){
		if (document.all&&window.print){//if (IE5) 
			ie5fix1=document.body.scrollLeft;
			ie5fix2=document.body.scrollTop;
		}
	}
	
	function newPos(e){
		moveContainer("tooltip",(B)?event.clientX+ie5fix1:e.pageX+2,(B)?event.clientY+ie5fix2:e.pageY+2);
	}
	
	function getedgesIE(){
		rightedge=document.body.clientWidth;
		bottomedge=document.body.scrollHeight;
	}
	
	if (B){
		window.onload=getedgesIE;
		window.onresize=getedgesIE;
	}
	
	if(document.layers) {
		document.captureEvents(Event.MOUSEMOVE);
	}
	document.onmousemove=newPos;
	setInterval("cycle()",rate);
// FIN de GENERACIÓN y MOVIEMIENTO del TOOLTIP **********************************************************
*/