// variables para la visualización de imágenes ampliadas
imagen = '';
tituloi = '';
extrasi = '';
anchoi = '';
altoi = '';

video = '';
titulovi = '';
anchovi = '';
altovi = '';


function Ficha(id, titulo, autor, movimiento, fecha, pais, tecnica, vecesvista, valoracion, fotog, fotop, width, height, productor, pclave_plus4) {
		this.id = id;
		this.titulo = titulo;
		this.autor = autor;
		this.movimiento = movimiento;
		this.fecha = fecha;
		this.pais = pais;
		this.tecnica = tecnica;					
		this.vecesvista = vecesvista;		
		this.valoracion = valoracion;								
		this.fotog = fotog;
		this.fotop = fotop;		
		this.width = width;		
		this.height = height;				
		this.productor = productor;
		this.pclave_plus4 = pclave_plus4;
}

function abrir_img(im,ti,ex,ancho,alto){
	imagen=im;
	tituloi=ti;
	extrasi=ex;
	anchoi=ancho;
	altoi=alto;
	masAlto=alto+11;
	features = "width="+ancho+",height="+masAlto;	
	window.open("/common/ver_imagen.htm",ancho+alto,features);
}

function abrir_video(im,ti,ancho,alto){
	video=im;
    titulovi=ti;
    anchovi=ancho;
    altovi=alto;
	if (ancho == "0" ) ancho=300;
	if (alto == "0" ) alto=10;
    masAlto=alto+11+25;
    features = "width="+ancho+",height="+masAlto;   
    window.open("/common/ver_video.htm",ancho+alto,features);
}

function abrir(pagina,tamano){
window.open(pagina,'Foto_Ampliada',tamano);
}

function abrir_pagina (pagina,nombre,tamano){
window.open(pagina,nombre,tamano);
}

function abrirC(pagina){ 
if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0) { 
	window.open(pagina,'Datos','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=1,width=667,height=460,left=0,top=0'); 
} else { 
 window.open(pagina,'Datos','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=1,width=651,height=467,left=0,top=0'); 
}} 

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  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); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v3.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_setTextOfLayer(objName,x,newText) { //v3.0
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (navigator.appName=='Netscape') {open();write(unescape(newText)); close();}
    else innerHTML = unescape(newText);
}

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 menucac(nivel2,nivel3) {
/* ÑAPA PARA PREMIOS NOBEL. Redefino los niveles porque NOBEL lo quieren en nivel 2 y en MAPAWEB está en nivel 3*/
if((nivel2=="LIB"&&nivel3=="NOB")||(nivel2=="LIB"&&nivel3=="REN")){nivel2="NOB";nivel3="AAA";}

// -- INICIO VARIABLES CUSTOMIZABLES --
var r = "/cac/"; // directorio root
var n2 = new Array("Portada","Arte","Ciencia","Libros","Escenarios","Tiempo Libre","Premios Nobel","Diccionario","Traductor","Chat","Foros"); // Etiquetas nivel 2
var v2 = new Array("AAA","ARS","CIE","LIB","ESC","TIE","NOB","DIC","TRA","CHA","FOR"); // NIV nivel 2
var lnk2 = new Array("","arte/","ciencia/","libros/","escenarios/","tiempolibre/","libros/nobel/portada.cfm?idpersona=755&idpremio=572","rae/","traductor/","chats/","foro/"); // Links nivel 2
var n3 = new Array("","Arte en imágenes,Especiales,Archivo,Multimedia","Foto Ciencia,Agenda y Espacios,Archivo,Ciencia Interactiva","Archivo,Multimedia,Especiales,Envía un poema","Archivo,Multimedia","","","","",""); // Etiquetas nivel 3
var v3 = new Array("","AIM,ESP,FOT,HIS,MUL","AGE,HIS,MUL","HIS,MUL,ESP,POE","HIS,MUL","","","","",""); // NIV nivel 3
var lnk3 = new Array("","arte/arteimg/,arte/especiales/,arte/historico.htm,arte/multimedia/,multimedia/","ciencia/cienciaimg/,ciencia/agenda/,ciencia/historico.htm,ciencia/multimedia/","libros/historico.htm,libros/multimedia/,libros/especiales,libros/poemas","escenarios/historico.htm,escenarios/multimedia/","libre/","juego/"); // Links nivel 3

// -- FIN  VARIABLES CUSTOMIZABLES --

strmenu = "";
strmenu += "<table width=138 border=0 cellspacing=0 cellpadding=0><tr><td width=1><img src='/img/au.gif' width=1 height=1></td><td class=c width=136 colspan=2><img src='/img/au.gif' width=136 height=1></td><td width=1><img src='/img/au.gif' width=1 height=1></td></tr><tr><td class=c width=1><img src='/img/au.gif' width=1 height=1></td><td width=136 colspan=2>";
strmenu += "<table width='136' border=0 cellspacing=0 cellpadding=0><tr><td colspan=3 class=b><img src='/img/au.gif' width=1 height=1></td></tr>";
for(i=0;i<n2.length;i++){
	if(nivel2==v2[i]){ // Selección nivel2
		if(n3[i]==""){ // Sin nivel 3
			strmenu += "<tr><td width=10 class=c><img src='"+r+"/img/bulletmen1b.gif' width=5 height=5></td><td width=126 class=c height=19 colspan=2><a href='"+r+lnk2[i]+"' class=me2 target=_top>"+n2[i]+"</a></td></tr>";
		} else { // Con nivel 3
			strmenu += "<tr><td width=10 class=c><img src='"+r+"/img/bulletmen1.gif' width=7 height=3></td><td width=126 class=c height=19 colspan=2><a href='"+r+lnk2[i]+"' class=me2 target=_top>"+n2[i]+"</a></td></tr><tr><td colspan=3 class=b><img src='/img/au.gif' width=1 height=1></td></tr>";
			tn3 = lista2array(n3[i]);
			tv3 = lista2array(v3[i]);
			tlnk3 = lista2array(lnk3[i]);
			for(j=0;j<tn3.length;j++){ 
				if(nivel3==tv3[j]){ // Selección nivel3
					strmenu += "<tr><td width=10><img src='"+r+"/img/bulletmen2.gif' width=5 height=5></td><td width=7>&nbsp;</td><td width=119 class=d height=16>&nbsp;&nbsp;&nbsp;<a href='"+r+tlnk3[j]+"' class=me1 target=_top>"+tn3[j]+"</a></td></tr>";
				} else { // No selección nivel3. niveles 3 desplegados 
					strmenu += "<tr><td width=10>&nbsp;</td><td width=7>&nbsp;</td><td width=119 height=16><b>&middot;</b> <a href='"+r+tlnk3[j]+"' class=me1 target=_top>"+tn3[j]+"</a></td></tr>";
				}
			}
		}
	} else {// No selección nivel2
		if(i==0){ // Excepción para portada
			strmenu += "<tr><td width=10><img src='/img/au.gif' width=10 height=1></td><td colspan=2 width=126 height=19><a href='"+r+lnk2[i]+"' class=me1 target=_top>"+n2[i]+"</a></td></tr>";
		} else { //niveles 2 
			strmenu += "<tr><td colspan=3 class=e><img src='/img/au.gif' width=1 height=2></td></tr><tr><td width=10>&nbsp;</td><td colspan=2 width=126 height=19><a href='"+r+lnk2[i]+"' class=me1 target=_top>"+n2[i]+"</a></td></tr>";
		}
	}
}
strmenu += "</table>";
strmenu += "</td><td class=c width=1><img src='/img/au.gif' width=1 height=1></td></tr><tr><td width=1><img src='/img/au.gif' width=1 height=1></td><td class=c width=136 colspan=2><img src='/img/au.gif' width=1 height=1></td><td width=1><img src='/img/au.gif' width=1 height=1></td></tr><tr><td width=1><img src='/img/au.gif' width=1 height=1></td><td class=b width=136 colspan=2><img src='/img/au.gif' width=1 height=1></td><td width=1><img src='/img/au.gif' width=1 height=1></td></tr></table>";
document.write(strmenu);
}

