$(window).load(function(){
	delayed = setTimeout(function(){
		$('#status-container').fadeOut('slow');
		},3000);
	
	
	}); 
 $(document).ready(function() {
	

$.preloadCssImages({statusTextEl: '#textStatus', statusBarEl: '#status'});

	
 $('body').css({
			              'background': 'url(images/bg/whitemoorhouse1365x1024.jpg)no-repeat center center fixed',
						  '-webkit-background-size':'cover' ,
						  '-moz-background-size':'cover' ,
						  '-o-background-size':'cover',
						  'background-size':'cover'
	                     }).fadeIn('slow');
 	
function changeBackG(){	
if($('#diner').css('display')== 'block'){
           $('body').css({
						  'background': 'url(images/bg/diner1365x1024.jpg)no-repeat center center fixed',
						  '-webkit-background-size':'cover' ,
						  '-moz-background-size':'cover' ,
						  '-o-background-size':'cover',
						  'background-size':'cover'
	                     });
		}else if ($('#lounge').css('display')== 'block'){
		   $('body').css({
		                  'background': 'url(images/bg/lounge1365x1024.jpg)no-repeat center center fixed',
						  '-webkit-background-size':'cover' ,
						  '-moz-background-size':'cover' ,
						  '-o-background-size':'cover',
						  'background-size':'cover'
	                     });
		}else if ($('#twin').css('display')== 'block'){
		   $('body').css({
			              'background': 'url(images/bg/double1365x1024.jpg)no-repeat center center fixed',
						  '-webkit-background-size':'cover' ,
						  '-moz-background-size':'cover' ,
						  '-o-background-size':'cover',
						  'background-size':'cover'
	                     });
		}else if ($('#poster').css('display')== 'block'){
		   $('body').css({
			              'background': 'url(images/bg/poster1365x1024.jpg)no-repeat center center fixed',
						  '-webkit-background-size':'cover' ,
						  '-moz-background-size':'cover' ,
						  '-o-background-size':'cover',
						  'background-size':'cover'
	                     });             
		}else if ($('#lyndhurst').css('display')== 'block'){
		   $('body').css({
			              'background': 'url(images/bg/Boltons_Bench_Lyndhurst1365x1024.jpg)no-repeat center center fixed',
						  '-webkit-background-size':'cover' ,
						  '-moz-background-size':'cover' ,
						  '-o-background-size':'cover',
						  'background-size':'cover'
	                     });             
		}else if ($('#location').css('display')== 'block'){
		   $('body').css({
			              'background': 'url(images/bg/location1365x1024.jpg)no-repeat center center fixed',
						  '-webkit-background-size':'cover' ,
						  '-moz-background-size':'cover' ,
						  '-o-background-size':'cover',
						  'background-size':'cover'
	                     });             
		}else {
		   $('body').css({
			              'background': 'url(images/bg/whitemoorhouse1365x1024.jpg)no-repeat center center fixed',
						  '-webkit-background-size':'cover' ,
						  '-moz-background-size':'cover' ,
						  '-o-background-size':'cover',
						  'background-size':'cover'
	                     });
		}

}



//When page loads...
$('.panel').hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".panel:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".panel").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		//change backgrounds
		changeBackG();
		return false;
	});	

$("#slideshow-next").click(function() {
	if($('ul.tabs li:last').hasClass('active')){
			$(".panel").hide(); //Hide all tab content
//alert('last');   
		$('ul.tabs li:first').addClass('active');
	    $('ul.tabs li:last').removeClass('active');
 var activeTab = $('ul.tabs li.active').find('a').attr('href');//Find the href attribute value to identify the active tab + content
	$(activeTab).fadeIn(); //Fade in the active ID content
		
		
	}else {
   $('ul.tabs li.active').next('li').addClass('active').prev('li').removeClass('active');
    var activeTab = $('ul.tabs li.active').find('a').attr('href');//Find the href attribute value to identify the active tab + content
	$(".panel").hide(); //Hide all tab content
	//alert(activeTab); 
	$(activeTab).fadeIn(); //Fade in the active ID content
	}
	changeBackG();
});
$("#slideshow-prev").click(function() {
   $('ul.tabs li.active').prev('li').addClass('active').next('li').removeClass('active');
    var activeTab = $('ul.tabs li.active').find('a').attr('href');//Find the href attribute value to identify the active tab + content
	$(".panel").hide(); //Hide all tab content
	//alert(activeTab); 
	$(activeTab).fadeIn(); //Fade in the active ID content
	changeBackG();
});
////multi browser viewpoint size
// var viewportwidth;
// var viewportheight;
// 
// // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
// 
// if (typeof window.innerWidth != 'undefined')
// {
//      viewportwidth = window.innerWidth,
//      viewportheight = window.innerHeight
// }
// 
//// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
//
// else if (typeof document.documentElement != 'undefined'
//     && typeof document.documentElement.clientWidth !=
//     'undefined' && document.documentElement.clientWidth != 0)
// {
//       viewportwidth = document.documentElement.clientWidth,
//       viewportheight = document.documentElement.clientHeight
// }
// 
// // older versions of IE
// 
// else
// {
//       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
//       viewportheight = document.getElementsByTagName('body')[0].clientHeight
// }   
//
//	var winH =	viewportheight;
////alert ($('#right-col').height() +' > ' + winH );
//	 if($('#right-col').height() > winH ){
//		 $('#left-col').css('height',$('#right-col').height()+20);
//		// alert( $('#right-col').height()+' is greater than '+ winH );
//		 }else {
//			 $('#left-col').css('height','100%');
//			 }

	
//var maxHeight = 0;
//$('.desc').each(function() { 
//     maxHeight = Math.max(maxHeight, $(this).innerHeight()+20);
//	  });
//$('.desc_image').css('height', maxHeight +'px' );
//$('.desc').css('height', maxHeight +'px' );
//$('.desc-full').css('height', maxHeight +'px' );
//var marg = (maxHeight-188)/2;
//$('.desc_image img').css('margin-top',  marg +'px' );
//$('.desc_image img').css('margin-bottom',  marg +'px' );

$('.page_content .content_wrapper a').lightBox();
//slideshow
$('#slideshow .panel .desc .desc-image a.rooms').lightBox();
$('#slideshow .panel .desc .desc-image a.location').lightBox();
////$("#tab_rooms").live('click',function() {
//$("#slideshow").carouFredSel(
//{
//curcular: false,
//infinite: false,
//auto : false,
////width : 600,
//	prev : {	
//		button	: "#slideshow_prev",
//		key		: "left"
//	},
//	next : { 
//		button	: "#slideshow_next",
//		key		: "right"
//	},
//	pagination	: "#slideshow_pag"
//}
//);
//$("#slideshow").trigger("linkAnchors", "#tabs");
//});
});
