ns4 = (document.layers)? true:false
logobloqueo=0;
ie4 = (document.all)? true:false
if (document.images){

    image13on = new Image();
    image13on.src = ".jpg";
    image13off = new Image();
    image13off.src = ".jpg";
}


function nav_dhtml()
{
	if (parseInt(navigator.appVersion)<4)  location="no_dhtml.html"
}

var layerRef="null",layerStyleRef="null",styleSwitch="null",layerName;
var posx,posy;
var cont=0;
var paso=0;
var bloqueo=false;

function init()
{
	
	if (navigator.appName == "Netscape")
	{
		layerStyleRef="layer.";
		layerRef="document.layers";
		styleSwitch="";
        }
	else
	{
		layerStyleRef="layer.style.";
		layerRef="document.all";
		styleSwitch=".style";
	}

	showLayer('fondo')
	showLayer('comp1')
	showLayer('comp2')
	showLayer('comp3')
	showLayer('comp6')
	showLayer('comp7')
	showLayer('noticias')
	hideLayer('loading')

}

function showLayer(layerName)
{
	eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
}


function hideLayer(layerName)
{
	eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
}


function moveLayer(layerName,left,top,trans)
{
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.top='+top);
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left='+left);
if (ie4) eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.filter="Alpha(Opacity:'+trans+')"')
} 


function animateLayer(layerName,speed,menu,xini,yini,xfin,yfin){
	
	numx = (xfin-xini>=0)? 1:-1
	numy = (yfin-yini>=0)? 1:-1
	xini1=xini
	yini1=yini
	xfin1=xfin
	yfin1=yfin
	
	
	
	if (cont==0){ moveLayer(layerName,xini,yini);showLayer(layerName)}
	if ((numy*(yini1-yfin1))<(1-speed) || (numx*(xini1-xfin1))<(1-speed))
	{
		if((numx*xini1)<xfin) xini1+=(speed*numx)
		if((numy*yini1)<yfin) yini1+=(speed*numy)
		
		var trans=10*cont
		moveLayer(layerName,xini1,yini1,trans)
		setTimeout('animateLayer("'+layerName+'","'+speed+'","'+menu+'",xini1,yini1,"'+xfin+'","'+yfin+'")',30);
		cont+=1
		
	

	}
	else
	{
		cualo=menu
		cont=0;
		moveLayer(layerName,xfin,yfin,1000)
		paso=paso+1
		if (paso<8) desplegar_def(cualo);
	}
}


function desplegar(menu)
{
menu_def=menu
if (bloqueo==false) desplegar_def(menu_def)
}

function desplegar_def(menu)
{



	if (menu=="componentes")
	{
		if(paso==0){bloqueo=true;animateLayer('componentes1',10,'componentes',10,238,10,238)}
		if(paso==1)animateLayer('componentes2',5,'componentes',100,180,100,180)
		if(paso==2)animateLayer('componentes3',5,'componentes',200,140,200,140)
		if(paso==3)animateLayer('componentes4',5,'componentes',280,120,280,120)
		if(paso==4)animateLayer('componentes5',5,'componentes',400,115,400,115)
		if(paso==5)animateLayer('componentes6',5,'componentes',500,110,500,110)
		if(paso==6)animateLayer('componentes7',5,'componentes',590,135,590,135)
		if(paso==7)animateLayer('componentes8',5,'componentes',680,195,680,195)
		if(paso==8)animateLayer('componentes9',5,'componentes',750,280,750,280)
		if(paso==9)animateLayer('componentes10',5,'componentes',10,330,10,330)
		if(paso==10)animateLayer('componentes11',5,'componentes',120,410,120,410)
		if(paso==11)animateLayer('componentes12',5,'componentes',230,430,230,430)
		if(paso==12)animateLayer('componentes13',5,'componentes',340,440,340,440)
		if(paso==13)animateLayer('componentes14',5,'componentes',460,450,460,450)
		if(paso==14)animateLayer('componentes15',5,'componentes',530,440,530,440)
		if(paso==15)animateLayer('componentes16',5,'componentes',640,410,640,410)
		if(paso==16)animateLayer('componentes17',5,'componentes',730,330,730,330)
		if(paso>=17){bloqueo=false;paso=0}		
	}
		

}

