window.onload = function (){
		//emblemas();
	//alert ("Si entra");
//		menu('main','principal','ZZ_Probador','spot');
		menu('main','principal','005_principal','contenido');

//		initVar(); 
//		moveBanner();

//		document.getElementById('main').src="images/Btn_std_principal_12.gif";
//		initiate();
		fix();

}

function smenu(par1,par2,par3){
	alert("Entro");
}

function sobre(md,imagen){
	document.getElementById(md).src="images/Btn_up_" + imagen + "_12.gif";
//	alert("images/Btn_up_" + imagen + "_12.gif");
}

function suelta(md,imagen){
	document.getElementById(md).src="images/Btn_std_" + imagen + "_12.gif";
//	alert("images/Btn_std_" + imagen + "_12.gif");
}

function oprime(md,imagen){
	document.getElementById(md).src="images/Btn_dwn_" + imagen + "_12.gif";
	//alert("images/Btn_std_informacion_12.gif");
}

function libera(md,imagen){
	document.getElementById(md).src="images/Btn_up_" + imagen + "_12.gif";
	//alert("images/Btn_std_informacion_12.gif");
}

function menu(md,imagen,pagina,posicion) {

//alert(md+ " " + imagen + " " + pagina +" " + posicion);
		$Ajax(pagina + ".htm", {
		cache: false,
		metodo: $metodo.get, 
		onfinish: function(html) {
			$(posicion).innerHTML = html;
		}
	});
}


function menu2(md,imagen,pagina,posicion) {

		$Ajax(pagina, {
		cache: false,
		metodo: $metodo.get, 
		onfinish: function(html) {
			$(posicion).innerHTML = html;
		}
	});
	alert(md+ " " + imagen + " " + pagina +" " + posicion);

}


function tbup(md,imagen){
	document.getElementById(md).className="tbrefdown";
	//alert("images/Img_Big_pisos_" + md + ".gif");
}

function tbdown(md,imagen){
	document.getElementById(md).className="tbrefup";
	//alert("images/Btn_std_informacion_12.gif");
}

function tbmnup(md,imagen){
	document.getElementById(md).className="tbmendown";
	//alert("images/Img_Big_pisos_" + md + ".gif");
}

function tbmndown(md,imagen){
	document.getElementById(md).className="tbmenup";
	//alert("images/Btn_std_informacion_12.gif");
}



function ShowEvent(md){
	if (document.getElementById(md).style.display == "inline"){
		document.getElementById(md).style.display="none";
//		alert("Visible");
	} else {
		document.getElementById('EventPrees').style.display="none";
		document.getElementById('EventPrim').style.display="none";
		document.getElementById('EventSec').style.display="none";

		document.getElementById(md).style.display="inline";
		//alert("images/Img_Big_pisos_" + md + ".gif");
	}
}



function DisPlan(md){
	for (i=1;i<7;i++){
		document.getElementById('Plan'+i).style.display="none";
	}	
	document.getElementById(md).style.display="block";
}


function cierra(div){
	document.getElementById(div).style.display="none";
}

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//|------ Calendario Actividades -----------------------------------|
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


function CalAct(md){
	for (i=1;i<13;i++){
	var a=i
	if (a<10){a="0"+ a}
		if (document.getElementById('MM'+ a).style.display == "inline"){
			document.getElementById('MM'+ a).style.display="none";
		}
	}	
	if (md<10){md="0"+md}
	document.getElementById('MM'+ md).style.display="inline";
}

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//|------ Sport de eventos -----------------------------------------|
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


function stat(){
	var a = pageYOffset+window.innerHeight-document.spot.document.height-15;
	document.spot.top = a;
	setTimeout('stat()',2);
}

