//Programado por  Ricardo Mora para la CUAED- UNAM -------------------------------

//ricardo@sustanciadigital.com----------------------------------------------------
//morari2008@hotmail.com----------------------------------------------------------
//-----------------------------------------------------------
//++++Si buscas resultados distintos, no hagas siempre lo mismo. Albert Einstein++++


//++++Si buscas resultados distintos, no hagas siempre lo mismo. Albert Einstein++++

//Programacion para  el LigthBox
//Programacion para  el LigthBox
//Programacion para  el LigthBox

//Instrucciones 
//Instrucciones 
//Instrucciones 
//Instrucciones 
//Instrucciones:  para  aplicar  este script son necesarios los siguientes aspectos:






//1. para  llamar al ligthbox  es necesario el siguiente llamado ejemplo:  <a  onClick="pag('u01_p50.html', 'FUENTES DE CONSULTA',500,900)"> texto con link</a>

//2. Sí el link esta dentro de un iframe al mismo nivel de la página es necesario agregar "parent." ejemplo  <a  onClick="parent.pag('u01_p50.html', 'FUENTES DE CONSULTA')"> texto con link</a>

//3. 'u01_p50.html'  esto corresponde a  la página que quieres que se muestre  en el ligthbox

//4. 'FUENTES DE CONSULTA' esto corresponde al título dentro del ligthbox 

//5. '500' esto corresponde a la altura del marco  del  contenido

//6. '900' esto corresponde al ancho  del marco  del  contenido





var Altoinicial=450;// corresponde al alto del span contenedor Y NO ALA CAJA ENTERA 
var AnchoF= 900; // corresponde al anho del span contenedor 
var ColorF= "#000";  // corresponde al color de fondo del span
//span contiene en su interior dos  tablas una para el titulo  y la otra  para  el iframe
var colorTit="#FFF";  // color del titulo de la caja
var imagenCerraF="images/x.png";  // corresponde  a la imagen  boton de cierre




//No editar 
//No editar 
//No editar 
//No editar 
//No editar 

//Nombre de ID usados: CapaFondo, oCapa1,  titulo, tabla_flotante, flotante


var AltoF= Altoinicial+40; 
document.write ("<span id='CapaFondo'  onClick=restaurar2('oCapa1');cerrarEmial();  style='position:fixed; display:inline; WIDTH:100%; HEIGHT:1px; top:0px; left:0px;  background-color: #000000;  padding: 0px 0px 0px 0px;  z-index:99; -khtml-opacity: 0.60; -moz-opacity: 0.60; filter: alpha(opacity=60); opacity: .60;  '></span><span  id='AumentarDisminuirLB' style='position:fixed; top:-100px; right:0px; width:210px; height:24px; border:#FFF 0px solid; background-image: url(images/controlesventanaLB.png); background-repeat:no-repeat; background-position:bottom right;  z-index:99; '><span style='position:absolute; top:4px; left:5px; color:#999; font-size:12px;'>Controles-ventana</span><span style='position:absolute; top:2px; right:70px; width:20px; height:20px; border:#CCC 0px solid;  z-index:99; '><a onClick='AumentarAncho();'><img src='images/anchoLB.png' width='20' height='20' border='0' title='Aumenta el ancho'/></a></span><span  style='position:absolute; top:2px; right:47px; width:20px; height:20px;  border:#CCC 0px solid;  z-index:200; '><a onClick='AumentarAlto();'><img src='images/altoLB.png' width='20' height='20' border='0' title='Aumenta el alto'/></a></span><span style='position:absolute; top:2px; right:24px; width:20px; height:20px;   border:#CCC 0px solid;  z-index:200; '><a onClick='ampliarAnchoAltoLB();'><img src='images/ampliarLB.png' width='20' height='20' border='0' title='Aumenta el alto y ancho'/></a></span><span style='position:absolute; top:2px; right:2px; width:20px; height:20px;   border:#CCC 0px solid;  z-index:200; '><a onClick='restaurarTamanoLB();'><img src='images/restablecerLB.png' width='20' height='20' border='0' title='Tamaño original'/></a></span>ricardo</span>");


