// JavaScript Document
window.addEvent('resize', function(){
	var scroll = window.getSize();
			Vancho=scroll.x;
			Valto=scroll.y;
			//centrarAcceso();
});
window.addEvent('domready', function(){
	var scroll = window.getSize();
			Vancho=scroll.x;
			Valto=scroll.y;
			//centrarAcceso();
});
function centrarAcceso(){
	var cuerpoWeb=$('cuerpo')
	var anchoWeb=950
	var cuerpoWeb2=anchoWeb/2
	var pagina3=Vancho/2
	var posicionancho3=pagina3-cuerpoWeb2
		cuerpoWeb.style.left= posicionancho3+'px';
		cuerpoWeb.style.width=anchoWeb+'px';
};

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function campoB(idCampo, txt){
	if ($(idCampo).value==txt){
		$(idCampo).value='';
	}
	$(idCampo).setStyles({'color': '#000000'});
	}
function campoBD(idCampo, txt){
	if ($(idCampo).value==''){
		$(idCampo).value=txt;
		$(idCampo).setStyles({'color': '#CCCCCC'});
	}
}
function sd(){
	document.acceso.hu.value = document.acceso.login.value;
	document.acceso.hc.value = document.acceso.clave.value;
}

function showdiv(event, dia)
{
	//determina un margen de pixels del div al raton
	margin=15;

	//La variable IE determina si estamos utilizando IE
	var IE = document.all?true:false;
	//Si no utilizamos IE capturamos el evento del mouse
	//if (!IE) document.captureEvents(Event.MOUSEMOVE)
	//if (!IE) document.addEventListener('mousemove',showdiv,false)
	
	var tempX = 0;
	var tempY = 0;

	if(IE)
	{ //para IE
		tempX = event.clientX + window.document.documentElement.scrollLeft;
		tempY = event.clientY + window.document.documentElement.scrollTop;
	}else{ //para netscape
		tempX = event.pageX;
		tempY = event.pageY;
	}
	if (tempX < 0){tempX = 0;}
	if (tempY < 0){tempY = 0;}

	var m_datos;
	var j;
	var nombre_calen;
	var datos_a_mostrar;
	for (j = -10; j < 50; j++) {
		nombre_calen = 'datos_calen' + j;
		datos_a_mostrar = "";
		if (document.getElementById(nombre_calen)) {
			if (document.getElementById(nombre_calen).value != "") {							// && (datos_a_mostrar == "No hay actividades para mostrar" || datos_a_mostrar == "")) {
				m_datos = document.getElementById(nombre_calen).value.split("(/*/)");				
				for (i = 0; i < m_datos.length; i++) {
					if (m_datos[i] == dia) {
						if (datos_a_mostrar != "")
							datos_a_mostrar = datos_a_mostrar + "<br>";
						datos_a_mostrar = datos_a_mostrar + "- " + m_datos[i+1];
					}
				}				
					
				if (datos_a_mostrar != "")
					break;
			}
		}
	}
	if (datos_a_mostrar == "")
			datos_a_mostrar = "No hay actividades para mostrar";
				
	document.getElementById('posicion').innerHTML="<b>Actividades del día</b> " + dia + "<br>" + datos_a_mostrar + "<br>";
			
	document.getElementById('flotante_capa').style.top = (tempY+margin) + "px";
	document.getElementById('flotante_capa').style.left = (tempX+margin) + "px";
	document.getElementById('flotante_capa').style.display = 'block';
	return;
}
function Hidediv(event)
{	
	var IE = document.all?true:false;
	if (!IE) document.removeEventListener('mousemove',showdiv,false)
	document.getElementById('flotante_capa').style.display='none';
}
