
$(document).ready(function() {
			   //Get the height of the first item
			$('#mask').css({'height':$('#panel-1').height()});    
			
			//Calculate the total width - sum of all sub-panels width
			//Width is generated according to the width of #mask * total of sub-panels
			$('#panel').width(parseInt($('#mask').width() * $('#panel > div').length));
			
			//Set the sub-panel width according to the #mask width (width of #mask and sub-panel must be same)
			$('#panel > div').width($('#mask').width());
			
			//Get all the links with rel as panel
			$('a[rel=panel]').click(function () {
			
				//Get the height of the sub-panel
				var panelheight = $($(this).attr('href')).height();
				
				//Set class for the selected item
				$('a[rel=panel]').removeClass('selected');
				$(this).addClass('selected');
				
				//Resize the height
				$('#mask').animate({'height':panelheight},{queue:false, duration:500});            
				
				//Scroll to the correct panel, the panel id is grabbed from the href attribute of the anchor
				$('#mask').scrollTo($(this).attr('href'), 800);        
				
				//Discard the link default behavior
				return false;
			});
		
		setInterval(function(){
			if ($('a.selected').next().length)
			   $('a.selected').next().click();
			else
			   $('a[rel=panel]').first().click();
		},2000);
});




/*

$(function(){

	$('.videoone-link').addClass('tab');
	
	$('.videotwo').hide();
	$('.videothree').hide();
	$('.videofour').hide();
	$('.videofive').hide();
	
	$('a.videoone-link').click(function() {
		$('.videoone').show();
		$('.videotwo').hide();
		$('.videothree').hide();
		$('.videofour').hide();
		$('.videofive').hide();
		$('.videoone-link').addClass('tab');
		$('.videotwo-link').removeClass('tab');
		$('.videothree-link').removeClass('tab');
		$('.videofour-link').removeClass('tab');
		$('.videofive-link').removeClass('tab');
		return false;
	});
	$('a.videotwo-link').click(function() {
		$('.videoone').hide();
		$('.videotwo').show();
		$('.videothree').hide();
		$('.videofour').hide();
		$('.videofive').hide();
		$('.videoone-link').removeClass('tab');
		$('.videotwo-link').addClass('tab');
		$('.videothree-link').removeClass('tab');
		$('.videofour-link').removeClass('tab');
		$('.videofive-link').removeClass('tab');
		return false;
	});
	$('a.videothree-link').click(function() {
		$('.videoone').hide();
		$('.videotwo').hide();
		$('.videothree').show();
		$('.videofour').hide();
		$('.videofive').hide();
		$('.videoone-link').removeClass('tab');
		$('.videotwo-link').removeClass('tab');
		$('.videothree-link').addClass('tab');
		$('.videofour-link').removeClass('tab');
		$('.videofive-link').removeClass('tab');
		return false;
	});
	$('a.videofour-link').click(function() {
		$('.videoone').hide();
		$('.videotwo').hide();
		$('.videothree').hide();
		$('.videofour').show();
		$('.videofive').hide();
		$('.videoone-link').removeClass('tab');
		$('.videotwo-link').removeClass('tab');
		$('.videothree-link').removeClass('tab');
		$('.videofour-link').addClass('tab');
		$('.videofive-link').removeClass('tab');
		return false;
	});
	$('a.videofive-link').click(function() {
		$('.videoone').hide();
		$('.videotwo').hide();
		$('.videothree').hide();
		$('.videofour').hide();
		$('.videofive').show();
		$('.videoone-link').removeClass('tab');
		$('.videotwo-link').removeClass('tab');
		$('.videothree-link').removeClass('tab');
		$('.videofour-link').removeClass('tab');
		$('.videofive-link').addClass('tab');
		return false;
	});
});
*/
