//*****************************************************************************************************************

var seve=false; 

function parpadeo() {

	  document.getElementById('par').style.visibility = seve ? 'visible' : 'hidden'; 
	  seve = !seve; 
}

//*****************************************************************************************************************

function establecer_contador_antiguo() {

var param = location.search;
var i,valor;

	if (param.length != 0) {
		
		i = param.lastIndexOf('imag=');
		valor = param.substring(i+5,i+6);
		if (parseInt(valor)>=6)
		
			document.forms[0].contador.value = '1';
		
		else document.forms[0].contador.value = valor;
	
	} else document.forms[0].contador.value = '1';
	
	imagen_peque();
}

//*****************************************************************************************************************

function busca(q,s,c){

// &Start='+s+'&Count='+c+'&SearchWV=FALSE&SearchThesaurus=FALSE&SearchFuzzy=FALSE&SearchEntry=ResultEntry

var i = document.menu.contador.value;

ir_a_servidor('/Biblioteca/IndicesW.nsf/buscar?SearchView&Query=("' + q + '")&SearchMax=0&SearchWV=0&SearchThesaurus=0&SearchFuzzy=0&SearchOrder=4&Scope=1&imag='+i,'mainFrame');
}

//*****************************************************************************************************************

function comprobar_menuF(menu,main) {

	var grande = 'inicioF.html';
	var peque = 'inicioF.html';
	var texto = "?menu="+menu+"&prin="+main;

	if (top.frames.length != 6) {

		if (screen.width >= 1024) window.location.href = grande+texto;
		else window.location.href = peque+texto;
	
	} else {
	
		fondo();
			
	}
}

//*****************************************************************************************************************

function comprobar_menu(menu,main) {

	var grande = 'inicio.html';
	var peque = 'iniciop.html';
	var texto = "?menu="+menu+"&prin="+main;

	if (top.frames.length != 2) {

		if (screen.width >= 1024) window.location.href = grande+texto;
		else window.location.href = peque+texto;
	
	} else {
	
		fondo();
			
	}
}

//*****************************************************************************************************************

function comprobar_menu_RC(menu,main) {

	var grande = 'inicioRC.html';
	var peque = 'inicioRCp.html';
	var texto = "?menu="+menu+"&prin="+main;

	if (top.frames.length != 2) {

		if (screen.width >= 1024) window.location.href = grande+texto;
		else window.location.href = peque+texto;
	
	} else {
	
		fondo_RC(main);
			
	}
}

//*****************************************************************************************************************

function redireccionarWEB2antigua() {

var url = window.location.host;

if (url == 'redcolumnaria.inf.um.es')

	window.location.href = 'http://www.redcolumnaria.com'; // 'redcolumnaria.html';

else 
	window.location.href = 'HTML/web2.html';
}

//*****************************************************************************************************************

function establecer_contador() {

var url = window.location.host;

if (url == 'redcolumnaria.inf.um.es')

	window.location.href = 'http://www.redcolumnaria.com'; // 'redcolumnaria.html';

else 
	window.location.href = 'http://saavedrafajardo.um.es/Biblioteca/IndicesW.nsf/Inicio?OpenForm&m=2';
}

//*****************************************************************************************************************

function redireccionarWEB2() {

var url = window.location.host;

if (url == 'redcolumnaria.inf.um.es')

	window.location.href = 'http://www.redcolumnaria.com'; // './REDCOLUMNARIA/HTML/RCinicio.html';

else if (url == 'vestigiosdeunmismomundo.inf.um.es')

	window.location.href = 'http://www.redcolumnaria.com'; // './REDCOLUMNARIA/Vestigios/VestigiosInicio.html';

else if (url == 'hispanofilia.inf.um.es')

	window.location.href = 'http://www.redcolumnaria.com'; // './REDCOLUMNARIA/Hispanofilia/HispanofiliaInicio.html';

else

	window.location.href = 'http://saavedrafajardo.um.es/Biblioteca/IndicesW.nsf/Inicio?OpenForm&m=2';
}

//*****************************************************************************************************************

function redireccionarF() {

var grande = 'HTML/inicioF.html';
var peque = 'HTML/inicioFp.html';
var valor = location.search;

if (valor != '') { 

	grande = grande + valor;
	peque = peque + valor;	
}

if (screen.width >= 1024) window.location.href = grande;
else window.location.href = peque;

}

//*****************************************************************************************************************

function redireccionar() {

var grande = 'HTML/inicio.html';
var peque = 'HTML/iniciop.html';
var valor = location.search;

if (valor != '') { 

	grande = grande + valor;
	peque = peque + valor;	
}

if (screen.width >= 1024) window.location.href = grande;
else window.location.href = peque;

}

//*****************************************************************************************************************

