// initialize activeKey
var activeKey = 0;

// Calculate max height of #flashAnimationContent
$(document).ready(function(){
    $("#flashAnimationContent div").each( function(i) {
        if ($(this).height() > maxHeight) { maxHeight = $(this).height(); }
    });
    $("#flashAnimationContent").css("height", maxHeight + "px");
    
    // IE6 Fix
    // Negative left margin is apparently affected differently in IE6 when using an <object> instead of an <img> in #pageImageHeader?
    if (jQuery.browser.msie) {
        if(parseInt(jQuery.browser.version) == 6)
        {
           $("#navigation").css("margin-left","-1559px");
        }
    }
});

// Instantiate the Circle Nav Widget
swfobject.embedSWF("CircleNav.swf", "pageImageHeader", "666", "249", "9.0.0", "", flashvars, params);
swfobject.createCSS("#pageImageHeader","outline:none");

function getFlashMovie(movieName) 
{
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movieName] : document[movieName];
}

// Behavior that gets run on callback from the Flash widget
function changeContent(key)
{
	if (activeKey != 0)
	{
        $("#" + activeKey).hide();
        $("#" + key).show();
	}
	else
	{
        $("#" + key).show();
	}
	activeKey = key;
}

// Next/Previous calls to Flash widget
function moveNext()
{
	getFlashMovie("pageImageHeader").nextNode();
}

function movePrevious() 
{
	getFlashMovie("pageImageHeader").previousNode();
}

