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

Title : Luke Whyte Portfolio JavaScript
Author : Luke Whyte 
URL : www.lukeallanwhyte.com

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

$(document).ready(function() {
	/* Load content based on hashtag in url */
    var hashVal = window.location.hash.split("#")[1];
    if(hashVal == 'resume') {
		$("#theContent").empty().html('<img class="load" src="/images/ajax-loader.gif" />');
        $('#theContent').load('resume.html #resume', function(){
			$('#resume').show('slow');
		});
    } else if(hashVal == 'writing') {
        $("#theContent").empty().html('<img class="load" src="/images/ajax-loader.gif" />');
		$('#theContent').load('writing.html #writing', function(){
			$('#writing').show('slow');
		});
    } else if(hashVal == 'photography') {
        $("#theContent").empty().html('<img class="load" src="/images/ajax-loader.gif" />');
		$('#theContent').load('photography.html #photography', function(){
			$('#photography').show('slow');
			$(".flickrSlideshow").colorbox();
		});
    } else if(hashVal == 'design') {
        $("#theContent").empty().html('<img class="load" src="/images/ajax-loader.gif" />');
	    $('#theContent').load('design.html #design', function(){
			$('#design').show('slow');
			$("#slider").easySlider({
				speed: 700,
				auto: false,
				pause: 5000,
				continuous: true
			});
		});
    } else if(hashVal == 'contact') {
        $("#theContent").empty().html('<img class="load" src="/images/ajax-loader.gif" />');
		$('#theContent').load('contact.html #contact', function(){
			$('#contact').show('slow');
		});
    } else {
		$("#theContent").empty().html('<img class="load" src="/images/ajax-loader.gif" />');
		$('#theContent').load('home.html #intro', function(){
			$('#intro').show('slow');
		});
	}
	
	/* IE PNG fix */
	$('#menu,#base').supersleight();
	
	/* Load content based on navBar click */
	$('#resumeShow').click(function() {
		window.location.hash = 'resume';
		$("#theContent").empty().html('<img class="load" src="/images/ajax-loader.gif" />');
		$('#theContent').load('resume.html #resume', function() {
			$('#resume').show('slow');
			$('#resumeText').supersleight();
		});  
		return false;
	});
	$('#writingShow').click(function() {
		window.location.hash = 'writing';
		$("#theContent").empty().html('<img class="load" src="/images/ajax-loader.gif" />');
		$('#theContent').load('writing.html #writing', function() {
			$('#writing').show('slow');
			$('#writingText').supersleight();
		});
		return false;
	});
	$('#photographyShow').click(function() {
		window.location.hash = 'photography';
		$("#theContent").empty().html('<img class="load" src="/images/ajax-loader.gif" />');
		$('#theContent').load('photography.html #photography', function() {
			$('#photography').show('slow');
			$(".flickrSlideshow").colorbox();
		});
		return false;
	});
	$('#designShow').click(function() {
		window.location.hash = 'design';
		$("#theContent").empty().html('<img class="load" src="/images/ajax-loader.gif" />');
		$('#theContent').load('design.html #design', function() {
			$('#design').show('slow');
			$("#slider").easySlider({
				speed: 700,
				auto: false,
				pause: 5000,
				continuous: true
			});
		});
		return false;
	});
	$('#contactShow').click(function() {
		window.location.hash = 'contact';
		$("#theContent").empty().html('<img class="load" src="/images/ajax-loader.gif" />');
		$('#theContent').load('contact.html #contact', function() {
			$('#contact').show('slow');
		});
		return false;
	});
});

