	indice = 0;
	verfoto = "false";

	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_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 changeImage(filename,indice2)
	{
	   document.grande.src = filename;
	   indice = indice2;
	   verfoto ="true";
	}

	function MM_openBrWindow(theURL,winName,features) { //v2.0
	  window.open(theURL,winName,features);
	}

	function comprueba()
	{
		document.formulario.disponibilidad.value='HOTEL SIN DISPONIBILIDAD para las fechas solicitadas';
	}


	/***********************************************
	* Tab Content script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
	* This notice MUST stay intact for legal use
	* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
	***********************************************/

	var initialtab=[1, "sc1"]

	function cascadedstyle(el, cssproperty, csspropertyNS)
	{
		if (el.currentStyle)
			return el.currentStyle[cssproperty]
		else if (window.getComputedStyle){
			var elstyle=window.getComputedStyle(el, "")
		return elstyle.getPropertyValue(csspropertyNS)
	}
	}

	var previoustab=""

	function expandcontent(cid, aobject)
	{
		if (document.getElementById)
		{
			highlighttab(aobject)
			detectSourceindex(aobject)
			if (previoustab!="")
				document.getElementById(previoustab).style.display="none"
			document.getElementById(cid).style.display="block"
			previoustab=cid
			if (aobject.blur)
				aobject.blur()
			return false
		}
		else
			return true
	}

	function highlighttab(aobject)
	{
	if (typeof tabobjlinks=="undefined")
	collecttablinks()
	for (i=0; i<tabobjlinks.length; i++)
	tabobjlinks[i].style.backgroundColor=initTabcolor
	var themecolor=aobject.getAttribute("theme")? aobject.getAttribute("theme") : initTabpostcolor
	aobject.style.backgroundColor=document.getElementById("tabcontentcontainer").style.backgroundColor=themecolor

	//AÑADIDO POR ALLEN ABRIL 2005 CAMBIA EL COLOR PESTAÑA ACTIVA
	aobject.style.backgroundColor=document.getElementById("tabcontentcontainer").style.Color="#FFFFFF"
	}

	function collecttablinks(){
	var tabobj=document.getElementById("tablist")
	tabobjlinks=tabobj.getElementsByTagName("A")
	}

	function detectSourceindex(aobject){
	for (i=0; i<tabobjlinks.length; i++){
	if (aobject==tabobjlinks[i]){
	tabsourceindex=i //source index of tab bar relative to other tabs
	break
	}
	}
	}

	function do_onload()
	{
		MM_showHideLayers('capa1','','hide');
		var cookiecheck=window.get_cookie && get_cookie(window.location.pathname).indexOf("|")!=-1
		collecttablinks()
		initTabcolor=cascadedstyle(tabobjlinks[1], "backgroundColor", "background-color")
		initTabpostcolor=cascadedstyle(tabobjlinks[0], "backgroundColor", "background-color")

		if (typeof enablepersistence!="undefined" && enablepersistence && cookiecheck)
		{
			var cookieparse=get_cookie(window.location.pathname).split("|")
			var whichtab=cookieparse[0]
			var tabcontentid=cookieparse[1]
			expandcontent(tabcontentid, tabobjlinks[whichtab])
		}
		else
			expandcontent(initialtab[1], tabobjlinks[initialtab[0]-1])
	}

	if (window.addEventListener)
	{
		window.addEventListener("load", do_onload, false)
	}
	else if (window.attachEvent)
	{
		window.attachEvent("onload", do_onload)
	}
	else if (document.getElementById)
	{
		window.onload=do_onload
	}


