/* Modificar la hoja de estilos según la resolución */
var screen_width = screen.width;
/*if(screen_width >= 1024)
{*/
	/*window.document.getElementById('css_educacion').href = window.document.getElementById('css_educacion').href.replace('0800','1024');
	window.document.getElementById('css_abstracto').href = window.document.getElementById('css_abstracto').href.replace('0800','1024');
	window.document.getElementById('css_contenido').href = window.document.getElementById('css_contenido').href.replace('0800','1024');
	window.document.getElementById('css_perfil').href = window.document.getElementById('css_perfil').href.replace('0800','1024');
	window.document.getElementById('css_delegacion').href = window.document.getElementById('css_delegacion').href.replace('0800','1024');
	window.document.getElementById('css_portada').href = window.document.getElementById('css_portada').href.replace('0800','1024');
	window.document.getElementById('css_imprimible').href = window.document.getElementById('css_imprimible').href.replace('0800','1024');*/
/*}*/

/* Modificar el estado de los Menús*/
function cargaEstadoInicialMenu()
{
	for(var i = 0; i < estadoMenu.length; i++)
	{
		if(i == 0 || i == 1 || i == 3 || i == 4 || i == 9)
			actualizaCajaMenuInicial1('seccion_'+(i+1), 'menu_'+(i+1), 'caja_menu_'+(i+1), (i+1), estadoMenu[i]);
		else
			actualizaCajaMenuInicial2('seccion_'+(i+1), 'menu_'+(i+1), (i+1), estadoMenu[i]);
	}
}
function cambiaEstadoMenu2(seccion, menu, posicion)
{
	var estado = estadoMenu[(posicion-1)];
	if(estado == 0)
		estado = 1;

	else
		estado = 0;
	actualizaCajaMenu2(seccion, menu, posicion, estado);
}
function cambiaEstadoMenu1(seccion, menu, caja_menu, posicion)
{
	var estado = estadoMenu[(posicion-1)];
	if(estado == 0)
		estado = 1;

	else
		estado = 0;
	actualizaCajaMenu1(seccion, menu, caja_menu, posicion, estado);
}
function actualizaCajaMenuInicial2(seccion, menu, posicion, estado)
{
	if(estado == 0)
	{
		if(window.document.getElementById(seccion).className.indexOf('_abierto') > 0)
			window.document.getElementById(seccion).className = window.document.getElementById(seccion).className.substring(0,window.document.getElementById(seccion).className.indexOf('_abierto'))+"_cerrado";
		Effect.Fade(menu,{duration:0.001});
                estadoMenu[(posicion-1)] = estado;
	}
}
function actualizaCajaMenuInicial1(seccion, menu, caja_menu, posicion, estado)
{
	if(estado == 0)
	{
		if(window.document.getElementById(seccion).className.indexOf('_abierto') > 0)
			window.document.getElementById(seccion).className = window.document.getElementById(seccion).className.substring(0,window.document.getElementById(seccion).className.indexOf('_abierto'))+"_cerrado";
		Effect.Fade(menu,{duration:0.001});
		Effect.Fade(caja_menu,{duration:0.001});
                estadoMenu[(posicion-1)] = estado;
	}
}
function actualizaCajaMenu2(seccion, menu, posicion, estado)
{
	if(estado == 0)
	{
		if(window.document.getElementById(seccion).className.indexOf('_abierto') > 0)
			window.document.getElementById(seccion).className = window.document.getElementById(seccion).className.substring(0,window.document.getElementById(seccion).className.indexOf('_abierto'))+"_cerrado";
		Effect.Fade(menu,{duration:1.0});
                var oculto = "\'oculto\'";
		self.setTimeout(eval("window.document.getElementById(menu).className = " + eval("\'oculto\'")),1000);
		estadoMenu[(posicion-1)] = estado;
	}
	else
	{
		if(window.document.getElementById(seccion).className.indexOf('_cerrado') > 0)
			window.document.getElementById(seccion).className = window.document.getElementById(seccion).className.substring(0,window.document.getElementById(seccion).className.indexOf('_cerrado'))+"_abierto";
		window.document.getElementById(menu).style.opacity="0.0";
		window.document.getElementById(menu).style.filter="alpha(opacity=0)";
		//window.document.getElementById(menu).className = "mostrar";
		Effect.Appear(menu,{duration:1.0});
		estadoMenu[(posicion-1)] = estado;
	}
}
function actualizaCajaMenu1(seccion, menu, caja_menu, posicion, estado)
{
	if(estado == 0)
	{
		if(window.document.getElementById(seccion).className.indexOf('_abierto') > 0)
			window.document.getElementById(seccion).className = window.document.getElementById(seccion).className.substring(0,window.document.getElementById(seccion).className.indexOf('_abierto'))+"_cerrado";
		Effect.Fade(menu,{duration:1.0});
		Effect.Fade(caja_menu,{duration:1.0});
                var oculto = "\'oculto\'";
		self.setTimeout(eval("window.document.getElementById(menu).className = " + eval("\'oculto\'")),1000);
		self.setTimeout(eval("window.document.getElementById(caja_menu).className = " + eval("\'oculto\'")),1000);
		estadoMenu[(posicion-1)] = estado;
	}
	else
	{
		if(window.document.getElementById(seccion).className.indexOf('_cerrado') > 0)
			window.document.getElementById(seccion).className = window.document.getElementById(seccion).className.substring(0,window.document.getElementById(seccion).className.indexOf('_cerrado'))+"_abierto";
		window.document.getElementById(caja_menu).style.display="inline";
		window.document.getElementById(caja_menu).style.zoom = "0";
		//window.document.getElementById(caja_menu).className = "mostrar";
		window.document.getElementById(menu).style.opacity="0.0";
		window.document.getElementById(menu).style.filter="alpha(opacity=0)";
		window.document.getElementById(menu).style.zoom = "0";
		//window.document.getElementById(menu).className = "mostrar";
		Effect.Appear(menu,{duration:1.0});
		estadoMenu[(posicion-1)] = estado;
	}
}

