/* This document contains scripts common to all pages */


//PRELOAD NAV IMAGES----FIX!!!!!!!
if (document.images)
{
	preload_image_object = new Image();
	// set image url
	image_url = new Array();
	image_url[0] = "{template_path}/images/nav/home_hover.jpg";
	image_url[1] = "{template_path}/images/nav/slip_rental_hover.jpg";
	image_url[2] = "{template_path}/images/nav/location_hover.jpg";
	image_url[3] = "{template_path}/images/nav/contact_us_hover.jpg";
	image_url[4] = "{template_path}/images/nav/concierge_services_hover.jpg";
	image_url[5] = "{template_path}/images/nav/gallery_hover.jpg";
	image_url[6] = "{template_path}/images/nav/reserve_membership_hover.jpg";
	var i = 0;
	for(i=0; i<=6; i++) 
		preload_image_object.src = image_url[i];
}

//Scripts to be run on document load
$(document).ready(function(){
	//make all roll-over images invisible.
	$('.hover_img').css({
						opacity:0,
						visibility:'visible'
						});
	//setup roll-over states for navigation.
	$('.button').hover(
		function(){
			$('#'+$(this).attr('id')+'_hover').stop().animate({
															  opacity:1
															  },'slow');
		},
		function(){
			$('#'+$(this).attr('id')+'_hover').stop().animate({
															  opacity:0
															  },'slow');
		});
	$('.nav_img,.hover_img').click(function(){
		window.location.replace($(this).closest('a').attr('href'));
	});
});

//Compares the heights of two elements and sets both heights to the greater of the two
function makeHeight(elemID1,elemID2){
	var elem1 = $('#'+elemID1);
	var elem2 = $('#'+elemID2);
	if (elem1.height()<elem2.height())
		elem1.css({height:elem2.height()});
	else
		elem2.css({height:elem1.height()});
}