function fechadehoy()
{
	var fecha=new Date();

	var dia_in=fecha.getDate();
	var mes_in=fecha.getMonth()+1;
	var ano_in=fecha.getFullYear();

	var fecha_hoy=dia_in + "/" + mes_in + "/" + ano_in;

	if (mes_in==12 && dia_in==31)
		ano_value=1;
	else
	{

		switch (ano_in)
		{
			case 2007:
				ano_value=0;
				break;
			case 2008:
				ano_value=1;
				break;
			case 2009:
				ano_value=2;
				break;
			case 2010:
				ano_value=3;
				break;
			default:
				ano_value=0;
		}
	}

	document.formulario.fent_mes.selectedIndex=mes_in-1;
	document.formulario.fent_ano.selectedIndex=ano_value;
	document.formulario.fent_dia.selectedIndex=dia_in-1;

	with (document.formulario)
	{

		 var milisegundos=parseInt(1*24*60*60*1000);

		 var tiempo=fecha.getTime();
		 fecha.setTime(parseInt(tiempo+milisegundos));
		 
		 var dia_out=fecha.getDate();
		 var mes_out=fecha.getMonth();
		 var anio_out=fecha.getFullYear();

		if (dia_out==31 && mes_out==12)
			ano_out=1;
		else
		{
			ano_out=0;
		}

		document.formulario.fsal_dia.selectedIndex=dia_out-1;
		document.formulario.fsal_mes.selectedIndex=mes_out;
		document.formulario.fsal_ano.selectedIndex=ano_out;
	}

	diasemana();
}

	var aFinMes = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

	function finMes(nMes, nAno)
	{
		return aFinMes[nMes - 1] + (((nMes == 2) && (nAno % 4) == 0)? 1: 0);
	}

	function padNmb(nStr, nLen, sChr)
	{
		var sRes = String(nStr);
		for (var i = 0; i < nLen - String(nStr).length; i++)
			sRes = sChr + sRes;
		return sRes;
	}

	function makeDateFormat(nDay, nMonth, nYear)
	{
		var sRes;
		sRes = padNmb(nDay, 2, "0") + "/" + padNmb(nMonth, 2, "0") + "/" + padNmb(nYear, 4, "0");
		return sRes;
	}

	function incDate(sFec0)
	{
		var nDia = parseInt(sFec0.substr(0, 2), 10);
		var nMes = parseInt(sFec0.substr(3, 2), 10);
		var nAno = parseInt(sFec0.substr(6, 4), 10);
		nDia += 1;
		if (nDia > finMes(nMes, nAno))
		{
			nDia = 1;
			nMes += 1;
			if (nMes == 13)
			{
				nMes = 1;
				nAno += 1;
			}
		}
		return makeDateFormat(nDia, nMes, nAno);
	}

	function decDate(sFec0)
	{
		var nDia = Number(sFec0.substr(0, 2));
		var nMes = Number(sFec0.substr(3, 2));
		var nAno = Number(sFec0.substr(6, 4));
		nDia -= 1;
		if (nDia == 0)
		{
			nMes -= 1;
			if (nMes == 0)
			{
				nMes = 12;
				nAno -= 1;
			}
			nDia = finMes(nMes, nAno);
		}
		return makeDateFormat(nDia, nMes, nAno);
	}

	function addToDate(sFec0, sInc)
	{
		var nInc = Math.abs(parseInt(sInc));
		var sRes = sFec0;
		if (parseInt(sInc) >= 0)
			for (var i = 0; i < nInc; i++) sRes = incDate(sRes);
		else
			for (var i = 0; i < nInc; i++) sRes = decDate(sRes);
		return sRes;
	}

function diasemana()
{

   var salida, entrada;

   entrada=new Date(document.formulario.fent_ano[document.formulario.fent_ano.selectedIndex].text,document.formulario.fent_mes[document.formulario.fent_mes.selectedIndex].text-1,document.formulario.fent_dia[document.formulario.fent_dia.selectedIndex].text);
   salida=new Date(document.formulario.fsal_ano[document.formulario.fsal_ano.selectedIndex].text,document.formulario.fsal_mes[document.formulario.fsal_mes.selectedIndex].text-1,document.formulario.fsal_dia[document.formulario.fsal_dia.selectedIndex].text);

   var d, dia, x, diasal;
   var x = new Array("Domingo", "Lunes", "Martes");
   var x = x.concat("Miércoles","Jueves", "Viernes");
   var x = x.concat("Sábado");
   var now = new Date();

   d = entrada;
   ds = salida;

   dia = d.getDay();
   diasal = ds.getDay();

   if (diasal==7)
   {
   		diasal=0;
   }


   if (dia==7)
   {
   		dia=0;
   }

   document.formulario.diasemanaent.value=x[dia];
   document.formulario.diasemanaout.value=x[diasal];
}


