/*
	JS by Joshua Gatcke http://www.99lime.com
*/

$(document).ready(function(){
	
	/*-----------------
		MAIN MENU
	-----------------*/
	
	// add arrows
	$('#nav li').has('ul').find('a:first').append('<img src="inc/img/arrow.png" class="arrow" />');
	
	// hover menus
	$('#nav li').hover(function(){
		$(this).find('ul:first').stop(true,true).delay(100).fadeIn('1000');
	},function(){
		$(this).find('ul:first').stop(true,true).delay(300).fadeOut('800');
	});
	
	// countdown
	var newShow = new Date(); 
	newShow = new Date(newShow.getFullYear() + 0, 0, 13, 16); 
	$('#timer').countdown({
		until: newShow, format: 'dHMS',
		timeSeparator: ':',
		layout: '<table><tr><td>{dn}<i>{dl}</i></td><td>{hn}<i>{hl}</i></td><td>{mn}<i>{ml}<i></td><td>{sn}<i>sec<i></td></tr></table><div class="shine"></div>'
	});
	
	// slideshow
	$('#slideshow img').not(':first').hide();
	slideshow();
	function slideshow()
	{
		var current = $('#slideshow img:visible');
		var next = current.next();

		if(current.is(':last-child')) { next = $('#slideshow img:first'); }
		
		current.delay(5000).fadeOut(1000);
		next.delay(5000).fadeIn(1000,slideshow);
	}
	

	

	//create scroller for each element with "horizontal_scroller" class...
	$('.horizontal_scroller').SetScroller({	velocity: 	 50,
											direction: 	 'horizontal',
											startfrom: 	 'right',
											loop:		 'infinite',
											movetype: 	 'linear',
											onmouseover: 'pause',
											onmouseout:  'play',
											onstartup: 	 'play',
											cursor: 	 'pointer'
										});



	//create a vertical scroller...	
	$('.vertical_scroller').SetScroller({	velocity: 50, direction: 'vertical'  });


	
});