function resetear()
{
	hideLayer('componentes1')
	hideLayer('componentes2')
	hideLayer('componentes3')
	hideLayer('componentes4')
	hideLayer('componentes5')
	hideLayer('componentes6')
	hideLayer('componentes7')
	hideLayer('componentes8')
	hideLayer('componentes9')
	hideLayer('componentes10')
	hideLayer('componentes11')
	hideLayer('componentes12')
	hideLayer('componentes13')
	hideLayer('componentes14')
	hideLayer('componentes15')
	hideLayer('componentes16')
	hideLayer('componentes17')
}

// las funciones siguientes sirven para los mensajes que se muestra en la barra de estado del explorador

var speed = 20 
var pause = 5000
var timerID = null 
var bannerRunning = false 

var ar = new Array() 
ar[0] = "Bienvenido a la Web del Revés.  ¡¡Alucinarás!! " 
ar[1] = "Novedades: " 
ar[2] = "Fotos de los monumentos más representativos de Bermillo. Bermillo --> Historia" 
ar[3] = "Fotos de los bares de Bermillo. Bermillo --> Bares" 
ar[4] = "Fotos del exterior de algunas peñas. Bermillo --> Peñas" 
ar[5] = "" 
ar[6] = "" 
ar[6] = "" 

var message = 0 
var state = "" 

clearState() 

function stopBanner() { 
	if (bannerRunning) 
		clearTimeout(timerID) 

	bannerRunning = false 
} 

function startBanner() { 
	stopBanner() 
	showBanner() 
} 

function clearState() { 
	state = "" 
	for (var i = 0; i < ar[message].length; ++i) { 
		state += "0" 
	} 
} 

function showBanner() { 
	if (getString()) { 
		message++ 
		if (ar.length <= message) 
			message = 0 
		clearState() 
		timerID = setTimeout("showBanner()", pause) 
		bannerRunning = true 
	} else { 
		var str = "" 
		for (var j = 0; j < state.length; ++j) { 
			str += (state.charAt(j) == "1") ? ar[message].charAt(j) : "     " 
		} 
		window.status = str 
		timerID = setTimeout("showBanner()", speed) 
		bannerRunning = true 
	} 
} 

function getString() { 
	var full = true 
	for (var j = 0; j < state.length; ++j) { 
		if (state.charAt(j) == 0) 
			full = false 
	} 
	if (full) 
		return true 
	while (1) { 
		var num = getRandom(ar[message].length) 
		if (state.charAt(num) == "0") 
			break 
	} 
	state = state.substring(0, num) + "1" + state.substring(num + 1, state.length) 
	return false 
} 

function getRandom(max) { 
	return Math.round((max - 1) * Math.random()) 
} 

// la siguiente función sirve para abrir una ventena del tamaño deseado controlando las barras de herramientas visibles
function Abre_ventana (pagina){ventana=window.open(pagina,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=765,height=450,top=20,left=20");}

function abre_ventana_wd
(pagina){ventana=window.open(pagina,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=585,height=430,top=20,left=20");}


// la siguiente función sirve para abrir las fotos en una ventana nueva adaptada al tamaño de la foto
function abreFoto(ruta)
{
   i1 = new Image;
   i1.src = ruta;
   html = '<html><head><title>GuiaSayago. Fotografía</title></head>';
   html += '<body leftmargin=0 marginwidth=0 topmargin=0 marginheight=0>';
   html += '<center><img src="'+ruta+'" border=0 name="Foto" ';
   html += 'onLoad="window.resizeTo(document.Foto.width,document.Foto.height)">';
   html += '</center></body></html>';
   popupImage = window.open('','_blank','scrollbars=0,resizable=no');
   popupImage.document.open();
   popupImage.document.write(html);
   popupImage.document.close();
}

// las dos siguientes funciones sirven para deshabilitar el secundario del ratón
function right(e) {
if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false;
else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
alert("Peña Revés. Opción inhabilitada.");
return false;
}
return true;
}
document.onmousedown=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=right;

//la siguiente funcion sirve para evitar el spam
usuario="peniareves"
dominio="guiasayago.com"
conector="@"

function dame_correo(){
	return usuario + conector + dominio
}

function escribe_enlace_correo(){
	document.write("<a href='mailto:" + dame_correo() + "'>" + dame_correo() + "</a>")
}

