// JavaScript Document
$(document).ready(function(){

	
	function hideAll()
	{
		$('#colapsable').find('ul li').each(function(){
				var tab = $(this).attr('tab');
				$(tab).removeClass('showUpperLeftTab');
				$(tab).addClass('hideUpperLeftTab');
		});
		
		$('#colapsable').find('ul li').each(function(){
			var clicked = $(this).attr('clicked');
			if(clicked == 'true')
			{
				$(this).find('a').css({background:'url(images/tab_left_normal.jpg) no-repeat center center'});
				$(this).attr('clicked','false');
			}
		});
	 }
	 
	 function hideLowerTabs()
	 {
		 $('#colapsable2').find('ul li').each(function(){
			var tab = $(this).attr('tab');
			$(tab).removeClass('showLowerRightTab');
			$(tab).addClass('hideLowerRightTab');
		  });
		 
		 $('#colapsable2').find('ul li').each(function(){
			var clicked = $(this).attr('clicked');
			if(clicked == 'true')
			{
				$(this).find('a').css({background:'url(images/lower_right_tab_normal.jpg) no-repeat'});
				$(this).attr('clicked','false');
			}
		});
	 }
	
	$('#colapsable ul li').click(function(e){
		var tab = $(this).attr('tab');
		hideAll();
		$(tab).removeClass('hideUpperLeftTab');
		$(tab).addClass('showUpperLeftTab');
		
		$(this).find('a').each(function(){
			$(this).css({background:'url(images/tab_left_active.jpg) no-repeat center center'});	
		});
		
		$('#colapsable ul li').attr('clicked' , 'true');
		
	});
	
	$('#colapsable2 ul li').click(function(e){
		var tab = $(this).attr('tab');
		hideLowerTabs();
		$(tab).removeClass('hideLowerRightTab');
		$(tab).addClass('showLowerRightTab');
		
		$(this).find('a').each(function(){
			$(this).css({background:'url(images/lower_right_tab_active.jpg) no-repeat'});
		
		});
		$(this).attr('clicked', 'true');
	 });
});