function lista2array(lista){ if(lista != null){var tbl = new Array();	var idxIni = 0;	var i;	if(lista.length>0){for(i=0;(idxFin = lista.indexOf (",", idxIni)) != -1;i++){tbl[i] = lista.substring(idxIni,idxFin); idxIni = idxFin + 1;	}} tbl[i]=lista.substring(idxIni,lista.length); return tbl;}else{return "";}}	


function init(){ return true;}


function escribeDiv(cad) {
    if ((ie4) || (ns6)) {
	document.getElementById('txt').innerHTML = cad;
	}
	if (ns4) {
	capa=document.layers['txt'].document;
	capa.open();
	capa.write(cad);
	capa.close();
	}
}

var NS4 = (document.layers) ? 1 : 0;
var IE4 = (document.all) ? 1 : 0;
var NS6 = (document.getElementById&&!document.all) ? 1 : 0;

function CambiarFrame(url) {
	if (IE4) parent.fotoI.location.href = url;
    if (NS4) parent.document.fotoLL.src = url;
	if (NS6) parent.document.getElementById("fotoI").src = url;
}

function CambiarFrame2(url) {
    if (IE4) document.fotoI.location.href = url;
	if (NS4) {parent.document.fotoLL.src = url;}
    if (NS6) parent.document.getElementById("fotoI").src = url;

}

function CambiarFrame3(url) {
    //if (IE4) parent.menu.document.fotoI.location.href = url;
	//if (NS4) {parent.menu.document.fotoLL.src = url;}
	//if (NS6) parent.menu.document.getElementById("fotoI").src = url;
	if (IE4) parent.menu.document.location.href = url;
	if (NS4) parent.menu.document.location.href = url;
	if (NS6) parent.menu.document.location.href = url;
}

 function DoPlayTele() {
    if (ie4) pantalla = document.tele;
    if (ns4) pantalla = parent.document.fotoLL.document.tele2;
    if ( pantalla != null ) {
      pantalla.DoPlay();
    }
  }

  function DoPauseTele() {
    if (ie4) pantalla = document.tele;
    if (ns4) {
	pantalla = parent.document.fotoLL.document.cortinilla.document.tele2;}
    if ( pantalla != null ) {
      pantalla.DoPause();
    }
  }
  
  function DoStopTele() {
    if (ie4) pantalla = document.tele;
    if (ns4) pantalla = parent.document.fotoLL.document.tele2;
    if ( pantalla != null ) {
      pantalla.DoStop();
    }
  }
