/* Global functions */
/* Left Pane Expanders */
function collapsePane01(){
	$('#pane01').hide();
	$('#pane01_btn').attr('src','images/paneLabel_about.png');
	$('#pane01_btn').attr('title','Ben Here!');	
}
function collapsePane02(){
	$('#pane02').hide();
	$('#pane02_btn').attr('src','images/paneLabel_design.png');
	$('#pane02_btn').attr('title','What I do');	
}
function collapsePane03(){
	$('#pane03').hide();
	$('#pane03_btn').attr('src','images/paneLabel_books.png');
	$('#pane03_btn').attr('title','What I read');	
}
/*function collapsePane04(){
	$('#pane04').hide();
	$('#pane04_btn').attr('src','images/paneLeft_btn_review.gif');
	$('#pane04_btn').attr('title','Open Pane 04');	
}*/

/* Page Load functions */
$(function(){
	/* Tabs */
	$("#pane02_tabs").tabs();
	$("#pane03_tabs").tabs();
/*============= START Left Pane - Expansion ============*/
	/* Left Pane - Pane 01 */
	$('#pane01_btn, #pane01_h1 .btn_tabClose').click(function(){
		collapsePane02();
		collapsePane03();
		//collapsePane04();
		
		if($('#pane01').is(':visible')){
			$('#pane01_btn').attr('src','images/paneLabel_about.png');
			$('#pane01_btn').attr('title','Ben Here!');
			$('#pane01').hide("slide", {direction: "left"}, 500);
			
		} else {
			$('#pane01_btn').attr('src','images/paneLabel_about_OVER.png');
			$('#pane01_btn').attr('title','Done That!');
			$('#pane01').show("slide", {direction: "left"}, 500);
		};		
	});
	/* Left Pane - Pane 02 */
	$('#pane02_btn, #pane02_h1 .btn_tabClose').click(function(){
		collapsePane01();
		collapsePane03();
		//collapsePane04();

		if($('#pane02').is(':visible')){
			$('#pane02_btn').attr('src','images/paneLabel_design.png');
			$('#pane02_btn').attr('title','What I do');			
			$('#pane02').hide("slide", {direction: "left"}, 500);
		} else {
			$('#pane02_btn').attr('src','images/paneLabel_design_OVER.png');
			$('#pane02_btn').attr('title',"What I've done");			
			$('#pane02').show("slide", {direction: "left"}, 500);
		};
	});
	/* Left Pane - Pane 03 */
	$('#pane03_btn, #pane03_h1 .btn_tabClose').click(function(){
		collapsePane01();
		collapsePane02();
		//collapsePane04();
		
		if($('#pane03').is(':visible')){
			$('#pane03_btn').attr('src','images/paneLabel_books.png');
			$('#pane03_btn').attr('title','What I read');			
			$('#pane03').hide("slide", {direction: "left"}, 500);
		} else {
			$('#pane03_btn').attr('src','images/paneLabel_books_OVER.png');
			$('#pane03_btn').attr('title',"What I've read");			
			$('#pane03').show("slide", {direction: "left"}, 500);
		};
	});
/*============= END Left Pane - Expansion ==============*/
/*============== START Pane 3 - Sections ===============*/
	$('#pane03_section01_toggle').mouseover(function(){
		$(this).css('cursor','pointer');
	});
	$('#pane03_section02_toggle').mouseover(function(){
		$(this).css('cursor','pointer');
	});
	
	$('#pane03_section01_toggle').click(function(){
		section01 = '#pane03_section01_content';
		toggleBtn = '#pane03_section01_toggle .btn_tabToggle';
		if($(section01).is(':visible')){
			$(this).addClass('h5_Close');
			$(section01).hide();
			$(toggleBtn).css('background-position', 'left bottom');
			$(toggleBtn).attr('title', 'open');
		} else {
			$(this).removeClass('h5_Close');
			$(section01).show();
			$(toggleBtn).css('background-position', 'right top');
			$(toggleBtn).attr('title', 'close');
		};
	});
	
	$('#pane03_section02_toggle').click(function(){
		section01 = '#pane03_section02_content';
		toggleBtn = '#pane03_section02_toggle .btn_tabToggle';
		if($(section01).is(':visible')){
			$(this).addClass('h5_Close');
			$(section01).hide();
			$(toggleBtn).css('background-position', 'left bottom');
			$(toggleBtn).attr('title', 'open');
		} else {
			$(this).removeClass('h5_Close');
			$(section01).show();
			$(toggleBtn).css('background-position', 'right top');
			$(toggleBtn).attr('title', 'close');
		};
	});
/*=============== END Pane 3 - Sections ================*/
});