function fix(){
	nome=navigator.appName
	if(nome=='Netscape'){
		stat();
	}
	else{
		var a=document.body.scrollTop+document.body.clientHeight-document.all.spot.offsetHeight+1;
		spot.style.top = a;
	}
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//|------ Galeria de imágenes --------------------------------------|
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

function ImgRunLeft(){
	document.getElementById("BgImg").src="images/Instalaciones/" + imagen + ".jpg";

}

function ImgChange(imagen){
	document.getElementById("BgImg").src="images/Instalaciones/" + imagen + ".jpg";
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//|------ Banner Efemerides ----------------------------------------|
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


var displayTime, speed, wait, banner1, banner2, link1, link2, bannerIndex, bannerLocations, bannerURLs;

function initVar() {
  displayTime = 10; // The amount of time each banner will be displayed in seconds.
  speed = 10; // The speed at which the banners is moved (1 - 10, anything above 5 is not recommended).
  wait = true;


  banner1 = document.getElementById("banner1");
  banner2 = document.getElementById("banner2");
  link1 = document.getElementById("link1");
  link2 = document.getElementById("link2");

  banner1 = document.getElementById("banner1");
  banner2 = document.getElementById("banner2");

//alert (banner1.style.name);
  //banner1.style.left = 50;
  //banner2.style.left = 500;

  bannerIndex = 1;

  /* Important: In order for this script to work properly, please make sure that the banner graphic and the
  URL associated with it have the same index in both, the bannerLocations and bannerURLs arrays.
  Duplicate URLs are permitted. */

  // Enter the location of the banner graphics in the array below.
  bannerLocations = new Array(
  "<table width=100%><tr><td width=80px height=100%>1414</td><td>Se abre el Concilio de Constanza en el que se pone fin al llamado Cisma de Occidente</td></tr></table>",
  "1321<br>Dante Aligueri",
  "<table width=100%><tr><td width=80px height=100%>1414</td><td>Se abre el Concilio de Constanza en el que se pone fin al llamado Cisma de Occidente</td></tr></table>",
  "<table width=100%><tr><td width=80px height=100%>1492</td><td>Cristóbal Colón muestra a sus compañeros de conquista la planta de maíz.</td></tr></table>",
  "<table width=100%><tr><td width=80px height=100%>1811</td><td>José Matías Delgado encabeza el primer intento de obtener la independencia de Ecuador.</td></tr></table>"
  );

  // Enter the URL's to which the banners will link to in the array below.
  bannerURLs = new Array("http://www.internet.com","http://www.jupiterweb.com","http://www.jupitermedia.com");

}

function moveBanner(){
  if(!wait){
    banner1.style.left = parseInt(banner1.style.left) -  (speed * 5);
    banner2.style.left = parseInt(banner2.style.left) - (speed * 5);
      alert ("MoveBanner");
    if(parseInt(banner1.style.left) <= -500){
      banner1.style.left = 500;
      bannerIndex = (bannerIndex < (bannerLocations.length - 1)) ? ++bannerIndex :0;
      banner1.innerHTML= bannerLocations[bannerIndex];
//      banner1.src = bannerLocations[bannerIndex];
//      link1.href = bannerURLs[bannerIndex];
      wait = true;
    }
    if(parseInt(banner2.style.left) <= -500){
      banner2.style.left = 500;
      bannerIndex = (bannerIndex < (bannerLocations.length - 1)) ? ++bannerIndex :0;
      banner2.innerHTML= bannerLocations[bannerIndex];
//      banner2.src = bannerLocations[bannerIndex];
//      link2.href = bannerURLs[bannerIndex];
      wait = true;
    }

    setTimeout("moveBanner()",100);
  } else {
      wait = false;
      setTimeout("moveBanner()", displayTime * 1000);
  }
}



//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//|------ Galeria de imágenes --------------------------------------|
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

function ImgChangOn(imd){
	document.getElementById(imd).src="images/BtnInscripOn_" + imd + ".png";

}

function ImgChangOff(imd){
	document.getElementById(imd).src="images/BtnInscripOff_" + imd + ".png";
}


function emblemas(){



	var viewportwidth;
 	var viewportheight;
 

 if (typeof window.innerWidth != 'undefined')
 {

      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }  else if (typeof document.documentElement != 'undefined'
 
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }


	var ImgWidth = document.getElementById('Bandera').style.width;
	var ImgHeight = document.getElementById('Bandera').style.height;
	
	var WinWidth = parseInt(ImgWidth) / 2;
	var WinHeight = parseInt(ImgHeight) / 2;
	
	var posLeft = (viewportwidth / 2) - WinWidth;
	var posTop = (viewportheight / 2) - WinHeight;
	

	document.getElementById('Bandera').style.left = posLeft + 'px';
	document.getElementById('Bandera').style.top = posTop + 'px';
	
	//document.getElementById('Bandera').style.top=100
	
	
	//document.getElementById('Escudo').style.top="5";
	
	//document.getElementById('Escudo').style.left=myWidth-100;
	
	document.getElementById('Bandera').style.display='block';

}


function CerrarEmb(){ document.getElementById('Bandera').style.display='none';}


function ShowMnuAlt(div){

	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	posx = e.clientX - 100;
	//alert(posy);

	document.getElementById(div).style.left = posx  + 'px';
	document.getElementById(div).style.display = 'block';
	
/*
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
*/
}

function HideMnuAlt(div){
	document.getElementById(div).style.display = 'none';
}




