Frases = new Array("like a wave-blind whale", "in the heart of the ocean", "sometimes, only the memories make sense", "when everything is so strange", "... so empty"); 
Contenido = new Array('', '<h2>sin\'sl</h2>', '<img id="Lienzo" width="720" height="396" alt="" />', '|_Images:__&middot;_<a href="#" onclick="Navegar(-1)">__previous_</a>_&middot;_<a href="#" onclick="Navegar(1)">____next___</a>_&middot;_|_&middot;_<a href="#" onclick="Catalogo(-1)">___gallery___</a>_&middot;_', '|_Galleries:_&middot;_<a href="#" onclick="Catalogo(0)">___abstract__</a>_&middot;_<a href="#" onclick="Catalogo(1)">____misc____</a>_&middot;_<a href="#" onclick="Catalogo(2)">__mathscapes_</a>_&middot;_', '|_&middot;_<a href="#" onclick="About()">___about__</a>_&middot;_|', '');   
Imagenes = new Array();
Galerias = new Array("abstract", "misc", "mathscapes");
PosX = new Array (123, 202, 281, 360, 439, 518, 170, 270, 370, 470);
PosSta = new Array (123, 202, 281, 360, 439, 518, 170, 270, 370, 470);
PosIni = new Array ();
PosFin = new Array ();
dCuadros = new Array();
var dMarco; var dAcerca; var dRail; var dInferior;
var TimerID;
var Estado=0;
var Galeria=-1;
var Imagen=0;
var ContF = 0;
var ContT = 0;
var ContD = 0;
var ContC = 0;
var ContO = 0;
var ContI = 0;
var Frase = 0;
var t ;
var l ;
var b ;
var Direccion = 1;

var DOM = (document.getElementById);
var IE5 = ((DOM) && (navigator.userAgent.toLowerCase().indexOf('msie')!=-1) && (navigator.userAgent.toLowerCase().indexOf('opera')==-1));
var IEM = ((IE5) && (parseFloat(navigator.appVersion.toLowerCase()) < 6) && (navigator.userAgent.toLowerCase().indexOf("mac")!=-1));
var GKO = (navigator.userAgent.toLowerCase().indexOf('gecko')!=-1);
var DOK = ((IE5) || (GKO));
var W3C = ((DOM) && !(IE5));


if (DOK) document.writeln('<link rel=stylesheet href="sy2.css" media="screen" type="text/css" />'); 

function Inicio () {
if (DOK) {
 dMarco = document.getElementById('Marco');
 dAcerca = document.getElementById('Acerca');
 dRail = document.getElementById('Rail');
 dInferior = document.getElementById('Inferior');
 for (var i=0; i<10; i++) {
  if (i<9) Contenido[1]+='<a href="#" onclick="Representar('+i+')"><img id="Thm'+i+'" src="images/vacio.gif" width="80" height="44" alt="" onload="ImagenCargada()" /></a>'; 
  if (i<3) Contenido[3+i]=Contenido[3+i].replace(/_/g, "&nbsp;");
  dRail.innerHTML+='<img id="Img'+i+'" src="images/vacio.gif" width="80" height="44" alt="" />'; 
  document.getElementById('Img'+i).style.top='0px';
  document.getElementById('Img'+i).style.left=parseInt(PosX[i])+'px';
  }
 Posicionar();
 Frasear ();
 Titular ();
 CargarImagenes ();
 }
}

