//tab effects
var current_item;
var TabbedContent = {
	init: function() {	
		//jQuery(".tab_item").mouseover(function() {
		jQuery(".tab_pointer").mouseover(function() {
		
			var background = jQuery(this).parent().find(".moving_bg");
			var yMove = jQuery(this).position()['top'];
			 current_item =  jQuery(this);
			 
			jQuery('.tab_pointer').removeClass('current_item'); 
			 
			/*
			jQuery(background).stop().animate({
				top: yMove+'px'
			}, { duration: 300 } ,  'linear', function() { jQuery(this).addClass('selected'); alert('finish'); });
			*/
			
			jQuery(background).stop().animate({
			   top: yMove+'px'
			  }, {
			    duration: 300,
			    specialEasing: {
			      width: 'linear',
			      height: 'easeOutBounce'
			    },
			    complete: function() {
			      jQuery(current_item).addClass('current_item');
			    }
			  });
			
			TabbedContent.slideContent(jQuery(this));
			
		});
	},
	
	slideContent: function(obj) {
		
		var margin = jQuery(obj).parent().parent().find(".slide_content").width();
		margin = margin * (jQuery(obj).prevAll().size() - 1);
		margin = margin * -1;
		
		jQuery(obj).parent().parent().find(".tabslider").stop().animate({
			marginLeft: margin + "px"
		}, {
			duration: 300
		});
	}
}

jQuery(document).ready(function() {
	TabbedContent.init();
});