document.write ("<span id='oCapa1' style='position:fixed; width:"+AnchoF+"px; height:"+AltoF+"px; top:-570px; left:-816px;  background-color:"+ColorF+"; border-style:solid; border-color:transparent; border-width:1px; padding: 0px 0px 0px 0px; overflow:visible; z-index:100; -khtml-opacity: 0.0; -moz-opacity: 0.0; filter: alpha(opacity=0); opacity: .0; '> <table width='100%' height='22' border='0' cellspacing='0' cellpadding='0' style='border-bottom:solid; border-color:#000000; border-width:0px;'><tr><td width='90%' id='titulo' name='titulo' style='color:"+colorTit+"; font-size:12px; font-family:Verdana, Geneva, sans-serif; font-weight:bolder;'>&nbsp; &nbsp;  </td><td align='right'><div style='position:absolute; top:1px; right:35px; width:15px; height:15px; cursor:pointer;'><a onClick='redirigirLB()'><img src='images/ventana.png' width='19' height='19' border='0' title='ver en otra ventana'/></a></div><div align='center' style=' position:absolute; top:1px; right:10px; width:15px; height:15px; vertical-align:middle; background-color:#000;  border:solid; border-color: #CCC; border-width:0px;'> <a  onClick=restaurar2('oCapa1'); style='color:#FFF; font-size:14px; text-decoration:none; cursor:pointer;'><img src='"+imagenCerraF+"' width='19' height='19' border='0' title='cerrar'/></a></div></td></tr></table><table id='tabla_flotante' width='100%' bgcolor='#ffffff' height='500' border='0' cellspacing='0' cellpadding='0'><tr><td valign='top' style='border-top:solid; border-color:#000000; border-width:1px; font-weight:bolder;'><img name='flotante' id='flotante' src='images/cargando.jpg' onMouseOver=MostrarDescripcionLB(); onMouseOut=OcultarDescripcionLB(); /></td> </tr></table><div id='descripcionLB' style='position:absolute; display:inline; background-color:#900;  bottom:4px; width:100%; height:auto; font-size:12px; color:#FFF; padding:8px; visibility:hidden; -khtml-opacity: 0.90; -moz-opacity: 0.90; filter: alpha(opacity=80); opacity: .90; '><div style='position:relative; display:inline; border:#FFF 0px solid;  width:auto; height:auto;   -khtml-opacity: 0.99; -moz-opacity: 0.99; filter: alpha(opacity=90); opacity: .99;'></div></div></span>");

//<iframe name='flotante' id='flotante' src='img/cargando.jpg' width='100%' height='100%'   frameborder='0' scrolling='yes'></iframe>








	
	
	
	




//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

var continuarX="";
var paginaActulaLB="";
var tituloActualLB="";
var altoActualLB=AltoF;
var anchoActualLB=AnchoF;
//El boton en el flash o html llama a las funciones  en el siguiente orden "pag(); Restaurar(); valor();"
function pag(pagina, titu, alto, ancho, descripcion){
	//alert("h")
//continuarX=pagina;
//arrayX ();


	// cambia  l el interior del iframe
	//parent.flotante.location=pagina;
	
  document.flotante.src=pagina;
  
  document.getElementById('descripcionLB').innerHTML=descripcion
  
  //alert(flotante.height);
  //alert(document.getElementById('flotante').style.height);
  //alto= flotante.height
  //ancho= flotante.width
  
	//programación para escribir de manera dinámica el titulo de la ventana 
	if (titu == null){
		document.getElementById('titulo').innerHTML="";
		}
		else {
			document.getElementById('titulo').innerHTML= titu;
			}
			
	// si  el llamado a la  funcion tiene ALTO lo aplica
		if (alto == null){
			document.getElementById('oCapa1').style.height= AltoF+25+"px"; // la caja
			document.getElementById('tabla_flotante').style.height=AltoF+"px";//tabla envolvente de iframe
			document.getElementById('flotante').style.height= AltoF+"px";//iframe de contenido
		}
		else {
						
			document.getElementById('oCapa1').style.height= alto+25+"px";
			document.getElementById('tabla_flotante').style.height= alto+"px";
			document.getElementById('flotante').style.height= alto+"px";
			
			altoActualLB=alto;
			}
			
		// si  el link  que llamo  la funcion tiene ANCHO  lo aplica	
			if (ancho == null){
			document.getElementById('oCapa1').style.width= AnchoF+"px";
			document.getElementById('tabla_flotante').style.width= AnchoF+"px";
			document.getElementById('flotante').style.width= AnchoF+"px";
		}
		else {
						
			document.getElementById('oCapa1').style.width= ancho+"px";
			document.getElementById('tabla_flotante').style.width= ancho+"px";
			document.getElementById('flotante').style.width= ancho+"px";
			
			anchoActualLB=ancho;
			}
			
			
			
	Restaurar('oCapa1');
	valor('oCapa1');
	
	paginaActulaLB=pagina;
	tituloActualLB=titu;
	
	

	
	}


	
