jQuery.noConflict();
(function($) {		  
	jQuery(document).ready(function() 
	{		
		Cufon.replace('h1');
		$('#content-container #image-wrapper #control a').click(function() 
		{
			$('#imagecycle').cycle('next');
		});
		
		var countImg = $('#images ul#imagecycle li').length;
		if(countImg > 1)
		{
			$('#content-container #image-wrapper #control a').css('display','block');
		}
		
		var onGoing = false;		
		$("#content-container #tab #close a").click(function() 
		{
			var $thisTab = $(this).parent().parent();
			if(!onGoing)
			{
				onGoing = true;
				if( $thisTab.css('left') == '0px' )
				{
					$(this).css('background-position','0 -27px');
					$thisTab.animate({
					    left: '-331px'
					  }, 600, 'easeOutExpo', function() {
					      onGoing = false;
					  });
				}else
				{
					$(this).css('background-position','0 0');
					$thisTab.animate({
					    left: '0'
					  }, 600, 'easeOutExpo', function() {
					      onGoing = false;
					  });
				}
			}
		});
		
		var len = $('#news-wrapper .news_col').length;
		if( len > 2 )
		{
			slideNews();
		}
		
		function takeFirstPutLast()
		{
			$(".news-container #news-wrapper .news_col:first").clone().appendTo(".news-container #news-wrapper");
			$(".news-container #news-wrapper .news_col:first").remove();
			$(".news-container #news-wrapper").css("left", 0);
			slideNews();
		}
		
		function slideNews()
		{			
			$('.news-container #news-wrapper').delay(5000).animate
			({
			    left: '-157px'
			  }, 1000, function() {
			  	 takeFirstPutLast()
			   	// slideNews()
			  });
		}
		
		
	});
})(jQuery);	
