$(function(){
	$next = $('<span id="next_sponsors" />');
	$prev = $('<span id="prev_sponsors" />');
	$('#sponsors-rotator').carousel($next, $prev);
	function next()
		{
			$prev.trigger("click");
			setTimeout(next, 3000);
		}
	next();
	sortOutIe(); /** Shhhh.... don't tell anyone ;) */

	$('.popup').popupWindow({ 
		centerBrowser:1,
		width:900,
		height:400
	});

});

$().ready(function() {
	$('.panel-click').click(function (){
		window.location = $(this).find('A').attr('href');
	});
	$('#tactical.rhs-bar .panel-click').hover(
		function (){ $(this).find('H2').css({'border-top': '5px solid rgb(130, 0, 66)'}) },
		function (){ $(this).find('H2').css({'border-top': '5px solid rgb(242, 243, 235)'}) }
	);

/* ETHICORE BUTTONS */
	$("#tactical A").addClass('niceanimation').append('<div class="animationhelper"></div>');
	$("#tactical A").each(function () {
		$$this = $(this);
		$.data($$this, 'animating', false);
		$(this).find (".animationhelper").css("background-image", $(this).css("background-image"));
	}).hover ( function () 
	{
		if ($.data($$this, 'animating')===false)
		{
			$.data($$this, 'animating', true);
			$(this).find(".animationhelper").fadeOut('fast', function () {$.data($$this, 'animating', false)} );
		}
	}, function () 
	{
		$(this).find(".animationhelper").fadeIn('slow');
	}); // end $(.tactical-box).each
				
	$(".tactical A").mousedown (function () {
		$(this).addClass("active");
	}).mouseup (function () {
		$(this).removeClass("active");
	});
});


function sortOutIe()
{
	if ($.browser.msie && parseInt($.browser.version) == 7)
	{
		$("#sponsors-rotator").css({
			position: 'relative'
		});
	}
	if ($.browser.msie && parseInt($.browser.version) < 8)
	{
		$("#sponsors-rotator li").css({
			marginLeft: '-40px',
			marginRight: '60px'
		});
	}
}