var alto= 0;
var capa ="";
var activado="false";

//esta funcion recibe el nombre de la capa que se movera
function valor(dato){ 
capa= dato;

anima();
}

//esta  funcion activa  la funcion anima2
function anima(){ 
//document.documentElement.clientHeight

alturabody=screen.height+200;
//alturabody=document.body.scrollHeight;//????????????
alturabody2=document.body.scrollWidth;//???????????


//elemento5=document.getElementById('contenedor_principal'); ?????????????????????????????????
elemento4=document.getElementById('CapaFondo');

//coloca la capa  5px de altura
elemento3=document.getElementById('oCapa1');
elemento3.style.top=25+"px";
document.getElementById('AumentarDisminuirLB').style.top=0+"px";
//coloca la capa al centro horizontal
media=alturabody2-elemento3.offsetWidth; //??????????????????????

media2= Math.round(media/2);

elemento3.style.left=media2+"px";

//genera la capa negra traslucida


if (document.all){elemento4.style.height=alturabody+"px";}// ????????????????????????????
else if (document.getElementById){elemento4.style.height= window.innerHeight+"px";} //?????????????


activado="true";

//tiempo=setInterval ("anima2()",100);
document.getElementById('oCapa1').style.opacity=1;
document.getElementById('oCapa1').style.MozOpacity=1;
if (navigator.appName.indexOf("Explorer") != -1){
document.getElementById('oCapa1').filters.alpha.opacity=100;
}

}

// desplaza la capa y desactiva la animacion
var decimal= 0.0;
var decimal2= 0;

function anima2(){ 

decimal= decimal+0.10;
decimal2= decimal2+ 10; 
//alert(decimal, decimal2);
document.getElementById('oCapa1').style.opacity=decimal;
document.getElementById('oCapa1').style.MozOpacity=decimal;
if (navigator.appName.indexOf("Explorer") != -1){
document.getElementById('oCapa1').filters.alpha.opacity=decimal2;
}

alto +=10;

if (alto >= 100 ){
clearInterval (tiempo);
alto =0;
decimal= 0.0;
decimal2= 0;

}
}



//restablece las capas fuera de la  ventana 
function Restaurar(capa){ 
elemento1=document.getElementById(capa);
elemento1.style.top=-570+"px";
elemento1.style.left=100+"px";
elemento1.style.visibility="visible";
}




//este script es similar al de arriba pero  oculta la capa
//*******************************************************************************
//*******************************************************************************
//*******************************************************************************
//*******************************************************************************
var alto2= 0;
var capa2 ="";

function restaurar2(dato){ 
capa2= dato;
restaurar3();
}

function restaurar3(){ 
//arriba=setInterval ("restaurar4()",10);
elemento4=document.getElementById(capa2);
elemento4.style.top=-1500+"px";
document.getElementById('AumentarDisminuirLB').style.top=-100+"px";

document.getElementById(capa).style.opacity=0.0;
document.getElementById(capa).style.MozOpacity=0.0;
	if (navigator.appName.indexOf("Explorer") != -1){
	/* para IE6&7 */ 
	document.getElementById(capa).filters.alpha.opacity=0;
	}

elemento4=document.getElementById('CapaFondo');
elemento4.style.height=1+"px";

activado="false";


// al eliminar  visualmente el frame  le carga  una imagen, cuya finalidad es la  de  evitar 
//que se quede cargado  el html anterior, ya que si se tarda un poco se puede ver en lo que sustituye
parent.flotante.location="images/cargando.jpg";
}




//*******************************************************************************
//*******************************************************************************
//*******************************************************************************
//*******************************************************************************
//*******************************************************************************
//*******************************************************************************
//*******************************************************************************
//*******************************************************************************

function MostrarDescripcionLB(){
	//alert("w")
	document.getElementById('descripcionLB').style.visibility="visible";
	}
	
function OcultarDescripcionLB(){
	document.getElementById('descripcionLB').style.visibility="hidden";
	}
//*******************************************************************************
//*******************************************************************************
//*******************************************************************************
//*******************************************************************************
//*******************************************************************************
//*******************************************************************************
//*******************************************************************************
//*******************************************************************************


