
// Main Scripts
// ----------------------------------------------------------------------------- //


$(document).ready(function(){ // Start

	// Link Scrubber Script
	$("a").bind("focus",function(){if(this.blur)this.blur();});
	

	// Page Main Images
	$("#slides").hide().delay(500).fadeIn(900).slides({
		effect: 'fade',
		crossfade: true,
		pagination: true,
		//slideSpeed: 1200,
		fadeSpeed: 1400,
		play: 6400,
		pause: 3800,
		hoverPause: false
	});
	
	
	// Information Box
	$("#main_image").hoverIntent(function(){
			$("#information_box").stop().animate({ marginLeft: "0" }, 500);
		}, function(){
			$("#information_box").stop().delay(600).animate({ marginLeft: "-503px" }, 600);
	});
	
	$("#info_closebutton a").click(function(){
    	$("#information_box").animate({ marginLeft: "-503px" }, 600);
		return false;
	});
	
	
	// Nav Blocks Clickable / Hover Captions
	$(".nav_block").hover(function(){
		$(this).find("p").stop().animate({ top: "180px" }, 500);
	}, function(){
		$(this).find("p").stop().animate({ top: "-180px" }, 900);
	});
	
	$(".nav_block").click(function(){
    	window.location = $(this).find("a").attr("href");
		return false;
	});
	
	
	// Column One Navigation Hover
	$("#sub_column_one img").hover(function(){
		$(this).stop().fadeTo(200, 0.6);
		},function(){
		$(this).stop().fadeTo(200, 1.0);
	});
	
	
	// Form Validate Script
	$("#subscribeForm").validate();
	$("#registerForm").validate();
	$("#unsubscribeForm").validate();
	
	
	// Hover Image Fade In and Out
	$(".col3_block_text").hide();
	$(".col3_block_image").show();
	$(".col3_block").hover(function(){
		$(".col3_block_image", this).stop().fadeTo(500, 0.0);
		$(".col3_block_text", this).stop().fadeTo(500, 1.0);
		},function(){
		$(".col3_block_image", this).stop().fadeTo(800, 1.0);
		$(".col3_block_text", this).stop().fadeTo(500, 0.0);
	});
	
	
	// Toggle Click Box
	$("#google_translate_element").hide();
	
	$("a#language_button").toggle(function(){
			$("#google_translate_element").fadeTo(600, 1.0);
			return false;
		}, function(){
			$("#google_translate_element").fadeTo(900, 0.0).hide();
			return false;
	});
	
	
	// PRESS SECTION
	$(function(){
		
		// When page loads
		$("#press_column_two").load("/dakota/hotel-press/articles/named-best-restaurant.html");
		$("#careers_column_two").load("/dakota/hotel-careers/edinburgh_jobs/introduction.html");
		$("ul.press_list li a:first").addClass("active");
		
		$("ul.press_list li a, ul.careers_list li a").click(function() {
			
			// Press Links
			var pressURL = $(this).attr("href");
			
			$("ul.press_list li a, ul.careers_list li a").removeClass("active");
			$(this).addClass("active");
			$("#press_column_two, #careers_column_two").load(pressURL).hide().fadeTo(500, 1.0);
			return false;
		});
		
	});
	
	
	// Gift Page Image Swaps
	$(function(){
		
		// Gift 1 Bar + Grill
		$("#gift01").mouseout(function() {
			$("#giftimage").attr({ src: "/web/images/sub_images/ourstory.jpg" }).stop().hide().fadeTo(300, 1.0);
		}).mouseover(function(){
		  	$("#giftimage").attr({ src: "/web/images/sub_images/gift_bar.jpg" }).stop().hide().fadeTo(300, 1.0);
		});
		
		// Gift 2 Credit
		$("#gift02").mouseout(function() {
			$("#giftimage").attr({ src: "/web/images/sub_images/ourstory.jpg" }).stop().hide().fadeTo(300, 1.0);
		}).mouseover(function(){
		  	$("#giftimage").attr({ src: "/web/images/sub_images/gift_credit.jpg" }).stop().hide().fadeTo(300, 1.0);
		});
		
		// Gift 3 Overnight
		$("#gift03").mouseout(function() {
			$("#giftimage").attr({ src: "/web/images/sub_images/ourstory.jpg" }).stop().hide().fadeTo(300, 1.0);
		}).mouseover(function(){
		  	$("#giftimage").attr({ src: "/web/images/sub_images/gift_overnight.jpg" }).stop().hide().fadeTo(300, 1.0);
		});
		
	});
	


}); // End





// Main Navigation Drop Down
//$(function(){
//	//$("nav").css('marginTop', '29px');
//	$("nav").delay(1300).animate({
//			marginTop: "29px"
//	}, 800);
//});


// Main Menu Script
//$(document).ready(function() {
//
//    $("ul.main_nav li").hover(function(){
//    
//        $(this).addClass("hover");
//        $('ul:first',this).show();
//    
//    }, function(){
//    
//        $(this).removeClass("hover");
//        $('ul:first',this).hide();
//    
//    });
//
//});