function anadirEstado(elem)
{
	var vector= estadoMenu;
	
	if (elem.href.indexOf('?')!=-1) elem.href=elem.href+'&';
	else elem.href=elem.href+'?';
	
	if (elem.href.indexOf('vismenu')!=-1 && cambio==0){ elem.href=elem.href+vector;}
	else{ elem.href=elem.href+'vismenu='+vector;}
	
}
//Inicio Escolarizacion
var IE = document.all ? true : false;
if (!IE) {
    document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;


function getMouseXY(e){


     if (!e) var e = window.event  
   
     if (e.pageX || e.pageY)     {  
         tempX  = e.pageX +5;  
         tempY  = e.pageY +5; 
         //window.status = tempX + ' : ' + tempY ;

     } else if (e.clientX || e.clientY)  {  
        tempX  = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;  
        tempY  = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;  
         //window.status =tempX + ' : ' + tempY ;  
     } else {  
         return;  
  }  



   /*if (IE) {
        tempX = event.clientX + document.body.scrollLeft;
        tempY = event.clientY + document.body.scrollTop;
    }
    else { //para firefox
        tempX = e.pageX;
        tempY = e.pageY;
    }
   
    if (tempX < 0) {
        tempX = 0;
    }
    if (tempY < 0) {
        tempY = 0;
    }
    return true;*/
}

function VentanaFlotante(mensaje, x, y){
  

        //creo el iframe que va debajo del div de ayuda
        var iframe_fl = document.createElement('IFRAME');
        iframe_fl.id = 'fr';
        iframe_fl.style.position = 'absolute';
        iframe_fl.style.height = 10 + 'px';
        iframe_fl.style.backgroundColor = "#99cc66";
        iframe_fl.style.color = "#99cc66";
        //iframe_fl.border = "3px solid #007136";
        iframe_fl.frameborder="no";
        iframe_fl.src = "about:blank";
        iframe_fl.style.left = tempX + 'px';
        iframe_fl.style.top = tempY + 'px';
        //asigno el ancho del div pasado por parametro
        iframe_fl.style.width = x + 6 + 'px';
        //asigno el alto del div pasado por parametro
        iframe_fl.style.height = y + 6 +'px';
        //le añadimos un padding
        iframe_fl.style.paddingTop="10px";
        iframe_fl.style.paddingRight="10px";
        iframe_fl.style.paddingLeft="10px";
        iframe_fl.style.paddingBottom="10px";
        document.body.appendChild(iframe_fl);         

  
        //creo el objeto div
        var div_fl = document.createElement('DIV');
        //le asigno que su posicion sera abosoluta
        div_fl.style.position = 'absolute';
        //le asigno el ide a la ventana
        div_fl.id = 'Miventana';
        //digo en que posicion left y top se creara a partir de la posicion del raton tempx tempy
        div_fl.style.left = tempX + 'px';
        div_fl.style.top = tempY + 'px';
        //asigno el ancho del div pasado por parametro
        div_fl.style.width = x + 'px';
        //asigno el alto del div pasado por parametro
        div_fl.style.height = y + 'px';
        //asigno el color de fondo
        div_fl.style.backgroundColor = "#99cc66";
        //le ponemos borde
        div_fl.style.border = "3px solid #007136";
        //le añadimos un padding
        div_fl.style.paddingTop="10px";
        div_fl.style.paddingRight="10px";
        div_fl.style.paddingLeft="10px";
        div_fl.style.paddingBottom="10px";
        //alineamos a la izquierda
        div_fl.style.textAlign="left";
        //le damos un tamaña
        div_fl.style.fontSize="11px";  

        //el objeto añado a la estrutura principal el document.body
        document.body.appendChild(div_fl);
        //el mensaje pasado por parametro muestro dentro del div
        div_fl.innerHTML = mensaje;

}
function quitarDiv()
{
        //creo el objeto del div
        var mv = document.getElementById('Miventana');
        //elimino el objeto
        document.body.removeChild(mv);

        //creo el objeto del iframe
        var ifr = document.getElementById('fr');
        //elimino el objeto
        document.body.removeChild(ifr);
}

//Fin escolarizacion

		function compruebaCamposEXPL()
		{
		   var resul = true;        
        
	    	if(window.document.formularioExpl.dni.value == '' && window.document.formularioExpl.apellido2.value == '' && window.document.formularioExpl.apellido1.value == '' && window.document.formularioExpl.nombre.value == '' )
			{
					alert("Debe introducir algún parámetro para ejecutar la búsqueda.");
					resul = false;
			}	
			return resul;
		
		}