// este script se llama  cuando   se redimenciona  el navegador "<body  onresize=restaurar6('oCapa1');  >"
function restaurar6(){ 
//alert("h");
alturabody=screen.height+200;
//alturabody=document.body.scrollHeight;//????????????
alturabody2=document.body.scrollWidth;//???????????


if (activado== "true"){

elemento4=document.getElementById('CapaFondo');

//coloca la capa  5px de altura
elemento3=document.getElementById('oCapa1');
elemento3.style.top=25+"px";

//coloca la capa al centro horizontal
media=alturabody2-elemento3.offsetWidth; //??????????????????????????????''

media2= Math.round(media/2);

elemento3.style.left=media2+"px";

//genera la capa negra traslucida
if (document.all){elemento4.style.height=alturabody+"px";}
else if (document.getElementById){elemento4.style.height= window.innerHeight+"px";}


}

}

//**********************************************************************************************
//**********************************************************************************************
//**********************************************************************************************
//**********************************************************************************************


//Controles para  redimenzionar  la caja del lightbox y redirigir el contenido 

//boton redirigir que se muestra  en el marco de la  ventana,  abre la misma  página  pero en otra  ventana
//Redirigir el contenido a  una nueva ventana

var anchomonitor=screen.width;
var altomonitor=screen.height;

function redirigirLB(){
temploc=paginaActulaLB
if (!(window.resizeTo&&document.all)&&!(window.resizeTo&&document.getElementById)){
window.open(paginaActulaLB)
return
}

//alert(navigator.appName);
if(navigator.appName == "Netscape" || navigator.appName == "Opera"){
	anchomonitor2=screen.width-20;
	altomonitor2=screen.height-20;
	win2=window.open(paginaActulaLB, 'ventana','width='+anchomonitor2+', top=0, left=0, height='+altomonitor2+', toolbar=no, location=yes, scrollbars=YES, resizable=yes')

	
	}
	
else{
	//win2=window.open(paginaActulaLB,"","width=10, top=0, left=0, height=10, location=yes, scrollbars=YES, resizable=yes")
	win2=window.open(paginaActulaLB,"","width=10, top=0, left=0, height="+altomonitor+", location=yes, scrollbars=YES, resizable=yes")
	//win2.moveTo(0,0)
	win2.resizeTo(10,altomonitor)
	go2()
	}	

}

var contarapreturaLB=0;


function go2(){

if (contarapreturaLB==0){
	avanzar=setInterval("go2()",10)}
anchomonitor=screen.width-20;
//altomonitor=screen.height-20;

if(contarapreturaLB >=altomonitor){
	clearInterval(avanzar);
	contarapreturaLB=0
	win2.resizeBy(anchomonitor, altomonitor)

	}
else{
	
	contarapreturaLB+=100
win2.resizeBy(100,100);
	
	
	}


}

//**********************************************************************************************
//**********************************************************************************************
//**********************************************************************************************
//**********************************************************************************************
//**********************************************************************************************
//**********************************************************************************************


function AumentarAncho(){ 
//alert("h");
alturabody=screen.height+200; //toma como parametro el tamano de la pantalla, para asegurar que el 
//alturabody=document.body.scrollHeight;//????????????
alturabody2=document.body.scrollWidth;//???????????

ele1=document.getElementById('oCapa1');
ele2=document.getElementById('tabla_flotante');
ele3= document.getElementById('flotante');


if(ele2.offsetWidth <= alturabody2-90 ){
//if(ele2.offsetWidth <= 1100 ){
document.getElementById('oCapa1').style.width= ele1.offsetWidth+60+"px";
document.getElementById('tabla_flotante').style.width= ele2.offsetWidth+60+"px";
document.getElementById('flotante').style.width= ele3.offsetWidth+60+"px";
}

if (activado== "true"){

	elemento4=document.getElementById('CapaFondo');

	//coloca la capa  5px de altura
	elemento3=document.getElementById('oCapa1');
	elemento3.style.top=25+"px";



	//coloca la capa al centro horizontal
	media=alturabody2-elemento3.offsetWidth; //??????????????????????????????''

	media2= Math.round(media/2);

	elemento3.style.left=media2+"px";

	//genera la capa negra traslucida
	if (document.all){elemento4.style.height=alturabody+"px";}
	else if (document.getElementById){elemento4.style.height= window.innerHeight+"px";}

}

}



