// funciones javascript para menu
var estaba="";
var FFX,NS4,NS6,IE4,IE5,vis,invis,pelicula,ruta,deshabilitados,peli_menu,PUEDE,idioma
var WIN,MAC,LINUX,OP,alto_foto,ancho_foto,fotoAmostrar
  NS4 = (document.layers) ? true : false;
  IE4 = (document.all && !document.getElementById) ? true : false;
  IE5 = (document.all && document.getElementById) ? true : false;
  FFX = (navigator.userAgent.indexOf("Firefox") != -1) ? true : false;
  NS6 = (((!document.all && document.getElementById) ? true : false)&&!FFX);
  WIN = (navigator.platform.indexOf("Win")!=-1) ? true : false;
  MAC = (navigator.platform.indexOf("Mac")!=-1) ? true : false;
  LINUX = (navigator.platform.indexOf("Linux")!=-1) ? true : false;
  OP = (navigator.appName.indexOf("Opera")!=-1) ? true : false;
  if(MAC||((LINUX&&(navigator.appName.indexOf("Netscape")!=-1)))){FFX=true;}
  if(OP){FFX=true;}

if(NS4){vis="shown";invis="hide";}else{vis="visible";invis="hidden";}

function ffx_idioma(str){
  idioma=str;
}

document.onmousedown=click;
if (NS6){document.addEventListener("mouseup",alerta,false);}

function alerta(e){
if (e.which == 3) {alert("GCI/IAPH");return false;}
}

function click(e) {
  NS4 = (document.layers) ? true : false;
  if (NS4) {if (e.which == 3) {alert("GCI/IAPH");return false;}} else {if(NS6){}else{if (event.button == 2) {alert("GCI/IAPH");return false;}}}
}

function inicio(){
  self.parent.menu.PUEDE=false;
  NS4 = (document.layers) ? true : false;
  deshabilitados=["historia","difusion","composicion","sistema","acceso","justificacion","objetivos","delimitacion","criterios","metodologia","estructura","bloque1","bloque2","bloque3","busquedas","jerarquica","alfabetica","bbloque1","bbloque2","bbloque3","descripcion","tecnicas"];
  ruta="";
  if(NS4){
    self.parent.menu.pelicula=self.parent.contenido.document.embeds["peli"];
    self.parent.menu.peli_menu=self.parent.menu.document.embeds["peli_menu"];
    pelicula=document.embeds["peli"];
  }else{
    if(IE4){
       self.parent.menu.pelicula=self.parent.contenido.document.peli;
       self.parent.menu.peli_menu=self.parent.menu.document.peli_menu;
       pelicula=document.peli;
    }else{
       if(NS6){
	self.parent.menu.pelicula=self.parent.contenido.document.embeds["peli"];
	self.parent.menu.peli_menu=self.parent.menu.document.embeds["peli_menu"];
	pelicula=document.embeds["peli"];
       }else{
	self.parent.menu.pelicula=self.parent.contenido.document.getElementById("peli");
        self.parent.menu.peli_menu=self.parent.menu.document.getElementById("peli_menu");
	pelicula=document.getElementById("peli");
       }
    }
  }
}

function salir(){
  if(!FFX){window.parent.close();}else{alert("Firefox no permite el cierre de ventanas a través de programación...\n \nDeberá cerrar la ventana manualmente.");}
}

function vete(str){
 if(!FFX){
   if(PUEDE){
     if(NS6){pelicula=top.contenido.document.embeds["peli"];}
     if(ruta=="casos"||ruta=="getty"||ruta=="iaph"||ruta=="historia"||ruta=="difusion"){
       pelicula.TPlay("_root.fueradeaqui");
     }else{
       ultimo=pelicula.GetVariable("fr_largo");
       pelicula.GotoFrame(ultimo);
       pelicula.Play();
     }
   }else{
     cargaP();
   }
 }else{
//   idioma="esp";
   ruta=str;
   cargaP();
 }
}

function carga(){
  self.parent.menu.cargaP();
}

