arrayEnlaces=new Array("enlace1","enlace2","enlace3","enlace4");
arrayAyudas=new Array("ayuda1","ayuda2","ayuda3","ayuda4");

function cambiaFondo(id) {
	quitaFondo();
	var elemento = document.getElementById(arrayEnlaces[id]);
    var capaAyuda = document.getElementById(arrayAyudas[id]);
	elemento.style.background="#8A4500";
	elemento.style.color="#261200";
    capaAyuda.style.visibility = "visible";
 }
function quitaFondo() {
	for (n=0;n<arrayEnlaces.length;n++) {
	    var elemento = document.getElementById(arrayEnlaces[n]);
		var capaAyuda = document.getElementById(arrayAyudas[n]);
		elemento.style.background="transparent";
		elemento.style.color="#8A4500";
	    capaAyuda.style.visibility = "hidden";
	}
 }

function creaPagina() {
document.write("<div id='logo' title='Hostal Mayno, Pastrana'></div>");
document.write("<div id='enlaces'>");
document.write("	<a class='enlaces' onMouseOver='javascript:cambiaFondo(0);' onMouseOut='javascript:quitaFondo();' href='hostal-pastrana.html' id='enlace1'>&nbsp;inicio&nbsp;</a>|");
document.write("	<a class='enlaces' onMouseOver='javascript:cambiaFondo(1);' onMouseOut='javascript:quitaFondo();' href='historia.html' id='enlace2'>&nbsp;historia&nbsp;</a>|");
document.write("	<a class='enlaces' onMouseOver='javascript:cambiaFondo(2);' onMouseOut='javascript:quitaFondo();' href='situacion.html' id='enlace3'>&nbsp;situaci&oacute;n&nbsp;</a>|");
document.write("	<a class='enlaces' onMouseOver='javascript:cambiaFondo(3);' onMouseOut='javascript:quitaFondo();' href='servicios.html' id='enlace4'>&nbsp;servicios&nbsp;</a>|");
//document.write("	<a class='enlaces' onMouseOver='javascript:cambiaFondo(4);' onMouseOut='javascript:quitaFondo();' href='fotografias.html' id='enlace5'>&nbsp;fotograf&iacute;as&nbsp;</a>");
document.write("</div>");
document.write("<div id='ayuda'>");
document.write("<div id='ayuda1' class='ayuda'>Ir a la p&aacute;gina principal</div>");
document.write("<div id='ayuda2' class='ayuda'>Aprender algo acerca de la historia de Pastrana</div>");
document.write("<div id='ayuda3' class='ayuda'>Situaci&oacute;n del hostal y plano de acceso</div>");
document.write("<div id='ayuda4' class='ayuda'>Servicios ofrecidos en nuestro hostal</div>");
//document.write("<div id='ayuda5' class='ayuda'>Vistas de Pastrana</div>");
document.write("</div>");
document.write("<div id='imgGrande'></div>");
document.write("<div id='imgPeq'></div>");
document.write("<div id='pastrana' title='Pastrana'></div>");
//document.write("<div id='pie'>");
//document.write("	Hostal Mayno, Carretera de Taranc&oacute;n N&ordm; 1, 19100 PASTRANA, Guadalajara, Tlf: 949 371 026");
//document.write("</div>");

}

function showPic (whichpic) {
 if (document.getElementById) {
  document.getElementById('placeholder').src = whichpic.href;
  if (whichpic.title) {
   document.getElementById('desc').childNodes[0].nodeValue = whichpic.title;
  } else {
   document.getElementById('desc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
  }
  return false;
 } else {
  return true;
 }
}

function centradoPagina(accion) {
	var alto,ancho;
	var altoUtil, anchoUtil;
	var altoDiv, anchoDiv;
	var topFinal, leftFinal;

	if (screen.width<=800)
		return;
	
	// Tamaņo util entre 2 
	altoUtil=parseInt(document.body.clientHeight/2);
	anchoUtil=parseInt(document.body.clientWidth/2);
	// Tamaņo de la capa "contenedor"
	altoDiv=parseInt(document.getElementById('todo').clientHeight/2);
	anchoDiv=parseInt(document.getElementById('todo').clientWidth/2);
	topFinal=altoUtil-altoDiv;
	leftFinal=anchoUtil-anchoDiv;
	document.getElementById('todo').style.left=leftFinal;
	if (accion=="") {
		document.getElementById('todo').style.top=10;
	} else {
		document.getElementById('todo').style.top=topFinal;
	}	
}


function initImagePeq(src) {
	if (n<fotosPeq.length-1) {
		n++;
	} else {
		n=0;
	}
  imageId = 'thephoto';
  image = document.getElementById(imageId);
  image.src=src;
  setOpacity(image, 0);
  image.style.visibility = 'visible';
  fadeIn(imageId,0);
  window.setTimeout("initImagePeq('"+fotosPeq[n]+"')", 4000);
}
function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 10;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
    }
  }
}