function Posicionar () {
var w = (IE5) ? parseInt(document.body.clientWidth) : window.innerWidth;
var h = (IE5) ? parseInt(document.body.clientHeight) : window.innerHeight;
l = Math.max((w-720)/2,0);
t = Math.max((h-420)/2,0);
b = Math.min(h-120, 320+t);
dMarco.style.left =  parseInt(l)+'px';
dMarco.style.top = parseInt(t)+'px';
dAcerca.style.left =  parseInt(320+l)+'px';
dAcerca.style.top = parseInt(64+t)+'px';
dMarco.style.visibility='visible'; 
if (Estado==0) {
 document.getElementById('TitCentral').style.marginTop = parseInt(2*b/5)+'px';
 dInferior.style.left = parseInt(l)+'px'
 dInferior.style.top = parseInt(b+23)+'px'
 }
if (Estado==1) {
 document.getElementById('TitCentral').style.marginTop = parseInt(2*b/5)+'px';
 dRail.style.top = parseInt(b)+'px'; 
 dRail.style.left =  parseInt(l)+'px';
 dInferior.style.top = parseInt(b+76)+'px'; 
 dInferior.style.left =  parseInt(l)+'px';
 for (var i=0; i<3; i++) {
  document.getElementById('Lnk'+i).style.top=parseInt(b-24)+'px';
  document.getElementById('Lnk'+i).style.left=parseInt(l+150+160*i)+'px';
  }
 }
if (Estado>1) {
 dInferior.style.top = parseInt(t+396)+'px'; 
 dInferior.style.left =  parseInt(l)+'px';
 document.getElementById('Lnk1').style.top=parseInt(b-24)+'px';
 document.getElementById('Lnk1').style.left=parseInt(l+310)+'px';
 }
}

function Titular () {
document.getElementById('TitCentral').style.color = 'rgb('+Math.floor(4*ContT/5)+','+Math.floor(4*ContT/5)+','+ContT+')';
ContT++
if (ContT<256) setTimeout("Titular()", 100-Math.floor(ContT/3));
}

function Frasear () {
if (ContF%32==0) {
 dInferior.innerHTML = '<p>'+Frases[Frase]+'</p>';
 Frase++
 }
dInferior.style.color = 'rgb('+(13*ContF)+','+(13*ContF)+','+(16*ContF)+')';
ContF+=Direccion;
if (ContF%16==0) {
 Direccion*=-1;
 if (ContF%32==0) {
  if (Frase<6) setTimeout("Frasear()", 50);
  }
 else {
  setTimeout("Frasear()", 2500);
  }
 }
else {
 if (Frase<6) {
  setTimeout("Frasear()", 50);
  }
 else {
  dRail.style.top = parseInt(b)+'px'; 
  dRail.style.left = parseInt(l)+'px'; 
  dRail.style.visibility='visible';
  dRail.style.display='block'; 
  for (var i=0; i<10; i++) {
   dCuadros[i] = document.getElementById('Img'+i);
   dCuadros[i].src=Imagenes[i].src;
   }
  dInferior.style.top=parseInt(b+76)+'px'; 
  dInferior.innerHTML='<p>twenty seven images from nowhere</p>'; 
  dInferior.style.color='#AAC'; 
  for (var i=0; i<3; i++) {
   document.getElementById('Lnk'+i).style.top=parseInt(b-24)+'px';
   document.getElementById('Lnk'+i).style.left=parseInt(l+150+160*i)+'px';
   document.getElementById('Lnk'+i).innerHTML='<p><a class="gal" href="#" onMouseOver="pLink('+i+')" onMouseOut="dLink()" onclick="Catalogo('+i+')">'+Galerias[i]+'</a></p>';
   document.getElementById('Lnk'+i).style.zIndex=i+5;
   }
  Estado=1;
  TimerID = setInterval("DeslDivs()",50);
  }
 }
}

function CargarImagenes () {
Miniaturas = new Array('0', '13', '19', '1', '17', '20', '8', '9', '23', '26');   
for (var i=0; i<10; i++) {
 Imagenes[i]=new Image;
 Imagenes[i].src="images/m"+Miniaturas[i]+".jpg";
 }
}

function DeslDivs () { 
for (var i=0; i<10; i++) { 
 PosX [i] += Math.sin(Math.pow(-1,i)*(ContD/50 + i * 2.5)); 
 dCuadros[i].style.left=parseInt(PosX[i])+'px';
 } 
ContD ++; 
}

function pLink (Indice) { 
for (var i=0; i<10; i++) { 
 PosIni [i] = PosX[i]; 
 PosFin [i] = 10*(0.5-Math.random()) + 160 + 160*Indice; 
} 
ContC = 1; 
clearInterval(TimerID)
Converger();  
} 

