$(document).ready(function() {
	
	// Slideshow
	$('#slideshow #image').innerfade({
		animationtype: 'fade',
		speed: 1400,
		timeout: 4500,
		containerheight: '229px'
	});
	
	// Lightbox
	$(".iframe").fancybox({
		'hideOnContentClick': true,
		'titleShow': false
	});
	
	// Open external links in new Window/Tab
	$("a[href^='http:']").not("[href*='" + window.location.host + "']").attr('target','_blank');
	
	$("a[href^='https:']").attr('target','');
	
	// Fade
	$('.fadeThis').append('<span class="hover"></span>').each(function () {
		var $span = $('> span.hover', this).css('opacity', 0);
		$(this).hover(function () {
			$span.stop().fadeTo(300, 1);
		}, function () {
			$span.stop().fadeTo(300, 0);
		});
	});
	
	// Input value switcher
	$('.your-name input').focus(function () {
		if ($(this).val() == 'Your Name') {
			$(this).val('');
			$(this).css({'font-weight' : 'bold'});
		}
	});
	
	$('.your-name input').blur(function () {
		if ($(this).val() == '') {
			$(this).val('Your Name');
			$(this).css({'font-weight' : 'normal'});
		}
	});
	
	$('.your-email input').focus(function () {
		if ($(this).val() == 'Your Email Address') {
			$(this).val('');
			$(this).css({'font-weight' : 'bold'});
		}
	});
	
	$('.your-email input').blur(function () {
		if ($(this).val() == '') {
			$(this).val('Your Email Address');
			$(this).css({'font-weight' : 'normal'});
		}
	});
	
	$('.message textarea').focus(function () {
		if ($(this).val() == 'Message') {
			$(this).val('');
			$(this).css({'font-weight' : 'bold'});
		}
	});
	
	$('.message textarea').blur(function () {
		if ($(this).val() == '') {
			$(this).val('Message');
			$(this).css({'font-weight' : 'normal'});
		}
	});
	
	// Activate LavaLamp Menu
	$('ul#menu').lavaLamp({
		fx: "swing",
		speed: 500
	});
	$('#menu li:not(".noLava")').hover(function () {
		$('.selectedLava').addClass('was_selectedLava').removeClass('selectedLava');
	}, function () {
		$('.was_selectedLava').addClass('selectedLava').removeClass('was_selectedLava');
	});

	// Sliding Doors Button Fade Like a Total Baller
	$('.button').each(function () {
		$('span', this).addClass('sd');
		$(this).append('<span class="hover"></span><span class="sd2"></span>');
		var thisHover = $(".hover", this);
		$('.sd', this).clone().removeClass('sd').addClass('overlay').appendTo(thisHover);
		var $span = $('> span.hover', this).css('opacity', 0);
		var $span2 = $('> span.sd2', this).css('opacity', 0);
		$(this).hover(function () {
			$span.stop().fadeTo(200, 1);
			$span2.stop().fadeTo(200, 1);
		}, function () {
			$span.stop().fadeTo(200, 0);
			$span2.stop().fadeTo(200, 0);
		});
	});
	
	
});
