/***
*
* Flipbook JS
* © 2011 G Media Limited
*
*/
var seqTimer;
var showingItem = 1;
var animating = false;
function seqNextItem() {
	animating = true;
	var nextNum = showingItem + 1; // NEXT ITEM!
	if (nextNum == 6) nextNum = 1;
	$("#fL"+showingItem).stop().fadeOut("250", function() {
		$("#fS"+showingItem).removeClass("on");
		$("#fS"+nextNum).addClass("on");
		$("#fL"+nextNum).stop().fadeIn("250", function(){
			showingItem = nextNum;
			animating = false;
			seqTimer = setTimeout("seqNextItem()", 6000);
		});
	});
}
$(document).ready(function(){
	
	seqTimer = setTimeout("seqNextItem()", 6000);
	
	$("ul#fS li a").mouseenter(function(){
		if (!animating) {
			var thisId = $(this).parent("li").attr("id");
			var num = parseInt(thisId.substr(2, 1));
			
			$("#fL"+showingItem).hide();
			$("#fL"+num).show();
			$("#fS"+showingItem).removeClass("on");
			$("#fS"+num).addClass("on");
			showingItem = num;
		}
	});
	
	$("#flipbook").hover(function(){
		clearTimeout(seqTimer);
	}, function(){
		seqTimer = setTimeout("seqNextItem()", 2000);	
	});
	
	
	/***
	*
	* News Ticker
	*
	*/
		
	var options = {
  		newsList: "#newsticker",
 		startDelay: 10,
 		tickerRate: 30,
 		placeHolder1: "_",
 		placeHolder2: "_"
	}
	$().newsTicker(options);
	
});
