// main ffe //
var recipeLinks = ["","","http://www.facebook.com/Truvia","http://www.truvia.com/eclub/","","http://truvia.com/recipes/"];
		
var events = ["","","espresso","coffee","","raspberry-tart"];

// for event tracking //
function trackClick(evt){
	pageTracker._trackEvent("Billboard",evt);
}

// for the secondary FFE //
var current;
var urls = ["http://truvia.com/recipes/beverages/mocktails-cocktails/raspberry-lojito/","http://truvia.com/recipes/all-recipes/onion-tart/","http://truvia.com/recipes/savories/main-dishes/","http://truvia.com/recipes/sweets/other-desserts/chocolate-fondue/"];

function swapFFE(target){
	clearTimeout(timer);
	$('#FFE' + current).animate({width:'125px'}, 500);
	$('#' + current + '-2').fadeOut('slow');
	
	$('#FFE' + target).animate({width:'541px'}, 500);
	$('#' + target + '-2').fadeIn('slow');
	
	current = target;
	startTimer();
}
function rollover(target){
	$('#shine' + target).animate({top:'150px'}, 500, function(){resetShine(target)});
}
function resetShine(target){
	document.getElementById('shine'+target).style.top = '-150px'
}
function linkFFE(target){
	document.location = urls[current-1];
}
function goNext(){
	var target;
	if(current < 4){
		target = current+1;
	}else{
		target = 1;
	}
	$('#FFE' + current).animate({width:'125px'}, 500);
	$('#' + current + '-2').fadeOut('slow');
	
	$('#FFE' + target).animate({width:'541px'}, 500);
	$('#' + target + '-2').fadeIn('slow');
	
	current = target;
	startTimer();
}
var timer;
function startTimer(){
	timer = setTimeout("goNext()", 6000);
}

$(document).ready(function(){swapFFE(1)});