function redireccionar_RC() {

var grande = 'inicioRC.html';
var peque = 'inicioRCp.html';
var valor = location.search;

if (valor != '') { 

	grande = grande + valor;
	peque = peque + valor;	
}

if (screen.width >= 1024) window.location.href = grande;
else window.location.href = peque;

}

//*****************************************************************************************************************

function redireccionar_1() {

var grande = 'imagen11-M.html';
var peque = 'imagen11-M.html';
var valor = location.search;

if (valor != '') { 

	grande = grande + valor;
	peque = peque + valor;	
}

if (screen.width >= 1024) window.location.href = grande;
else window.location.href = peque;

}

//*****************************************************************************************************************

function volver_menu_RC() {

			if (screen.width >= 1024) top.frames['menu'].location='../menuprin.html';
			else top.frames['menu'].location='../menuprinp.html';

}


//*****************************************************************************************************************

function inicio_menu() {

	var param = location.search;
	var texto = new String; 
	var i,f;

	if (param.length != 0) {
		
		i = param.lastIndexOf('menu=');
		f = param.lastIndexOf('&prin=');
		if ((i >= 0) && (f > 6) && (i<f))  {
			
			texto = param.substring(i+5,f);
			
			if (screen.width >= 1024) texto = texto + '.html';
			else texto = texto + 'p.html';
		}
		
		if (texto.length != 0)		

			top.frames['menu'].location=texto;

		else	
		
			if (screen.width >= 1024) top.frames['menu'].location='menuprin.html';
			else top.frames['menu'].location='menuprinp.html';
	}
	else	if (screen.width >= 1024) top.frames['menu'].location='menuprin.html';
			else top.frames['menu'].location='menuprinp.html';

}

//*****************************************************************************************************************

function inicio_menu_RC() {

	var param = location.search;
	var texto = new String; 
	var i,f;

	if (param.length != 0) {
		
		i = param.lastIndexOf('menu=');
		f = param.lastIndexOf('&prin=');
		if ((i >= 0) && (f > 6) && (i<f))  {
			
			texto = param.substring(i+5,f);
			
			if (screen.width >= 1024) texto = texto + '.html';
			else texto = texto + 'p.html';
		}
		
		if (texto.length != 0)		

			top.frames['menu'].location=texto;

		else	if (screen.width >= 1024) top.frames['menu'].location='menucol.html';
				else top.frames['menu'].location='menucolp.html';
	}
	else	if (screen.width >= 1024) top.frames['menu'].location='menucol.html';
				else top.frames['menu'].location='menucolp.html';
}


//*****************************************************************************************************************

function inicio_prin() {

	var param = location.search;
	var texto = new String();
	var i,f,j,k;

	if (param.length != 0) {

		i = param.lastIndexOf('prin=');
		f = param.length;
		k = param.lastIndexOf('Openform');
		j = param.lastIndexOf('OpenDocument');
		
		if ((k > 0) || (j > 0)) {
		
			if ((i >= 0) && (f > 6) && (i<f)) texto = param.substring(i+5,f);
			
			if (texto.length != 0) 
			
				ir_a_servidor(texto,'mainFrame');			

			else	top.frames['mainFrame'].location='flash.html';	
			
		}
		else {

			if ((i >= 0) && (f > 6) && (i<f)) texto = param.substring(i+5,f)+'.html';
		
			if (texto.length != 0)	
			
				top.frames['mainFrame'].location=texto;

			else	top.frames['mainFrame'].location='flash.html';	
		}
	}
	else	top.frames['mainFrame'].location='flash.html';	
}

//*****************************************************************************************************************

function inicio_prin_RC() {

	var param = location.search;
	var texto = new String();
	var i,f,k;

	if (param.length != 0) {

		i = param.lastIndexOf('prin=');
		f = param.length;
		k = param.lastIndexOf('Openform');
		
		if (k > 0) {
		
			if ((i >= 0) && (f > 6) && (i<f)) texto = param.substring(i+5,f);
			
			if (texto.length != 0) 
			
				ir_a_servidor(texto,'mainFrame');			

			else	top.frames['mainFrame'].location='flashRC.html';	
			
		}
		else {

			if ((i >= 0) && (f > 6) && (i<f)) texto = param.substring(i+5,f)+'.html';
		
			if (texto.length != 0)	
			
				top.frames['mainFrame'].location=texto;

			else	top.frames['mainFrame'].location='flashRC.html';	
		}
	}
	else	top.frames['mainFrame'].location='flashRC.html';	
}

//*****************************************************************************************************************

function fondo() {

	if (screen.width >= 1024) document.body.background = '../imagen/fondo1.gif';
	else document.body.background = '../imagen/fondo2.gif';

}