function Converger () { 
for (var i=0; i<10; i++) { 
 PosX [i] = PosFin [i] + (PosIni [i] - PosFin [i])/(Math.pow(2,ContC/2)); 
 dCuadros[i].style.left=parseInt(PosX[i])+'px';
 } 
ContC ++; 
if (ContC < 18) { 
 TimerID = setTimeout("Converger ()",5); 
 } 
else { 
 ContD = 314; 
 clearTimeout(TimerID)
 TimerID = setInterval("DeslDivs()",50);
 } 
} 

function dLink () {
var r=Math.ceil(10*Math.random());  
for (var i=0; i<10; i++) { 
 PosIni [i] = PosX[i]; 
 PosFin [i] = PosSta [i] ; 
 dCuadros[i].src=Imagenes[(i+r)%10].src;
 } 
ContC = 1; 
clearInterval(TimerID);
Converger (); 
}

function Ocultar() {
window.focus();
Estado=2;
clearInterval(TimerID);
ContT=0;
Transicion();
}

function Transicion() {
dCuadros[ContT].style.visibility='hidden';
document.getElementById('TitCentral').style.color = 'rgb('+(204-18*ContT)+','+(204-18*ContT)+','+(255-20*ContT)+')';
dInferior.style.top = parseInt(b+76+ContT*(t+320-b)/10)+'px'; 
ContT++;
if (ContT<10) {
 TimerID = setTimeout("Transicion()",50); 
 }
else {
 clearTimeout(TimerID)
 for (var i=0; i<3; i++) {
  document.getElementById('Lnk'+i).style.visibility='hidden';
  }
 document.getElementById('Lnk1').innerHTML='<p>loading...</p>';
 document.getElementById('Lnk1').style.color='#AAC';
 document.getElementById('Lnk1').style.zIndex=0;
 dRail.style.visibility='hidden';
 dInferior.style.top = parseInt(t+396)+'px'; 
 dInferior.style.paddingTop = '3px'; 
 Estado=3;
 Catalogo (-1);
 }
}

function Catalogo (Indice) {
ContI=0;
dAcerca.style.visibility='hidden';
window.focus();
if (Indice!=Galeria) {
 if (Indice!=-1) Galeria = Indice;
 if (Estado!=3) {
  Ocultar();
  }
 else {
  document.getElementById('Lnk1').style.visibility='visible';
  dInferior.innerHTML='<p>'+Contenido[4]+Contenido[5]+'</p>';
  dMarco.innerHTML=Contenido[1]; 
  for (var i=0; i<9; i++) {
   document.getElementById('Thm'+i).style.top=parseInt(131+45*Math.floor(i/3))+'px';
   document.getElementById('Thm'+i).style.left=parseInt(239+81*(i%3))+'px';
   document.getElementById('Thm'+i).src='images/m'+(i+9*Galeria)+'.jpg';
   }
  }
 }
}

function Representar (Indice) {
window.focus();
Imagen = Indice;
document.getElementById('Lnk1').style.visibility='visible';
dMarco.innerHTML=Contenido[2];
dInferior.innerHTML='<p>'+Contenido[3]+Contenido[5]+'</p>';
document.getElementById('Lienzo').style.top='0px';
document.getElementById('Lienzo').style.left='0px';
document.getElementById('Lienzo').src='images/'+(Indice+9*Galeria)+'.jpg';
}

function Navegar (Donde) {
window.focus();
Imagen=Imagen+9;
dAcerca.style.visibility='hidden';
Representar ((Imagen+Donde)%9);
}

function ImagenCargada () {
ContI++;
if (ContI>=8) document.getElementById('Lnk1').style.visibility='hidden';
}

function About () {
window.focus();
Galeria=-1;
dMarco.innerHTML='';
dInferior.innerHTML='<p>'+Contenido[4]+Contenido[5]+'</p>';
dAcerca.style.visibility='visible';
dAcerca.style.backgroundImage='url(images/back.jpg)';
}


