jQuery(function(){
	jQuery('#room_ss').cycle({ 
	    fx: 'scrollHorz', 
	    speed: 1500, 
	    timeout: 9000,
	    prev: '#room_ss_right',
	    next: '#room_ss_left'
	});
	//KWICKS TAB - USED ON ACCOMMODATIONS SECTION
	jQuery(".kwicks").kwicks({
		max:252,
		min:126,
		sticky:false,
		duration:100,
		defaultKwick:0,
		spacing:0
	});
	//CHECK ALL 3 DIVS HEIGHT AND SET HEIGHT TO GREATEST
	var h_array = Array(jQuery("#c1").height(), jQuery("#c2").height(), jQuery("#c3").height());
	h_array.sort(numberSorter);

	jQuery("#kwick1 a, #kwick2 a, #kwick3 a").click(function() {
		
		which = jQuery(this).parent().attr("id");
		if (which == "kwick1") { show = "#c1"; }
		else if (which == "kwick2") { show = "#c2"; }
		else if (which == "kwick3") { show = "#c3"; }
		
		if (jQuery("#c1").css("display") == "block") {
			hide = "#c1";
		} else if (jQuery("#c2").css("display") == "block") {
			hide = "#c2";
		} else if (jQuery("#c3").css("display") == "block") {
			hide = "#c3";
		}
		
		jQuery("#kwick1, #kwick2, #kwick3").removeClass("selected");
		jQuery(this).parent().addClass("selected");
		
		jQuery(hide).slideUp("slow", function() {
			if (show == "#c3") {
				jQuery("#room_info").css("background-color", "fff").fadeIn(100);
			} else {
				jQuery("#room_info").css("background-color", "transparent").fadeIn(100);
			}
			jQuery(show).slideDown("slow");
		});
	});
	function numberSorter(a, b) {
		return a - b;
	}
});