//*****************************************************************************************************************

function fondoM() {

	if (screen.width >= 1024) document.body.background = '../imagen/fondoM.gif';
	else document.body.background = '../imagen/fondoM.gif';

}
//*****************************************************************************************************************

function fondo_RC(main) {

	if (main=='flashRC') {

		if (screen.width >= 1024) document.body.background = '../../imagen/fondoRC21b.gif';
		else document.body.background = '../../imagen/fondoRC22b.gif';
	
	} else {
	
		if (main.lastIndexOf('SFB')==0) {

			if (screen.width >= 1024) document.body.background = '../../imagen/fondoSFB1.jpg';
			else document.body.background = '../../imagen/fondoSFB2.jpg';
		
		} else {
	
			if (screen.width >= 1024) document.body.background = '../../imagen/fondoRC21.gif';
			else document.body.background = '../../imagen/fondoRC22.gif';
		}
	}
}
//*****************************************************************************************************************

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) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); 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_swapTitle() { //v3.0
  var i,j=0,x,a=MM_swapTitle.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.title; x.title=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 Mostrar_imagen() {

	var i;
	
	valor= new Array();
	
	for (i=1; i <= 5; i++) {
	
		valor[i] = 'hide';
		if (i == Mostrar_imagen.arguments[0]) { valor[i]='show';}
	}	

	MM_showHideLayers('presenojo','',valor[1],'ojoequipo','',valor[2],'ojocontenidos','',valor[3],'ojoindi','',valor[4],'busqueojo','',valor[5]);

}

//*****************************************************************************************************************

function imagen_grande() {

	var valor,imag;
		
	valor = parseInt(document.menu.ultimo.value);
	
	if (valor == 0)  valor = 1;
	
	imag = '../imagen'+ valor + '.html';
	
	window.open(imag,'','width=411,height=570,menubar=false')

}

//*****************************************************************************************************************

function imagen_grande_c(imag) {
	
	window.open(imag,'FOTOGRAFÍA_RED_COLUMNARIA','width=640,height=480,menubar=false')

}

//*****************************************************************************************************************

function imagen_peque() {

	var valor,imag;
	
	var lista = new Array('','El Pájaro y la Serpiente','La Aparición del Señor en las nubes','La Estatua','Las Cuatro Bestias','Los Antepasados Inmediatos de Cristo');
	
	var ultimo = imagen_peque.arguments[0];
	
	valor = document.menu.contador.value;
	document.menu.ultimo.value = valor;
	
	if (valor == '5') document.menu.contador.value = '1';
	else document.menu.contador.value = new String(parseInt(document.menu.contador.value) + 1);
		
	imag = '../imagen/fondoTp' + valor + '.gif';
		
	MM_swapImage('pagina','',imag,1);
		
	MM_swapTitle('pagina','',lista[parseInt(valor)],1);
	
}

//*****************************************************************************************************************
function imagen_title() {

	var valor;
	
	var lista = new Array('','El Pájaro y la Serpiente','La Aparición del Señor en las  nubes','La Estatua','Las Cuatro Bestias','Los Antepasados Inmediatos de Cristo');
	
	valor = document.menu.contador.value;
	
	return(lista[parseInt(valor)]);
}

//*****************************************************************************************************************

function imagen_src() {

	var valor,imag;
	
	valor = document.menu.contador.value;
	
	imag = '../imagen/fondoTp' + valor + '.gif';
		
	return(imag);
}

//*****************************************************************************************************************

function ir_a_link(texto,frame){
	
	if (frame != '')

		top.frames[frame].location=texto;
		
	else
	
		window.open(texto);
}

//*****************************************************************************************************************

function ir_a_menu(texto){

// En la variable "texto" se espera el nombre del archivo sin extension del menu a abrir.

	var enlace = location.href;
	var i;

	i = enlace.lastIndexOf('/');
	
	enlace = enlace.substring(0,i+1) + texto;
		
	if (screen.width >= 1024) enlace = enlace + '.html';
	
	else enlace = enlace + 'p.html';

	top.frames['menu'].location = enlace;
						
}

//*****************************************************************************************************************

function ir_a_servidor(texto,frame){

// En la variable "texto" se espera el nombre del documento del servidor a abrir.

	var enlace = location.hostname;

	if (enlace == '') enlace='http://saavedrafajardo.um.es';
	
	else enlace = 'http://' + enlace;

	enlace = enlace + texto;
	
	if (frame == '') window.open(enlace);
	
	else window.location.href = enlace; //top.frames[frame].location = enlace;
						
}

//*****************************************************************************************************************

function imagen_grande_2(valor) {

	imag = '../imagen'+ valor + '.html';
	
	window.open(imag,'','width=510,height=700,menubar=false')

}




