<!--
function vertarjeta(tarjeta,idioma)
{ nancho=710; nalto=650;
 var theURL="tarjeta_"+tarjeta+"_"+idioma+".php";
  var winName="tarjetas";
  var features="scrollbars=yes,width="+nancho+",height="+nalto;
  var _W=window.open(theURL,winName,features); 
   _W.focus(); 
    iz=(screen.width-nancho) / 2;
    de=(screen.height-nalto) / 2;
    _W.moveTo(iz,de);	
	
	}

//-----------------------------------------------------------------------------------------------------------------	

function montajes(montaje,idioma)
{ nancho=510; nalto=600;
 var theURL="montajes.php?id="+montaje+"&idioma="+idioma;
  var winName="montaje";
  var features="scrollbars=yes,width="+nancho+",height="+nalto;
  var _W=window.open(theURL,winName,features); 
   _W.focus(); 
    iz=(screen.width-nancho) / 2;
    de=(screen.height-nalto) / 2;
    _W.moveTo(iz,de);	
	
	}
	
//-----------------------------------------------------------------------------------------------------------------	

function vProm(img,ancho,alto)
{ nancho=ancho+25; nalto=alto+25;
 var theURL="imagenes/"+img;
  var winName="promo";
  var features="scrollbars=yes,width="+nancho+",height="+nalto;
  var _W=window.open(theURL,winName,features); 
   _W.focus(); 
    iz=(screen.width-nancho) / 2;
    de=(screen.height-nalto) / 2;
    _W.moveTo(iz,de);	
	
	}
	
//-----------------------------------------------------------------------------------------------------------------	

	var MINUTE = 60 * 1000;
	var HOUR = MINUTE * 60;
	var DAY = HOUR * 24;
	var LMONTH = -1;

	function change_date(form, input, date) {
		form['profile[' + input + '][day]'].selectedIndex = date.getDate() - 1;
		form['profile[' + input + '][month]'].selectedIndex = LMONTH = date.getMonth();
		form['profile[' + input + '][year]'].selectedIndex = date.getFullYear() - mianio;
		days(form, input);
	}

	function set_date(form, input, date) {
		var i = date.split('/');
		var date = new Date(i[2], i[1] - 1, i[0]);
		if (input == 'from') input = 'from_stamp';
		else input = 'to_stamp';
		change_date(form, input, date); nights(form);
	}

	function days(form, input) {
		var day = form['profile[' + input + '][day]'];
		var month = form['profile[' + input + '][month]'].value - 1;
		var year = form['profile[' + input + '][year]'].value;
		var selected = day.value;
		/* 28 a 31 días */
		var value = 31; do {
			var date = new Date(year, month, value--);
		} while (month < date.getMonth());
		/* Actualiza el selector */
		while (day.options.length) day.options[0] = null;
		for (i = 1; i < value + 2; i++) {
			option = new Option(((i > 9) ? i : '0' + i), i, false, false);
			day.options[j = day.length] = option;
			if (i == selected) day.selectedIndex = j;
		}
	}

	function nights(form) {
		var today = new Date(); var tmp = new Date(today.getFullYear(), today.getMonth(), today.getDate()); today = tmp;
		var from = new Date(form['profile[from_stamp][year]'].value, form['profile[from_stamp][month]'].value - 1, form['profile[from_stamp][day]'].value);
		var to = new Date(form['profile[to_stamp][year]'].value, form['profile[to_stamp][month]'].value - 1, form['profile[to_stamp][day]'].value);
		if (from < today || isNaN(from)) {
			tmp1 = parseInt(from.getMonth()); tmp2 = parseInt(LMONTH);
			from = (tmp1 == tmp2) ? new Date(form['profile[from_stamp][year]'].value, form['profile[from_stamp][month]'].value, form['profile[from_stamp][day]'].value) : today;
			if (from < today) from = today;
		}
		if (to <= from || isNaN(to)) to = new Date(from.getTime() + DAY);
		change_date(form, 'from_stamp', from);
		change_date(form, 'to_stamp', to);
		if (Math.round((to.getTime() - from.getTime()) / DAY) > 31) {
			to = new Date(from.getTime() + DAY * 31);
			change_date(form, 'to_stamp', to);
		}
		form["profile[nights]"].value = Math.round((to.getTime() - from.getTime()) / DAY);
	}

	function change_month(form, input) {
		return form['profile[' + input + '][day]'].value + '/' + form['profile[' + input + '][month]'].value + '/' + form['profile[' + input + '][year]'].value;
	}

	function add_nights(form, nights) {
		var from = new Date(form['profile[from_stamp][year]'].value, form['profile[from_stamp][month]'].value - 1, form['profile[from_stamp][day]'].value);
		if (nights < 1) { form["profile[nights]"].value = nights = 1; }
		if (nights > 31) { form["profile[nights]"].value = nights = 31; }
		var to = new Date(from.getTime() + (DAY * nights));
		change_date(form, 'to_stamp', to);
	}
