
$(function(){

	//Hide SubLevel Menus
	//$('ul.menu li ul').hide();

	//OnHover Show SubLevel Menus
	
		$(".menu li").hover(function(){
			$(this).find('ul:first').stop().css({height:"auto",overflow:"hidden"}).slideDown(200,function(){
				//$(this).css({height:"auto",overflow:"visible"});
				});
			
			}
				,function(){
					$('ul', this).stop(false, true).slideUp('fast');
					//$('ul li.arrow', this).animate({ opacity: 'hide' }, 1000, function(){$(this).remove();});
					});
				
						
	


	
	var first = 0;
	var speed = 700;
	var pause = 3500;
	  function removeFirst(){
			first = $('ul#ns-ticker li:first').html();
			$('ul#ns-ticker li:first')
			.animate({opacity: 0,marginTop : '-=71px'}, speed)
			.fadeOut('slow', function() {jQuery(this).remove();});
			addLast(first);
		}
		
		function addLast(first){
			last = '<li style="display:none">'+first+'</li>';
			$('ul#ns-ticker').append(last)
			$('ul#ns-ticker li:last').animate({opacity: 1}, 250).fadeIn(500)
		}
	
	interval = setInterval(removeFirst, pause);


/* Slider Plugin */

$("#browsable").scrollable({circular: true, mousewheel: true}).navigator().autoscroll({
	interval: 3000		
});	

$("#chained").scrollable({circular: true, mousewheel: true}).navigator();	

var div = $('div.latest-slider'),
		ul = $('ul.latest-slider'),
		ulPadding = 15;
	
	//Get menu width
	var divWidth = div.width();
 
	//Remove scrollbars	
	div.css({overflow: 'hidden'});
	
	//Find last image container
	var lastLi = ul.find('li:last-child');
	
	//When user move mouse over menu
	div.mousemove(function(e){
		//As images are loaded ul width increases,
		//so we recalculate it each time
		var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;	
		var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;
		div.scrollLeft(left);
	});


});

