$(document).ready( function() {
	
	$('#tabs_wrapper').hover(
		function () 
		{				
			//alert(this);
			$('#tabs_container').removeClass("tabs_container_inactive");
			//blur bg
			$(".galleria-images .galleria-image").each( function(i) {
				if( $(this).find("img").css('position') == 'relative' ) 
				{
					var imgElem = $(this).find("img");
					var fullpath = imgElem.attr("src");
					var parts = fullpath.split("/");
					parts = parts.reverse();
					filename = parts[0]; 
					imgElem.attr("src", "/phpThumb/phpThumb.php?src=/data/background/highlights/"+filename+"&fltr[]=blur|8");
				}
			});
			$(".galleria-info, .galleria-thumbnails-container").fadeOut(300);
		},
		function() 
		{
			$('#tabs_container').addClass("tabs_container_inactive");
			$('#tabs_container > .tabs > li.active').removeClass('active');
			//unblur the background
			$(".galleria-images .galleria-image").each( function(i) {
				if( $(this).find("img").css('position') == 'relative' ) 
				{
					var imgElem = $(this).find("img");
					imgElem.attr("src", "/data/background/highlights/"+filename);
				}
			});
			$(".galleria-info, .galleria-thumbnails-container").fadeIn(300);
		});


	$('.tab').hover(function () {
		$('#tabs_container > .tabs > li.active').removeClass('active'); // Remove the 'active' class from the active tab.
		$(this).parent().addClass('active'); // Add the 'active' class to the clicked tab.
		$('#tabs_container > .tab_contents_container > div.tab_contents_active').removeClass('tab_contents_active'); // Remove the 'tab_contents_active' class from the visible tab contents.
		$(this.rel).addClass('tab_contents_active'); // Add the 'tab_contents_active' class to the associated tab contents.		
	});
});