// Panel Toggle
//$(document).ready(function() {
//	$("#dropdown_box").hide();
//	$(".dropdown").click(function () {
//		$(this).toggleClass("dropdown_button_active");
//		$("#dropdown_box").slideToggle(400);
//		return false;
//	});
//});


// Opacity Hover
//$(function(){
//	
//	$("img.grey").hover(
//	function() {
//	$(this).stop().animate({"opacity": "0"}, "slow");
//	},
//	function() {
//	$(this).stop().animate({"opacity": "1"}, "slow");
//	});
// 
//});


// Portfolio Block Clickable / Hover Captions
//$(function() {
//	
//	$("ul.portfolio li").hover(function(){
//		$(this).find(".portfoliotext").stop().animate({ bottom:'0' },{queue:false,duration:400});
//	}, function(){
//		$(this).find(".portfoliotext").stop().animate({ bottom:'-35px' },{queue:false,duration:1200});
//	});
//	
//	$("ul.portfolio li").click(function(){
//    	window.location = $(this).find("a").attr("href");
//		return false;
//	});
//	
//});


// Window Scrollbar on and off
//function resize() {
//	if ($(window).width() > 990) {
//	  $('html').css({'overflow-x':'hidden'});
//	} else {
//	  $('html').css({'overflow-x':'auto'});
//	}
//}
//$(document).ready(resize);
//$(window).resize(resize);


// Gallery Cycle Code
//$(document).ready(function(){
//		$("#main_image").cycle({ 
//		fx:    'fade',
//		speed: 700,
//		timeout: 4000,
//		pause:  1 
//	});
//});


// Block Clickable
//$(function(){		   
//	$(".descriptionbox").click(function(){
//    	window.location = $(this).find("a").attr("href");
//		return false;
//	});
//});


// Gallery Script
//$(document.body).ready(function(){
//	$(".thumbnails a").click(function(){
//		var largePath = $(this).attr("href");
//		$("#largeImg").attr({ src: largePath }).hide().fadeIn(500);
//		return false;
//	});
//});


// Equal Column Height Script
//$(document).ready(function() {
//	$("#contents_container").equalHeights(); 
//});


// Minus Margin Click Box
//$(document).ready(function(){
//	$("#home").click(function() {
//		$("#right_col_contents").animate({
//				marginLeft: "0px"
//		}, 500);
//	});
//});


// Minus Margin Hover Box
//$(document).ready(function(){
//	$("ul.sub_navigation li").hover(function() {
//		$(this).animate({
//				marginLeft: "5px"
//		}, 200);
//	}, function(){
//		$(this).animate({
//				marginLeft: "0"
//		}, 300);
//	});
//});


// No Right Click
//$(document).ready(function(){   
//	$("#header_logo").bind("contextmenu",function(e){
//		return false;
//	});
//	$("#contents_container").bind("contextmenu",function(e){
//		return false;
//	});
//	$(".news_image").bind("contextmenu",function(e){
//		return false;
//	});
//});	


// Fade Toggle Plugin
//jQuery.fn.fadeToggle = function(speed, easing, callback) {
//  return this.animate({opacity: 'toggle'}, speed, easing, callback);  
//};
//$(document).ready(function() {
//	$("#popup_hidden_area").hide();
//	$("a#hiddenbox").click(function () {
//		$("#popup_hidden_area").fadeToggle('slow');
//		return false;
//	});
//});


//if($('#media_carousel li').length > 1)
//{
//	
//}

//$(function(){
//	$(".img_reset", this).stop().fadeTo(300, 1);
//	}, function() {
//	$('.img_reset', this).stop().fadeTo(600, 0);
//	});
//});


//$(document).ready(function(){ 
//
//	$("#contactArea").css('height', '0px');
//	
//	$("a.contact").toggle( 
//		function () { 				
//			$("#contactArea").animate({height: "180px"}, {queue:false, duration: 1000, easing: 'easeOutBounce'}) 
//		}, 
//		function () { 
//			$("#contactArea").animate({height: "0px"}, {queue:false, duration: 800, easing: 'easeInOutQuart'})  
//		} 
//	);
//
//});


// Add/Remove Class From Multiple Items
//jQuery.fn.sclear = function() {
//	$("a#s1, a#s2, a#s3, a#s4, a#s5, a#s6").removeClass("active"); 
//};
//$(function(){
//	$("#prod_column_one h3").click(function() {
//		$(this).sclear();
//	});
//});


// Add Class to Link Type
//$(document).ready(function(){
//
//	$("a[@href$=pdf]").addClass("pdf");
//
//	$("a[@href$=zip]").addClass("zip");
//
//	$("a[@href$=psd]").addClass("psd");
//	
//	$("a:not([@href*=http://www.webdesignerwall.com])").not("[href^=#]")
//		.addClass("external")
//		.attr({ target: "_blank" });
//
//});

