/*SHADOWBOX Options*/
var shadowbox_options = {
	handleOversize:		'resize',
	displayNav:         true,
	autoplayMovies:     false,
	initialWidth:		66,
	initialHeight:		66,
	resizeDuration:		0.40,
	fadeDuration:		0.40,
	overlayOpacity:		0.7,
	overlayColor:		'#000000',
	counterType:		'skip',
	counterLimit:		15,
	scrolling:          'NO'
	
};

function reservar()
{
	var d=document.formres;
	var bien=true;
	var hotel=d.idhotel.value;
	var fechaini=d.fechain.value;
	var noches=d.noches.value;
	var habitaciones=d.rooms.value;
	var adultos=d.adults.value;
	
	if (d.children!=null) ninos=d.children.value;
	if (bien && hotel=="")
	{
		bien=false;
		alert("Choose an Hotel");
	}

	if (bien && fechaini=="")
	{
		bien=false;
		alert("Choose a date of arrival");
	}
	if (bien && noches=="")
	{
		bien=false;
		alert("Selecciona una fecha de salida");
	}	
	if (bien && adultos=="")
	{
		bien=false;
		alert("Selecciona un número de adultos");
	}
	if (bien && habitaciones=="")
	{
		bien=false;
		alert("Selecciona un número de habitaciones");
	}	
	
	if (bien)
	{
	
		window.open("https://booking.ihotelier.com/istay/istay.jsp?DateIn="+escape(fechaini)+"&Length="+noches+"&Adults="+adultos+"&Rooms="+habitaciones+"&Children="+ninos+"&HotelID="+hotel+"&languageid=1");
	}
}
function cancelar()
{ 	
	var d=document.formres;
	var bien=true;
	var hotel=d.idhotel.value;
	if (bien && hotel=="")
	{
		bien=false;
		alert("Choose an Hotel");
	}
	if (bien)
	{	
		window.open("http://booking.ihotelier.com/istay/istay.jsp?hotelid="+hotel+"&languageID=1");
	}
}

/* DATEPICKER */
function openDatePicker(ci,hoy,ruta) {	
//alert(ruta);
	$('#'+ci).datepicker({
		showOn: 'both', 
		buttonImage: ruta+'content/imgs/calendar1.gif',
		buttonImageOnly: true,
		minDate: 0,
		onSelect: function(dateText, inst) {
			//updateSalida("#"+cf,$('#'+ci).datepicker("getDate"))
			$('#'+ci).css("border","1px solid #939495")
		}
	});	
}
function updateSalida(id,date){	
	var one_day=24*60*60*1000
	$(id).datepicker('option','minDate',new Date(date.getTime()+one_day));
	$(id).datepicker('option','maxDate',new Date(date.getTime()+one_day*360));
		  
	//Hacemos que se seleccione la fecha de salida un dia despues
	var new_salida=new Date(date.getTime())
	
	if(new_salida>=$(id).datepicker('getDate')){
		$(id).datepicker('setDate',new Date(date.getTime()+one_day*1));
	}
}
function showDatePicker(ci,hoy,ruta) {			
	$('#'+ci).datepicker({
		showOn: 'both', 
		buttonImage: ruta+'content/imgs/bot/calendar.gif',
		buttonImageOnly: true,
		changeYear: true,
		yearRange: 'c-50:c',
		onSelect: function(dateText, inst) {
			/*updateSalida("#"+cf,$('#'+ci).datepicker("getDate"))*/
			$('#'+ci).css("border","1px solid #939495")
		}
	});	
}


function pngFIX(){
	
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

if ((version >= 5.5) && (document.body.filters)) 
{
   for(var i=0; i<document.images.length; i++)
   {
      var img = document.images[i]
      var imgName = img.src.toUpperCase()
      if (img.className=="pngfix" )
      {
         var imgID = (img.id) ? "id='" + img.id + "' " : ""
         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
         var imgStyle = "display:inline-block;" + img.style.cssText 
         if (img.align == "left") imgStyle = "float:left;" + imgStyle
         if (img.align == "right") imgStyle = "float:right;" + imgStyle
         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
         var strNewHTML = "<span " + imgID + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
         img.outerHTML = strNewHTML
		 i = i-1
      }
   }
   
   var imagenes=$("input.pngfix").get();
	
   for(var i=0; i<imagenes.length; i++)
   {
      var img = imagenes[i]
      var imgName = img.src.toUpperCase()

         var imgID = (img.id) ? "id='" + img.id + "' " : ""
         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
         var imgStyle = "display:inline-block;" + img.style.cssText 
         if (img.align == "left") imgStyle = "float:left;" + imgStyle
         if (img.align == "right") imgStyle = "float:right;" + imgStyle
         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
         var strNewHTML = "<span " + imgID + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
         img.outerHTML = strNewHTML
		 i = i-1

   }
}
}
