var namedTimers = {}; // contains namedtimers
var namedIntervals = {}; // contains namedintervals
var currentPopup = "";
function setNamedTimeout(name,func,msec)
{
	if(namedTimers[name])
		clearNamedTimeout(name);
		
	namedTimers[name] = setTimeout(function(){
		clearNamedTimeout(name);
		return func.apply(arguments);		
	}, msec);
	
	return name;
}

function clearNamedTimeout(name)
{
	if (namedTimers[name])
	{
		clearTimeout(namedTimers[name]);
		delete namedTimers[name];
	}
	return true;
}

function hidePopups()
{
	currentPopup = "";
	$("div#highlights .lift").animate({marginTop: "476"}, 100);
	return true;
}

function hideCurrent(id)
{	
	
	return true;
}

function pagerFactory(idx, slide) {			
	return '<a href="javascript: void();"></a>';
};

$(document).ready(function() {
	$('#slideshow').cycle({
		fx: 'fade',
		speed:  1000,
		timeout:  5000
	});

	$("a.strength").hover(
		function(){
			if(currentPopup != $(this).attr("id") && currentPopup != "")
			{
				id = "#"+currentPopup;				
				$(id).next(".lift").animate({marginTop: "476"}, 100);
			}
			currentPopup = $(this).attr("id");
			$(this).next(".lift").animate({marginTop: "0"}, 250);			
			clearNamedTimeout("popuptimer");
		},
		function(){
			setNamedTimeout("popuptimer", hidePopups, 500);
		}
	);
	
	$("div#highlights .lift").hover(
		function() {
			clearNamedTimeout("popuptimer");
		},
		function() {
			setNamedTimeout("popuptimer", hidePopups, 500);
		}
	);
	
	if($("div#slideshowContainer"))
	{
		$('#slideshowContent').cycle({
			fx: 'fade',
			timeout: 5000
		});

	}
	
});