function cargaP(){
 PUEDE=false;
 if(NS4||NS6||FFX){
   if(!FFX){
     ruta=top.menu.document.getElementById("peli_menu2").GetVariable("estoy");
     idioma=top.menu.document.getElementById("peli_menu2").GetVariable("idioma");
     idioma=idioma.toLowerCase();
   }
   if(idioma=="esp"){idi="1";}else{idi="2";}
   estababusquedas=(estaba!="descripcion"&&estaba!="materiales"&&estaba!="tecnicas"&&estaba!="alfabetica_b1"&&estaba!="alfabetica_b2"&&estaba!="alfabetica_b3")?false:true;
   voybusquedas=(ruta=="descripcion"||ruta=="materiales"||ruta=="tecnicas"||ruta=="alfabetica_b1"||ruta=="alfabetica_b2"||ruta=="alfabetica_b3")?true:false;
   estaba=ruta;
   if(estababusquedas){
	if(voybusquedas){
	  top.contenido.location.href="busquedas.php?i="+idi+"&b="+dimeBloque(ruta);
	}else{
          top.contenido.location.href="contenido.php?id="+idioma+"&pe="+ruta;
	}
   }else{
	if(voybusquedas){
	  top.contenido.location.href="busquedas.php?i="+idi+"&b="+dimeBloque(ruta);
	}else{

          if(!existeFichero(ruta,idioma)){ruta="nada";}
cadena="<EMBED name='peli' src='media/"+idioma+"/"+ruta+".swf?' menu=false quality=high WIDTH=548 HEIGHT=436"+ 
" TYPE='application/x-shockwave-flash'"+
" PLUGINSPAGE='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'></EMBED>";
parent.contenido.document.getElementById('cont').innerHTML=cadena;
	}
   }
 }else{
   ruta=top.menu.peli_menu.GetVariable("estoy");
   idioma=top.menu.peli_menu.GetVariable("idioma");
   idioma=idioma.toLowerCase();  

   if(idioma=="esp"){idi="1";}else{idi="2";}
   estababusquedas=(estaba!="descripcion"&&estaba!="materiales"&&estaba!="tecnicas"&&estaba!="alfabetica_b1"&&estaba!="alfabetica_b2"&&estaba!="alfabetica_b3")?false:true;
   voybusquedas=(ruta=="descripcion"||ruta=="materiales"||ruta=="tecnicas"||ruta=="alfabetica_b1"||ruta=="alfabetica_b2"||ruta=="alfabetica_b3")?true:false;
   estaba=ruta;
   if(estababusquedas){
	if(voybusquedas){
	  top.contenido.location.href="busquedas.php?i="+idi+"&b="+dimeBloque(ruta);
	}else{
          top.contenido.location.href="contenido.php?id="+idioma+"&pe="+ruta;
	}
   }else{
	if(voybusquedas){
	  top.contenido.location.href="busquedas.php?i="+idi+"&b="+dimeBloque(ruta);
	}else{

//          top.contenido.location.href="contenido.php?id="+idioma+"&pe="+ruta;

          if(!existeFichero(ruta,idioma)){ruta="nada";}
	  top.contenido.pelicula.movie="media/"+idioma+"/"+ruta+".swf?";
	}
   }
 }
 return true;
}

function ok(){
 self.parent.menu.PUEDE=true;
}

function pie(n){
  switch(n){
    case 1:
	if(!FFX&&!MAC){
	  if(IE5){pp=top.menu.peli_menu;}else{pp=top.menu.document.getElementById("peli_menu2");}
	  pp.TGotoFrame("funciones",5);
	}else{
	  if(top.menu.idioma=="esp"){c=".html";}else{c="_i.html";}
	  top.menu.location.href="menu_ffx_2"+c;
	  top.menu.ruta="ayuda";
	  top.menu.cargaP();
	}
	break;
    case 2:
	window.top.document.location="index.html";
	break;
    case 3:
	if(!FFX&&!MAC){
	  if(IE5){pp=top.menu.peli_menu;}else{pp=top.menu.document.getElementById("peli_menu2");}
	  pp.TGotoFrame("funciones",7);
	}else{
	  if(top.menu.idioma=="esp"){c=".html";}else{c="_i.html";}
	  top.menu.location.href="menu_ffx_2"+c;
	  top.menu.ruta="aviso";
	  top.menu.cargaP();
	}
	break;
    case 4:
	if(!FFX&&!MAC){
	  if(IE5){pp=top.menu.peli_menu;}else{pp=top.menu.document.getElementById("peli_menu2");}
	  pp.TGotoFrame("funciones",9);
	}else{
	  if(top.menu.idioma=="esp"){c=".html";}else{c="_i.html";}
	  top.menu.location.href="menu_ffx_2"+c;
	  top.menu.ruta="creditos";
	  top.menu.cargaP();
	}
	break;
    case 5:
	if(top.menu.idioma=="esp"){top.menu.idioma="ing";top.document.title="ALTARPIECES. Illustrated basic terminology";}else{top.menu.idioma="esp";top.document.title="RETABLO. Terminología básica ilustrada";}
	if(!FFX){
	  if(IE5){pp=top.menu.peli_menu;}else{pp=top.menu.document.getElementById("peli_menu2");}
	  pp.TGotoFrame("funciones",3);
	  if(IE5){pp=document.getElementById("peli_pie");}else{pp=document.getElementById("peli_pie2");}
	  pp.TGotoFrame("funciones",3);
	  if(IE5){pp=top.cabecera.peli_cabecera;}else{pp=top.cabecera.document.getElementById("peli_cabecera2");}
	  pp.TGotoFrame("funciones",3);
	}else{
	  if(top.menu.idioma!="esp"){
	    top.cabecera.location.href="cabecerai.html";
	    top.menu.location.href="menu_ffx_i.html";
	    top.contenido.location.href="contenido.php?id=2&pe=presentacion";
	    top.pie.location.href="piei.html";
	  }else{
	    top.cabecera.location.href="cabecera.html";
	    top.menu.location.href="menu_ffx.html";
	    top.contenido.location.href="contenido.php?id=1&pe=presentacion";
	    top.pie.location.href="pie.html";
	  }
	}
	break;
  }
}

