ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;

function EsconderLayers()
{
 var lista=new Array('LayerDescripcion','LayerReservar','LayerComentarios','LayerImagenes');
 for(var i=0; i<lista.length;i++)
 {
	if (ns4) 	{document.getElementById(lista[i]).display ="none";		}
	if (ie4) 	{document.getElementById(lista[i]).style.display = "none";		}
	document.getElementById(lista[i]).style.display = "none";
 }
}

function MostrarLayer(Nombre)
{
	EsconderLayers();
	if (ns4) 	{document.getElementById("Layer"+Nombre).display ="";	}
	if (ie4) 	{document.getElementById("Layer"+Nombre).style.display = "";	}
	document.getElementById("Layer"+Nombre).style.display = "";
}

function EsconderLayersHistoria()
{
 var lista=new Array('LayerGuayangareo','LayerValladolid','LayerCiudadReligiosa','LayerArquitectura','LayerMoreliaContemporanea','LayerMoreliaSigloXX');
 for(var i=0; i<lista.length;i++)
 {
	if (ns4) 	{document.getElementById(lista[i]).display ="none";		}
	if (ie4) 	{document.getElementById(lista[i]).style.display = "none";		}
	document.getElementById(lista[i]).style.display = "none";
 }
}

function MostrarLayerHistoria(Nombre)
{
	EsconderLayersHistoria();
	if (ns4) 	{document.getElementById("Layer"+Nombre).display ="";	}
	if (ie4) 	{document.getElementById("Layer"+Nombre).style.display = "";	}
	document.getElementById("Layer"+Nombre).style.display = "";
}

function enviarReservacion()
{
	var obj;
  MM_validateForm('Nombre','Name and Last Name','R','Ciudad','City','R','CodigoPostal','Zip Code','NisNum','Telefono','Phone','R','CorreoElectronico','E-mail','NisEmail','FechaLLegada','Arrive Date','R','FechaSalida','Departure Date','R','NumeroHabitaciones','No. Rooms','RisNum','NumeroAdultos','Adults','RisNum','NumeroNinos','Childrens','RisNum');
  obj=document.MM_returnValue;
	if(obj)
	{
		var myDate3 = new Date()
		var myDate4 = new Date()
		FechaUsuario3 = document.getElementById('FechaLLegada').value
		FechaUsuario4 = document.getElementById('FechaSalida').value
		diamesanio = FechaUsuario3.split("/")
		dia = diamesanio[0]
		mes = diamesanio[1]
		ani = diamesanio[2]
		mes = mes - 1
		myDate3.setFullYear(ani,mes,dia)
		diamesanio = FechaUsuario4.split("/")
		dia = diamesanio[0]
		mes = diamesanio[1]
		ani = diamesanio[2]
		mes = mes - 1
		myDate4.setFullYear(ani,mes,dia)
		var Alto, Alarma
			Alarma = ""
			Alto =1
			
		if (myDate3 > myDate4)
		{
			Alarma = Alarma + "\n- The departure date is not correct"
			Alto=0
		}
		if(document.formReservar.securityCode.value != frmCodigo.document.formaCodigo.strCodigo.value)
		{
			Alarma = Alarma + "\n- The code does not match";
			Alto=0
		}
		if (Alto==1)
		{
			document.formReservar.submit();
		}
		else
		{
			alert("Errors:" + Alarma)	
		}
	}
}

function enviarReservacion2()
{
	var obj;
	var Alto, Alarma;
	Alarma = "";
	Alto = 1;

  MM_validateForm('Nombre','Name','R','CorreoElectronico','e-mail','RisEmail','FechaLLegada','Reservation date','R','NumeroAdultos','N People','RisNum');
  obj=document.MM_returnValue;
  if(obj) 
  {
		var myDate3 = new Date()
		var myDate4 = new Date()
		FechaUsuario3 = document.getElementById('FechaLLegada').value
		if(document.formReservar.securityCode.value != frmCodigo.document.formaCodigo.strCodigo.value)
		{
			Alarma = Alarma + "\n- The code does not match\n";
			Alto=0
		}
		if (Alto==1)
		{
			document.formReservar.submit();
		}
		else
		{
			alert("Errors:" + Alarma)	
		}
	}
}

function enviarComentario()
{
	var obj;
	MM_validateForm('NombreComentario','Name','R','Comentario','Comentary','R');
  obj=document.MM_returnValue;
  if(obj) document.formComentario.submit();
}

function enviarComentario2()
{
	var obj;
	MM_validateForm('NombreComentario','Name','R','Comentario','Comentary','R','CorreoElectronicoComentario','e-mail','RisEmail');
  obj=document.MM_returnValue;
  if(obj) document.formComentario.submit();
}

function enviarContacto()
{
	var obj;
	MM_validateForm('Nombre','Fullname','R','Edad','Age','RisNum','Ciudad','City','R','Telefono','Phone','R','email','E-mail','RisEmail','comentario','Commentary','R');
  obj=document.MM_returnValue;
  if(obj) document.form1.submit();
}

function enviarEvento()
{
	var obj;
	MM_validateForm('FechaInicio','Date Beging','R','FechaFinal','Date Finished','R');
  obj=document.MM_returnValue;
  if(obj) document.formEventos.submit();
}

function AgregarPaginaInicio()
{
obj_pagina_inicio.style.behavior='url(#default#homepage)';
obj_pagina_inicio.setHomePage('http://www.visitmorelia.com');
}

function enviarRecomendacionAmigo()
{
	var obj;
	MM_validateForm('Nombre','Your Name','R','CorreoElectronico','Your E-mail address','RisEmail','NombreDestino','Name your Friend','R','CorreoElectronicoDestino','E-mail address your Friend','RisEmail');
obj=document.MM_returnValue;
  if(obj) document.form1RecomendarAmigo.submit();
}