var hspacer = 40;
var vSpacer = 80
var isActive; 		  
var theWidth = $(window).width() - hspacer;
var theHeight = $(window).height() - vSpacer;
var fullWidth = $(window).width() +100;

$(window).resize(function() {						  
	theWidth = $(window).width() - hspacer;
	theHeight = $(window).height() - vSpacer;
	fullWidth = $(window).width() +100;

	if(!isActive){
		$('#aboutHolder').css({'width':theWidth, 'height':theHeight, 'left': fullWidth, 'top': '20px'});	
	}
	else{
		$('#aboutHolder').css({'width':theWidth, 'height':theHeight, 'left': '20px', 'top': '20px'});	
	
	}
	var containerHeight = $('#aboutHolder').height()-40;
	$('#aboutHolder .container').css({'height':containerHeight});	
						  
});


$(document).ready(function() {	
	
	$('#mnavPortfolio').addClass("active");
	$('#aboutHolder').css({'width':theWidth, 'height':theHeight, 'left': fullWidth, 'top': '20px'});	
	
	var containerHeight = $('#aboutHolder').height()-40;
	$('#aboutHolder .container').css({'height':containerHeight});	
	
		
	$('#footer').css({'bottom':'-40px', 'opacity':0});	
	$('#header').css({'left':'-445px', 'opacity':0});	
	
	$("#footer").animate({'bottom':'0', 'opacity':1}, 
		{ queue:false, duration:1000, easing: 'easeInOutQuart', complete:showHeader}
	);	
	function showHeader(){
		$("#header").animate({'left':'0', 'opacity':1}, 
			{ queue:false, duration:1000, easing: 'easeInOutQuart', complete:showHeader}
		);
	}
	
	
	//AJAX LOADER
	var ajax_load = "<img src='images/ajax-loader.gif' alt='Loading Content...' />";
	$('#mnavAbout').click(function(){														  
		$("#aboutHolder .container").html(ajax_load).load("http://www.lisacanning.ca/wordpress/about/", function(){				
			$("#aboutHolder").animate({'left':'20px', 'top':'20px'}, 
				{ queue:false, duration:1000, easing: 'easeInOutQuart', complete:adjust }
			);				
		});				
	});	
	
	$('#btnClose').live('click', function(){
				  
		var moveWidth = $(window).width() +20;
		$("#aboutHolder").animate({'left':moveWidth, 'top':'20px'}, 
			{ queue:false, duration:1000, easing: 'easeInOutQuart', complete:adjust }
		);			
	});	
	
	function adjust(){
		if(isActive){
			isActive=false;
			$('#mnavPortfolio').addClass("active");
			$('#mnavAbout').removeClass("active");
		}
		else{
			isActive = true;	
			$('#mnavPortfolio').removeClass("active");
			$('#mnavAbout').addClass("active");	
		}
	}
	
	
	
	//Scroll to comments
	$('a.scroll').click(function(){//$.scrollTo works EXACTLY the same way, but scrolls the whole screen
		$.scrollTo( this.hash, 700, { easing:'elasout' });
		return false;
	});	
	
	$.easing.elasout = function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	};	
	
	
	
	
	//$('div.pane').scrollTo( 0 );//reset all scrollable panes to (0,0)
	//$.scrollTo( 0 );//reset the screen to (0,0)
	
		
		
		
});



