//document ready function
var popid;
$(document).ready(function()
{

	// Handle content rotation in the bottom left ad area
	$("#rotate1").css("display", "none");
	$("#forwardback").css("visibility", "visible");
	//var currentRotateImage = Math.floor(Math.random() * 2) + 1;
	var currentRotateImage = 1;
	$("#rotate" + currentRotateImage).css("display", "block");

	$("#rotatelast").click(function()
	{
		$("#rotate" + currentRotateImage).css("display", "none");
		currentRotateImage--;
		if (currentRotateImage == 0)
		{
			currentRotateImage = 5;
		}
		$("#rotate" + currentRotateImage).css("display", "block");
		//$(".onofflight:last").after($(".onofflight:first"));
		
		var nextButtonId = (currentRotateImage + 1) == 6 ? 1 : (currentRotateImage + 1);
		var newsrc = "images/rotate" + nextButtonId + "_off.jpg";
		$("#button" + nextButtonId).attr("src", newsrc);

		var newsrc1 = "images/rotate" + (currentRotateImage) + "_on.jpg";
		$("#button" + (currentRotateImage)).attr("src", newsrc1);
	});

	$("#rotatenext").click(function()
	{
		$("#rotate" + currentRotateImage).css("display", "none");
		currentRotateImage++;
		if (currentRotateImage == 6)
		{
			currentRotateImage = 1;
		}
		$("#rotate" + currentRotateImage).css("display", "block");
		//$(".onofflight:first").before($(".onofflight:last"));

		var prevButtonId = (currentRotateImage - 1) == 0 ? 5 : (currentRotateImage - 1);
		var newsrc = "images/rotate" + prevButtonId + "_off.jpg";
		$("#button" + prevButtonId).attr("src", newsrc);

		var newsrc1 = "images/rotate" + (currentRotateImage) + "_on.jpg";
		$("#button" + (currentRotateImage)).attr("src", newsrc1);
	});

	//IE6 png fix
	if (($.browser.msie) && (parseInt(jQuery.browser.version) < 7))
	{
		$("img[src$=.png], #lineuplink").css("behavior", "url(js/iepngfix.htc)");
		$(".prodpop").wrapInner($("<div></div>"));
	}
	//IE6 png rollover fix
});
