var delay = 500;

$(document).ready(function(){

	// - - - - - - - - - - - - - - - - - - - - - - -
	// clicked main nav on regular page
	
	$('body.work #navigation ul li a').click(function () 	{ from_regular_to_regular_page(this); return false; });
	$('body.words #navigation ul li a').click(function () 	{ from_regular_to_regular_page(this); return false; });
	$('body.bio #navigation ul li a').click(function () 	{ from_regular_to_regular_page(this); return false; });
	$('body.shop #navigation ul li a').click(function () 	{ from_regular_to_regular_page(this); return false; });
   	$('body.contact #navigation ul li a').click(function () { from_regular_to_regular_page(this); return false; });
   	
   	// - - - - - - - - - - - - - - - - - - - - - - -
   	// clicked marquee on regular page
   	
   	$('body.work .jqmarquee a').click(function ()    		{ from_regular_to_video_page(this); return false; });
   	$('body.words .jqmarquee a').click(function ()   		{ from_regular_to_video_page(this); return false; });
	$('body.bio .jqmarquee a').click(function ()    		{ from_regular_to_video_page(this); return false; });
	$('body.shop .jqmarquee a').click(function ()    		{ from_regular_to_video_page(this); return false; });
	$('body.contact .jqmarquee a').click(function () 		{ from_regular_to_video_page(this); return false; });

	// - - - - - - - - - - - - - - - - - - - - - - -
	// clicked main nav on video page
	
	$('body.video #navigation ul li a').click(function () 	{ from_video_to_regular_page(this); return false; });
   	
   	// - - - - - - - - - - - - - - - - - - - - - - -
	// clicked marquee on video page
	
	$('body.video .jqmarquee a').click(function () 			{ from_video_to_video_page(this); return false; });
	
	// - - - - - - - - - - - - - - - - - - - - - - -
	// clicked main nav on home page
	
	$('body.home #navigation ul li a').click(function () 	{ from_home_to_regular_page(this); return false; });

});

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

function from_regular_to_regular_page(url) {

	setTimeout("location.href='"+url+"'",delay);
	$('#content .jScrollPaneContainer').fadeOut(delay);
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

function from_regular_to_video_page(url) {

	setTimeout("location.href='"+url+"'",delay*2);
	$('#content .jScrollPaneContainer').fadeOut(delay,fadeout_content);
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

function from_video_to_regular_page(url) {

	setTimeout("location.href='"+url+"'",delay);
	$('#content .article').fadeOut(delay);
	
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

function from_video_to_video_page(url) {

	setTimeout("location.href='"+url+"'",delay);
	$('#content .article').fadeOut(delay);
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

function from_home_to_regular_page(url) {
	
	if (video_current) {
		setTimeout("location.href='"+url+"'",delay);
		$('#content .article').fadeOut(delay);
	} else {
		location.href = url;
	}
	
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

function fadeout_content() {
	$('#content').fadeOut(delay);
}