function cambia_combo()
{
	entrada=new Date(document.formulario.fent_ano[document.formulario.fent_ano.selectedIndex].text,document.formulario.fent_mes[document.formulario.fent_mes.selectedIndex].text-1,document.formulario.fent_dia[document.formulario.fent_dia.selectedIndex].text);
	salida=new Date(document.formulario.fent_ano[document.formulario.fent_ano.selectedIndex].text,document.formulario.fent_mes[document.formulario.fent_mes.selectedIndex].text-1,document.formulario.fent_dia[document.formulario.fent_dia.selectedIndex].text);

	var ano_in=document.formulario.fent_ano[document.formulario.fent_ano.selectedIndex].text

	vamonos = new Date();
	ahora = new Date(vamonos.getFullYear(),vamonos.getMonth(),vamonos.getDate());

	salida.setDate(entrada.getDate()+1);

	document.formulario.fsal_dia.selectedIndex=salida.getDate()-1;
	document.formulario.fsal_mes.selectedIndex=salida.getMonth();
	document.formulario.fsal_ano.selectedIndex=salida.getFullYear()-ano_in;


	if(document.formulario.fent_ano[document.formulario.fent_ano.selectedIndex].text == ahora.getFullYear())
	{
			if (document.formulario.fent_mes[document.formulario.fent_mes.selectedIndex].text < ahora.getMonth() )
			{
				document.formulario.fsal_ano.selectedIndex = 1;
				document.formulario.fent_ano.selectedIndex = 1;
			}else
			{
				document.formulario.fsal_ano.selectedIndex = 0;
				document.formulario.fent_ano.selectedIndex = 0;
			}
	}

}

function calendario_in()
{
	window.open('calendario/calendarioentrada.htm','Entrada','scrollbars=no,resizable=yes,width=250,height=200,top=200,left=400')
}

function calendario_out()
{
	win=window.open('calendario/calendariosalida.htm','Salida','scrollbars=no,resizable=yes,width=250,height=200,top=200,left=400')
}


function valida_fechas()
{

	var entrada=new Date(document.formulario.fent_ano[document.formulario.fent_ano.selectedIndex].text,document.formulario.fent_mes[document.formulario.fent_mes.selectedIndex].text-1,document.formulario.fent_dia[document.formulario.fent_dia.selectedIndex].text);
	var salida=new Date(document.formulario.fsal_ano[document.formulario.fsal_ano.selectedIndex].text,document.formulario.fsal_mes[document.formulario.fsal_mes.selectedIndex].text-1,document.formulario.fsal_dia[document.formulario.fsal_dia.selectedIndex].text);
 	var hoy=new Date();

	if((salida.getDate() < entrada.getDate()+1) && (salida.getMonth() <= entrada.getMonth()) && (salida.getFullYear() <= entrada.getFullYear()))
	{
		alert('La fecha de SALIDA no es válida');
	}else
	{
		var diff = new Date();
		diff.setTime(entrada.getTime() - hoy.getTime());
		timediff = diff.getTime();
		days = Math.floor(timediff / (1000 * 60 * 60 * 24));
		timediff -= days * (1000 * 60 * 60 * 24);


		if (days<-1)
		{
			alert('La fecha es anterior a la de hoy');
		}
		else{

		var diff = new Date();
		diff.setTime(Math.abs(entrada.getTime() - salida.getTime()));

		timediff = diff.getTime();

		//days = Math.floor(timediff / (1000 * 60 * 60 * 24));
		days = Math.round(timediff / (1000 * 60 * 60 * 24));
		timediff -= days * (1000 * 60 * 60 * 24);

		//alert(days + ' ' + entrada.getDate() + ' ' + salida.getDate()  );

			if (days !=0) {

				if (days <= 7) {
					if (document.formulario.provincia.value!="seleccionar")
					{
							document.formulario.submit();
					}
					else
					{
						alert('DEBES SELECCIONAR UNA PROVINCIA');

					}
				}else
				{
					alert('Para estancias superiores a 7 dias póngase en contacto con nuestro Departamento de Reservas en el 902 101 478, Lunes a Viernes de 9 a 18 horas.');
				}

			}else
			{
				alert('Introdujo un intervalo de fechas incorrecto');
			}
		}
	}
}

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);