function zoom1(n){
  alto=screen.height-66;ancho=screen.width-10;
  izda=0;arriba=0;
  if(document.layers){
    miv1=window.open("zoom1.html", "zoom", "toolbar=no,left="+izda+",top="+arriba+",titlebar=no,scrollbars=yes,resize=no,copyhistory=0,width="+ancho+",height="+alto);
  }else{
    miv1=window.open("zoom1.html", "zoom", "toolbar=no,left="+izda+",top="+arriba+",titlebar=no,scrollbars=1,Resizable=0,copyhistory=0,width="+ancho+",height="+alto);
  }
  miv1.focus();
}

function zoom(n){
anchoss=[1260,1260,1260,1260,440,1260,1260,1260,1260,1260,1092,1030,1260,1260,1069,1260,660];
altoss=[1668,1727,1722,1823,757,1478,1513,1701,1954,1617,1557,1518,1513,1627,1653,1826,596];
fotoAmostrar=n;
  alto=screen.height-66;ancho=screen.width-10;
  alto_foto=altoss[n-1];
  ancho_foto=anchoss[n-1];
  dify=alto_foto-alto;
  if(dify>0){
    al=alto_foto;
    an=ancho_foto;
    alto_foto=alto;
    ancho_foto=(an*alto)/al;
    ancho=ancho_foto;
  }else{
    alto=alto_foto;
    ancho=ancho_foto;
  }
  izda=0;arriba=0;
izda=((screen.width-10)/2)-(ancho/2);
arriba=((screen.height-66)/2)-(alto/2);
  if(document.layers){
    miv1=window.open("zoom.html", "zoom", "toolbar=no,left="+izda+",top="+arriba+",titlebar=no,scrollbars=no,resize=no,copyhistory=0,width="+ancho+",height="+alto);
  }else{
    miv1=window.open("zoom.html", "zoom", "toolbar=no,left="+izda+",top="+arriba+",titlebar=no,scrollbars=0,Resizable=0,copyhistory=0,width="+ancho+",height="+alto);
  }
  miv1.focus();
}

function muestrafoto(){

/* -------------------------------------------   ATENCION  ------------------------------------------
	
	"tits" contiene una lista con los titulos de los retablos de CASOS DE ESTUDIO.
	hay que modificar los titulos de ingles en la lista "tits" debajo del ELSE.

	TAMBIEN HABRÁ QUE MODIFICARLA EN EL BEHAVIOR "CONTENIDOS" de IAPH/RUTINAS

   ----------------------------------------------------------------------------------------------- */

if(opener.top.menu.idioma=="esp"){

	tits=["Retablo de la Virgen María - Enghien, Bélgica.","Retablo de Vera Cruz - Bouvignes, Bélgica.","Retablo Mayor - La Paz, Bolivia.","Retablo Mayor - Ciudad de Laguna, Santa Catarina, Brasil.","Retablo Mayor dedicado a San Antonio - Santa Bárbara, Minas Gerais, Brasil.","Retablo Mayor de la Iglesia de la Concepción - Bogotá, Colombia.","Retablo de San José - Atlántico. Colombia.","Retablo de san Francisco Javier - Quito, Ecuador.","Retablo de los Santos Juanes - Granada, España.","Retablo de Santa Eulalia - Álava, España.","Retablo de San Bartolomé - Álava, España.","Retablo “La Asunción de Nuestra Señora” - Madrid, España.","Retablo Mayor de Santa Maria del Giglio - Tarcento, Friuli, Italia.","Retablo Mayor de Santo Domingo de Guzmán - Oaxaca, México.","Retablo Mayor de San Cayetano - Guanajuato,  México.","Retablo Mayor - Lima, Perú.","Retablo de la Sacristía - Sernancelhe, Portugal."]

}else{

	tits=["Altarpiece of Vie de la Vierge (Life of the Virgin) - Enghien, Belgium.","Altarpiece of Vraie Croix (Holy Cross) - Bouvignes-sur-Meuse, Belgium.","Main Altarpiece - La Paz, Bolivia.","Main Altarpiece - Laguna, Santa Catarina, Brazil.","Main Altarpiece dedicated to Santo Antonio - Santa Barbara, Minas Gerais, Brazil.","Main Altarpiece of the Church of the Conception - Bogotá, Colombia.","Altarpiece of San José - Atlántico, Colombia.","Altarpiece of San Francisco Javier - Quito, Ecuador.","Altarpiece of the Santos Juanes - Granada, Spain.","Altarpiece of Santa Eulalia - Álava, Spain.","Altarpiece of San Bartolomé - Álava, Spain.","Altarpiece of Our Lady of Assumption - Madrid, Spain.","Main Altarpiece of Santa Maria del Giglio - Tarcento, Friuli, Italy.","Main Altarpiece of Santo Domingo de Guzmán - Oaxaca, Mexico.","Main Altarpiece of San Cayetano - Guanajuato, Mexico.","Main Altarpiece - Lima, Peru.","Altarpiece of the Sacristy - Sernancelhe, Portugal."]

}

  n=opener.fotoAmostrar;
  this.document.title=tits[n-1];
  this.document.getElementById("lafoto").innerHTML="<img src=\"fotos/foto"+String(n)+".jpg\" width=\""+String(opener.ancho_foto)+"\" height=\""+String(opener.alto_foto)+"\" border=0>"  
}


