//tab effects
var TabbedContent = {
	init: function() {	
		$(".tab_item").mouseover(function() {
		
			var background = $(this).parent().find(".moving_bg");
			
		
			
			var thisobj = $(this).prevAll().size();
			
			var cals = '';
			
			if(thisobj == 1)
			{
				cals = 0;
			}
			else if( thisobj == 2  )
			{
				cals = 64;
			}
			else if( thisobj == 3  )
			{
				cals = 128;
			}
			
			var thechild = thisobj + 1;
			
			
			TabbedContent.slideContent($(this));
			
			
			//alert(cals);
			$(background).stop().animate({
				top:cals + "px"
				
			 }, 0,
			
			function() { 
			  $('.tabs .tab_item').css( {'z-index' : '200', 'background' : '#f8f8f8', 'color' : '#554c42'});	
			  $(".tabs .tab_item .tab_content").css( {'color' : '#000000'});
			  $(".tabs .tab_item .tab_title").css( {'color' : '#53932a'});
			  $(".tabs .tab_item .menu_stroke").css( {'display' : 'block'});
			  
			  
				
		      $(".tabs .tab_item:nth-child(" + thechild + ")").css( {'z-index' : '255', 'background' : 'transparent', 'color' : '#ffffff'});
			  $(".tabs .tab_item:nth-child(" + thechild + ") .menu_stroke").css( {'display' : 'none'});
			  $(".tabs .tab_item:nth-child(" + thechild + ") .tab_content").css( {'color' : '#ffffff'});
			  $(".tabs .tab_item:nth-child(" + thechild + ") .tab_title").css( {'color' : '#ffffff'});

			  }
			
			
			
			);
			
		
			
			
			
		});
	},
	
	slideContent: function(obj) {
                
		
		//alert($(obj).prevAll().size());

                var wez = $(obj).prevAll().size();
				
				$(".newcontent ul li img").stop().fadeTo(0, 0);
				$(".newcontent ul li span").stop().fadeTo(0, 0);
				$(".newcontent ul li p").stop().fadeTo(0, 0);
				
			
			
				
				$(".newcontent ul li:nth-child(" + wez + ") img").stop().fadeTo(0, 1);
				$(".newcontent ul li:nth-child(" + wez + ") span").stop().fadeTo(0, 0.3);
				$(".newcontent ul li:nth-child(" + wez + ") p").stop().fadeTo(0, 1);
				
	}
}

$(document).ready(function() { 
						   
	 //give start values before mouse over
	   $(".newcontent ul li img").stop().fadeTo(0, 0);
	   $(".newcontent ul li span").stop().fadeTo(0, 0);
	   $(".newcontent ul li p").stop().fadeTo(0, 0);
		
		$(".newcontent ul li:nth-child(1) img").stop().fadeTo(0, 1);
		$(".newcontent ul li:nth-child(1) span").stop().fadeTo(0, 0.3);
		$(".newcontent ul li:nth-child(1) p").stop().fadeTo(0, 1);
	

	  $(".tabs .tab_item:nth-child(2)").css( {'z-index' : '255', 'background' : 'transparent', 'color' : '#ffffff'});

	  $(".tabs .tab_item:nth-child(2) .tab_content").css( {'z-index' : '255','color' : '#ffffff'});
      $(".tabs .tab_item:nth-child(2) .tab_title").css( {'z-index' : '255','color' : '#ffffff'});
	  $(".tabs .tab_item:nth-child(2) .menu_stroke").css( {'display' : 'none'});

	
	 
	 $(".moving_bg").css("backgroundPosition", "0 0px");
	 

					   
	TabbedContent.init();
});
