$(window).resize(function(){	
		//	cufon_types();	
	});

 $(document).ready(function(){	
		//	cufon_types();
			reserve();
			rooms_list();
			restaurant();
// Cufon.now();			
// CufonShow();
	});
 
function reserve(){
	if($(".reserve").length){
		if(!$(".reserve .idatein .input_date").val()&&!$(".reserve .idateout .input_date").val())
			{			
				var d = new Date();
				d_d = d.getDate()*1;
				if(d_d<10) d_d = "0"+d_d;

				d_m = d.getMonth()*1+1;
				if(d_m<10) d_m = "0"+d_m;

				d_y = d.getFullYear()*1;
				showdate = d_d+"."+d_m+"."+d_y;
				showdate_i = d_y+"-"+d_m+"-"+d_d;
				
				
				var d2 = addDays(d,1);
				d_d2 = d2.getDate()*1;
				if(d_d2<10) d_d2 = "0"+d_d2;
				
				d_m2 = d2.getMonth()*1+1;
				if(d_m2<10) d_m2 = "0"+d_m2;
				
				d_y2 = d2.getFullYear()*1;

				showdate2 = d_d2+"."+d_m2+"."+d_y2;
				//showdate2_i = d_y+"-"+d_m+"-"+d_d2;
				$(".reserve .idatein .input_date").val(showdate);
				$(".reserve .it_datein").val(showdate_i);
				
				$(".reserve .idateout .input_date").val(showdate2);
				//$(".reserve .it_dateout").val(showdate2_i);
				$(".reserve .it_dateout").val(1);
				//alert(showdate);
				//alert(showdate_i);
			}		
		}
	}

function addDays(date, n) {
	var d = new Date();	
	d.setTime(date.getTime() + n * 24 * 60 * 60 * 1000);
	return d;
}

function CheckDates(){
		var datein = $(".reserve .inputdiv.idatein .input_date").val();
		var dateout = $(".reserve .inputdiv.idateout .input_date").val();
		d_i = datein.split(".");
		date_in = d_i[2]+"-"+d_i[1]+"-"+d_i[0];
		date_in_a = new Date(d_i[2], d_i[1], d_i[0]);
		
		d_o = dateout.split(".");
		//date_out = d_o[2]+"-"+d_o[1]+"-"+d_o[0];
		date_out_a = new Date(d_o[2], d_o[1], d_o[0]);
		
		msPerDay = 24 * 60 * 60 * 1000;
		daysLeft = (date_out_a.getTime() - date_in_a.getTime()) / msPerDay;
		//alert(daysLeft);
		if(daysLeft<1) {
			/**/
			var d = new Date();
			d_d = d.getDate()*1;
			var date = new Date();	
			date.setDate(d_i[0]);
			date.setMonth(d_i[1]*1-1);
			date.setFullYear(d_i[2]);
			/**/
			var date2 = addDays(date,1);
			
			//ndate = ((d_i[0]*1)+1)+"."+d_i[1]+"."+d_i[2];
			nd_day = date2.getDate()*1;
			if(nd_day<10) nd_day = "0"+nd_day;
			
			nd_mnth = date2.getMonth()*1+1;
			if(nd_mnth<10) nd_mnth = "0"+nd_mnth;
			
			nd_year = date2.getFullYear()*1;
			
			ndate = nd_day+"."+nd_mnth+"."+nd_year;
			$(".reserve .inputdiv.idateout .input_date").val(ndate);
			daysLeft = 1;
			}
			
		$(".reserve .it_datein").val(date_in);
		$(".reserve .it_dateout").val(daysLeft);	
		s_date = nd_day+"/"+nd_mnth+"/"+nd_year;
		$('#inputDate2').dpSetSelected(s_date);
	}

function restaurant(){
	$(".restaurant .preview .thumb").click(function(){
			$(this).parents(".restaurant").find(".preview .thumb .th_act").removeClass("th_act");
			var phbig = $(this).find(".bigph").html();
			$(this).parents(".restaurant").find(".preview .big").html(phbig);
			$(this).find("img").toggleClass("th_act");
		});
	}

function rooms_list(){
		$(".roomc .name span").click(function(){
		//	$(".roomc.r_open").removeClass("r_open");
			$(this).parents(".roomc").toggleClass("r_open");
	   });
		$(".roomc .preview img").click(function(){
		//	$(".roomc.r_open").removeClass("r_open");
			$(this).parents(".roomc").toggleClass("r_open");
	   });
	   $(".restc .more span").click(function(){
			$(this).parents(".restc ").addClass("r_detail");
	   });
	   $(".restc .hidelink span").click(function(){
			$(this).parents(".restc ").removeClass("r_detail");
	   });		
	}

function CufonShow(){

        
        $("h1").css("visibility","visible"); 
	$(".cufon").css("visibility","visible");
$("h1").toggleClass("visible");
$(".cufon").toggleClass("visible");

	Cufon.replace('h1'); 
	Cufon.replace('.cufon'); 
	 }            