function zoom3(n){
  alto=screen.height-66;ancho=screen.width-10;
  izda=0;arriba=0;
  if(document.layers){
    miv1=window.open("zoom3.html", "zoom", "toolbar=no,left="+izda+",top="+arriba+",titlebar=no,scrollbars=yes,resize=no,copyhistory=0,width="+ancho+",height="+alto);
  }else{
    miv1=window.open("zoom3.html", "zoom", "toolbar=no,left="+izda+",top="+arriba+",titlebar=no,scrollbars=1,Resizable=0,copyhistory=0,width="+ancho+",height="+alto);
  }
  miv1.focus();
}

function dimeBloque(r){
  switch(r){
    case "descripcion":s="1";break;
    case "materiales":s="2";break;
    case "tecnicas":s="3";break;
    case "alfabetica_b1":s="4";break;
    case "alfabetica_b2":s="5";break;
    case "alfabetica_b3":s="6";break;
  }
  return s;
}

function existeFichero(fich,idi){
 return true;
}

function idiomainicio(n){
 top.location.href="index2.php?id="+String(n);
}

function pdf(n){
/* -------------------------------------------   ATENCION  ------------------------------------------
	LOS PDF'S SON: (van en la carpeta /pdf)

		ESPAÑOL:
			1 --> Listado jerárquico --> debe nombrarse como "PDF_01.pdf" (atencion a las mayusculas!!)
			2 --> Listado alfabético --> debe nombrarse como "PDF_02.pdf" (atencion a las mayusculas!!)
			3 --> Bibliografía, bloque 1 (descripcion morfologica) --> debe nombrarse como "PDF_03.pdf" (atencion a las mayusculas!!)
			4 --> Bibliografía, bloque 2 (materiales) --> debe nombrarse como "PDF_04.pdf" (atencion a las mayusculas!!)
			5 --> Bibliografía, bloque 3 (tecnicas y sistemas const.) --> debe nombrarse como "PDF_05.pdf" (atencion a las mayusculas!!)
		INGLES:
			6 --> Listado jerárquico --> debe nombrarse como "PDF_06.pdf" (atencion a las mayusculas!!)
			7 --> Listado alfabético --> debe nombrarse como "PDF_07.pdf" (atencion a las mayusculas!!)
			8 --> Bibliografía, bloque 1 (descripcion morfologica) --> debe nombrarse como "PDF_08.pdf" (atencion a las mayusculas!!)
			9 --> Bibliografía, bloque 2 (materiales) --> debe nombrarse como "PDF_09.pdf" (atencion a las mayusculas!!)
			10 --> Bibliografía, bloque 3 (tecnicas y sistemas const.) --> debe nombrarse como "PDF_10.pdf" (atencion a las mayusculas!!)

   ----------------------------------------------------------------------------------------------- */

  if(top.menu.idioma!="esp"){n=n+5;}
  if(n<10){relleno="0";}else{relleno="";}
  numero=String(n);
  el_pdf="pdf/PDF_"+relleno+numero+".pdf";
  window.status="PDF "+String(n);
  window.open(el_pdf, "Pdf");

}