


 



$(function() {
	var $mainNav = $('#main-nav'),
	navWidth = $mainNav.width();
	
	$mainNav.children('.main-nav-item').hover(function(ev) {
		var $this = $(this),
		$dd = $this.find('.main-nav-dd');
		
		// get the left position of this tab
		var leftPos = $this.find('.main-nav-tab').position().left;
		
		// get the width of the dropdown
		var ddWidth = $dd.width(),
		leftMax = navWidth - ddWidth;
		
		// position the dropdown
		$dd.css('left', Math.min(leftPos, leftMax) );
		
		// show the dropdown
		
		
		$this.addClass('main-nav-item-active');
	}, function(ev) {

		// hide the dropdown
		$(this).removeClass('main-nav-item-active');
		
	});
});




/*
 * Image preview script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
 
this.imagePreview = function(){	
	/* CONFIG */
		
		xOffset = 30;
		yOffset = 40;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	$("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='preview'><img src='"+ this.rel +"' alt='Image preview' />"+ c +"</p>");								 
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.show();						
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
    });	
	$("a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


// starting the script on page load
$(document).ready(function(){
	imagePreview();
});












// RANDOM MAIN BG CHANGER------------------------------------------------------------------------- //

 $(document).ready(function () {
var images = ['header_about.jpg', 'header_home.jpg', 'header_dining_restaurant.jpg', 'header_environment.jpg', 'header_about_2.jpg', 'header_dining.jpg', 'header_attractions.jpg', 'header_executive_room.jpg', 'header_conferencing.jpg', 'header_leisure.jpg', 'header_functions.jpg'];
   $('#content-main').css({'background': 'url(images/header_photos/' + images[Math.floor(Math.random() * images.length)] + ') top center no-repeat'});
});

// dropdown slider scripts ------------------------------------------------------------------------- //


$(document).ready(function () {
	$(".dropsearch").click(function () {
	$("#drop-search ").slideToggle("fast");
	
	$(this).toggleClass("active");
	return false;
	});
                
        if($(window).width() <= '1100') {
            $('#side-discountlist').hide();
            $('#side-feedback').hide();
            $('#side-facebook').hide();
            $('#side-twitter').hide();
        }
});


























$(document).ready(function () {
	$(".media-open").click(function () {
	$("#overlay-media").slideToggle("fast");
	$("#header-holder-inner").slideToggle("fast");
	$(this).toggleClass("active");
	return false;
	});
});


$(document).ready(function () {
	$(".bookmark-toggle").click(function () {
	$(".book-lower").slideToggle("fast");
	
	$(this).toggleClass("active");
	return false;
	});
});


$(document).ready(function () {
$("#newsletter-box-lower").hide();
$(".hide-chat").hide();
$(".show-chat").click(function () {
$("#newsletter-box-lower").slideDown();
$(".show-chat").hide();
$(".hide-chat").show();
return false;
});
});


$(document).ready(function () {
$(".hide-chat").click(function () {
$("#newsletter-box-lower").slideUp();
$(".show-chat").show();
$(".hide-chat").hide();
return false;
});
});








$(document).ready(function () {

$("#roomtype-tab-1").addClass("active");
$("#typecontent-2").hide();
$("#typecontent-3").hide();


$("#roomtype-tab-1").click(function () {

$("#roomtype-tab-1").addClass("active");
$("#roomtype-tab-2").removeClass("active");
$("#roomtype-tab-3").removeClass("active");

$("#typecontent-1").show();
$("#typecontent-2").hide();
$("#typecontent-3").hide();
 
});
});



$(document).ready(function () {
$("#roomtype-tab-2").click(function () {

$("#roomtype-tab-2").addClass("active");
$("#roomtype-tab-1").removeClass("active");
$("#roomtype-tab-3").removeClass("active");

$("#typecontent-2").show();
$("#typecontent-1").hide();
$("#typecontent-3").hide();
 
});
});




$(document).ready(function () {
$("#roomtype-tab-3").click(function () {

$("#roomtype-tab-3").addClass("active");
$("#roomtype-tab-2").removeClass("active");
$("#roomtype-tab-1").removeClass("active");

$("#typecontent-3").show();
$("#typecontent-2").hide();
$("#typecontent-1").hide();
 
});
});







// backgrounds change color on rollover ------------------------------------------------------------------------- //

$(document).ready(function () {
    $('.meetingroom-block').hover(function () {
        $(this).addClass('overstate');
    },
    function () {
        $(this).removeClass('overstate');
    });
});


$(document).ready(function () {
    $('.pane-box').hover(function () {
        $(this).addClass('overstate');
    },
    function () {
        $(this).removeClass('overstate');
    });
});

$(document).ready(function () {
    $('div#blog-area-left div.blog-spacer:last').hide();
});
