$(document).ready(function() {
var closedW = 16;
var closedL = 63;
var lCol = 187;
var lContent = 234;
var sidebarOpen = true;
var speed = 1000;

/*	////////////////////////////////////////////////////////////////////////////////

    --------------------------------------------------------------------------------
	
	TOP ARCHIVE
	================================================================================ */
	
	//$("#archive").hide();
		$('#archiveBtn').click(function (event) {
			event.preventDefault();
				if ($(this).attr('class') == 'down') {
					$(this).attr('class', 'up');
				} else if ($(this).attr('class') == 'up') {
					$(this).attr('class', 'down');
				}
			$("#archive").slideToggle();
		});
		
		
		
	function bindCloseBtns() {
		
		$("#closenav").click(function(event) {			   
			event.preventDefault();
			toggleSidebarW(null);
		});	
	}
	
	function toggleSidebarW(cllbck) {
		
		var targX = closedW;
		var targL = closedL;
		
			if (sidebarOpen) {
				$("#closenav").css('background-image', 'url(/wp-content/themes/picastudio/images/global/arrow-right.gif)');
				sidebarOpen = false;
			} else {
				targX = lCol;
				targL = lContent;
				$("#closenav").css('background-image', 'url(/wp-content/themes/picastudio/images/global/arrow-left.gif)');
				sidebarOpen = true;
			}
		
		$('#sidebar').animate({
			width: targX
		  	}, speed);
		
		$('#content').animate({
			left: targL
		  	}, speed, function() {
		  });
		
	}
		
	bindCloseBtns();	
});