// -->

// JavaScript Document


function cerrarImagen()
{
	document.getElementById('imagen').innerHTML='';
	document.getElementById('divimg').style.display='none';	

	
	}
function verFoto(foto)
{
	

	document.getElementById('imagen').innerHTML='<img src="images/galeria/'+foto+'.jpg">';
	document.getElementById('divimg').style.display='block';
	document.location.href='#ancla';
	
	}
 //*************************************************************************************************************************
  function Galeria(img,id,secc,idioma)  { 
  
 
  var theURL="galeria.php?img="+img+"&id="+id+"&secc="+secc+"&idioma="+idioma;
  var winName="IntGaleria";
  var features="scrollbars=yes,width=750,height=580";

           var _W=window.open(theURL,winName,features); 

           _W.focus(); 
 
	iz=(screen.width-750) / 2;
    de=(screen.height-580) / 2;

       _W.moveTo(iz,de);

 }



  function Foto(img,ver,idioma)  { 
  
 
  var theURL="foto.php?ver="+ver+"&img="+img+"&idioma="+idioma;
  var winName="IntGaleria";
  var features="scrollbars=yes,width=750,height=580";

           var _W=window.open(theURL,winName,features); 

           _W.focus(); 
 
	iz=(screen.width-750) / 2;
    de=(screen.height-580) / 2;

       _W.moveTo(iz,de);

 }


 //*************************************************************************************************************************
function cerrar(){
//setInterval("xajax_MostrarDestacado();",10000);
setTimeout("cerraventana();",4000);
}
function cerraventana(){	window.close();	}
 //*************************************************************************************************************************

function AgregarAFavoritos(){ 

	var url="http://reefyucatan.com";
	var titulo="Hotel Reef Yucatán";

    if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) { 


       window.external.AddFavorite(url,titulo); 

    } 

    else { 

       if(navigator.appName == "Netscape") 

          alert ("Presione Crtl+D para agregar este sitio en sus Bookmarks"); 

    } 

 } 
 
 
 //*************************************************************************************************************************
 
 function checkEnviarAmigo(idioma)
						{
						

if(document.form.nombre.value==""){ alertaAmigo(idioma); document.form.nombre.focus();}
else if(document.form.email.value==""){ alertaAmigo(idioma); document.form.email.focus();}
else if(!check_email(document.form.email.value)){ alertaEmail(idioma); document.form.email.focus();}
else if(document.form.anombre.value==""){ alertaAmigo(idioma); document.form.anombre.focus();}
else if(document.form.aemail.value==""){ alertaAmigo(idioma); document.form.aemail.focus();}
else if(!check_email(document.form.aemail.value)){ alertaEmail(idioma); document.form.aemail.focus();}
else if(document.form.comentario.value==""){ alertaAmigo(idioma); document.form.comentario.focus();}
else{
document.form.submit();
}
						}
						
		
		
 function checkEnviarComentario(idioma)
						{
						

if(document.form.nombre.value==""){ alertaAmigo(idioma); document.form.nombre.focus();}
else if(document.form.email.value==""){ alertaAmigo(idioma); document.form.email.focus();}
else if(!check_email(document.form.email.value)){ alertaEmail(idioma); document.form.email.focus();}
else if(document.form.pais.value==""){ alertaAmigo(idioma); document.form.pais.focus();}
else if(document.form.comentario.value==""){ alertaAmigo(idioma); document.form.comentario.focus();}
else{
document.form.submit();
}
						}		
						
						
