var $j = jQuery.noConflict();


	var slide = function() {
	   var $started,
		   $stoped;
	   return {
			$started : function(){
				$started = setInterval("Tg_Slide()", 8000 /* slide durration miliseconds */); 
				},  
			$stoped : function(){
			   clearInterval($started);
			}
	   }
	}();

	//this is slide_show function 
	function Tg_Slide(){
				var $active = $j('#wus .active');
				if ($active.length == 0) $active = $j('#wus div:last') ;
				var $next =  $active.next("div").length ? $active.next("div")
				: $j('#wus div:first');   
				$active.removeClass("active");
				tg_Change($next);
	}


	function tg_Change($element){
			$j("#wus div.active").removeClass("active");
			$element.addClass('active');
			
			var slides = $j('.slide');
			
			var nextHolder = $element.clone();
			
			nextHolder.insertBefore(slides).removeClass("active").addClass('slide');

			
			slides.animate({opacity : 0}, 800, function()
				{
				
					$j(this).remove();

			});
	}

$j(document).ready( function(){

	$j('#wus div:eq(0)').clone().appendTo('#main-feat').addClass('slide');
	$j('#cat-list-gal').hoverscroll();
});

//start the slideshow after window finish to load
$j(window).load( function(){

		Tg_Slide();

		slide.$started();	

});