function AumentarAlto(valor){ 
//alert("h");
alturabody=screen.height+200;
//alturabody=document.body.scrollHeight;//????????????
alturabody2=document.body.scrollWidth;//???????????

ele1=document.getElementById('oCapa1');
ele2=document.getElementById('tabla_flotante');
ele3= document.getElementById('flotante');

pass=Number(document.documentElement.clientHeight);
if(ele2.offsetHeight+100 < pass ){
//alert(ele2.offsetHeight +"/"+pass);
document.getElementById('oCapa1').style.height= ele1.offsetHeight+60+"px";
document.getElementById('tabla_flotante').style.height= ele2.offsetHeight+60+"px";
document.getElementById('flotante').style.height= ele3.offsetHeight+60+"px";
}

if (activado== "true"){

	elemento4=document.getElementById('CapaFondo');

	//coloca la capa  5px de altura
	elemento3=document.getElementById('oCapa1');
	elemento3.style.top=25+"px";



	//coloca la capa al centro horizontal
	media=alturabody2-elemento3.offsetWidth; //??????????????????????????????''

	media2= Math.round(media/2);

	elemento3.style.left=media2+"px";

	//genera la capa negra traslucida
	if (document.all){elemento4.style.height=alturabody+"px";}
	else if (document.getElementById){elemento4.style.height= window.innerHeight+"px";}

}

}



function restaurarTamanoLB(){ 

			document.getElementById('oCapa1').style.height= altoActualLB+25+"px";
			document.getElementById('tabla_flotante').style.height= altoActualLB+"px";
			document.getElementById('flotante').style.height= altoActualLB+"px";
			
			document.getElementById('oCapa1').style.width= anchoActualLB+"px";
			document.getElementById('tabla_flotante').style.width= anchoActualLB+"px";
			document.getElementById('flotante').style.width= anchoActualLB+"px";


if (activado== "true"){

	elemento4=document.getElementById('CapaFondo');

	//coloca la capa  5px de altura
	elemento3=document.getElementById('oCapa1');
	elemento3.style.top=25+"px";



	//coloca la capa al centro horizontal
	media=alturabody2-elemento3.offsetWidth; //??????????????????????????????''

	media2= Math.round(media/2);

	elemento3.style.left=media2+"px";

	//genera la capa negra traslucida
	if (document.all){elemento4.style.height=alturabody+"px";}
	else if (document.getElementById){elemento4.style.height= window.innerHeight+"px";}

}

}



	

function ampliarAnchoAltoLB () {
	
	
	if (document.all){
		//alturaLBampliar=document.body.clientHeight-30;
		
		alturaLBampliar=document.documentElement.clientHeight-30;
		anchoLBampliar=document.body.clientWidth-30;
		
		//alert(alturaLBampliar +"/"+ anchoLBampliar)
		
		document.getElementById('oCapa1').style.height=alturaLBampliar-5+"px";
		document.getElementById('tabla_flotante').style.height=alturaLBampliar-30+"px";
		document.getElementById('flotante').style.height= alturaLBampliar-30+"px";
		
		document.getElementById('oCapa1').style.width= anchoLBampliar+"px";
		document.getElementById('tabla_flotante').style.width= anchoLBampliar+"px";
		document.getElementById('flotante').style.width= anchoLBampliar+"px";
		
		document.getElementById('oCapa1').style.left=15+"px";
		
			
		}
	
	else if (document.getElementById){
		
		alturaLBampliar=window.innerHeight-30;
		anchoLBampliar=window.innerWidth-30;
		
		document.getElementById('oCapa1').style.height=alturaLBampliar-5+"px";
		document.getElementById('tabla_flotante').style.height=alturaLBampliar-30+"px";
		document.getElementById('flotante').style.height= alturaLBampliar-30+"px";
		
		document.getElementById('oCapa1').style.width= anchoLBampliar+"px";
		document.getElementById('tabla_flotante').style.width= anchoLBampliar+"px";
		document.getElementById('flotante').style.width= anchoLBampliar+"px";
		
		document.getElementById('oCapa1').style.left=15+"px";
		
			
	}
	}

//Programado por  Ricardo Mora para la CUAED- UNAM -------------------------------

//ricardo@sustanciadigital.com  ----------------------------------------------------
//morari2008@hotmail.com----------------------------------------------------------
//-----------------------------------------------------------
//++++Si buscas resultados distintos, no hagas siempre lo mismo. Albert Einstein++++


//++++Si buscas resultados distintos, no hagas siempre lo mismo. Albert Einstein++++
	