function alertaAmigo(idioma)						
{
	if(idioma=='esp')
	alert("Por favor, llene todos los campos");
	else
	alert("Please, fills all the fields ");
	
}
function alertaEmail(idioma)
{
	if(idioma=='esp')
	alert("Por favor, proporcione un E-Mail válido");
	else
	alert("Please, write a valid email");
	
}
						
 //*************************************************************************************************************************

 
  function recomendar(idioma)  { 
  
 
  var theURL="recomendar/enviaraunamigo.php?idioma="+idioma;
  var winName="InterfaceAmigo";
  var features="scrollbars=no,width=590,height=490";

           var _W=window.open(theURL,winName,features); 

           _W.focus(); 

       iz=(screen.width-590) / 2;
    de=(screen.height-490) / 2;

       _W.moveTo(iz,de);

 }


  function comentario(idioma)  { 
  
 
  var theURL="comentario/comentar.php?idioma="+idioma;
  var winName="InterfaceComentar";
  var features="scrollbars=no,width=590,height=385";

           var _W=window.open(theURL,winName,features); 

           _W.focus(); 

       iz=(screen.width-590) / 2;
    de=(screen.height-490) / 2;

       _W.moveTo(iz,de);

 }


//*************************************************************************************************************************
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 enviarReservacion(theForm)

{

  if (theForm.Nombre.value == "")
  { alert("Por favor escriba su nombre.");
    theForm.Nombre.focus();
  }else if (theForm.Nombre.value.length < 5)
  {
    alert("Por favor escriba almenos 5 caracteres en el campo Nombre.");
    theForm.Nombre.focus();
  }
  else if (theForm.Email.value == "")
  {
    alert("Por favor escriba su E-Mail.");
    theForm.Email.focus();
 }
  else if (theForm.Email.value.length < 5)
  {
    alert("Por favor escriba almenos 5 caracteres en el campo E-Mail");
    theForm.Email.focus();
  }
  else{
	  document.form1.submit();
	  }
}

//*************************************************************************************************************************


function check(idioma)
			{

			
			if(document.form.Nombre.value==""){ alertaAmigo(idioma); document.form.Nombre.focus(); }
			else if(document.form.Apellidos.value==""){ alertaAmigo(idioma); document.form.Apellidos.focus(); }
			else if(document.form.Email.value==""){ alertaAmigo(idioma); document.form.Email.focus(); }			
			else if(!check_email(document.form.Email.value)){ alertaEmail(idioma); document.form.Email.focus();}
			else if(document.form.Telefono.value==""){ alertaAmigo(idioma); document.form.Telefono.focus(); }			
			else if(document.form.Comentarios.value==""){ alertaAmigo(idioma); document.form.Comentarios.focus(); }						
			else
			{
			document.form.submit();
			}
			
			}
			
			
			
			
			function check_email(e) { 
ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM"; 

for(i=0; i < e.length ;i++){ 
if(ok.indexOf(e.charAt(i))<0){ 
return (false); 
} 
} 

if (document.images) { 
re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/; 
re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/; 
if (!e.match(re) && e.match(re_two)) { 
return (-1); 
} 

} 

}


//*************************************************************************************************************************

function vergaleria(foto)
{
	
	
	           var _W=window.open('images/xga_'+foto+'.jpg','galeria','scrollbars=yes,width=480,height=380'); 

           _W.focus(); 

       _W.moveTo(20,20); 
	
	}
	
	
//*************************************************************************************************************************	
	
  
function checkReservacion(idioma)

{
  if (document.form1.Nombre.value == "")
  {
//    alert("Please enter a value for the \"Nombre\" field.");
			if(idioma=='esp')
			alert("Por favor escriba su nombre.");
			else
			alert("Please,  write your name.");
			
    document.form1.Nombre.focus();
  }
else if (document.form1.Nombre.value.length < 5)
  {
    		if(idioma=='esp')
			alert("Por favor escriba almenos 5 caracteres en el campo Nombre.");
			else
		    alert("Please,  write at least 5 characters in the field Name.");			
			
   document.form1.Nombre.focus();
  }
  else if (document.form1.Email.value == "")
  {
	  
			if(idioma=='esp')
    		alert("Por favor escriba su E-Mail.");
			else
			alert("Please,  write your E-Mail.");
			
    document.form1.Email.focus();
  }
  else if (document.form1.Email.value.length < 5)
  {
    		if(idioma=='esp')
			alert("Por favor escriba almenos 5 caracteres en el campo E-Mail.");
			else
		    alert("Please,  write at least 5 characters in the field E-Mail.");
			
			
    document.form1.Email.focus();
  }

else if(!check_email(document.form1.Email.value)){ alertaEmail(idioma); document.form1.Email.focus();}

  else{
  document.form1.submit();
	  }
}

