var pageMaskEffect = null;

document.observe("dom:loaded", function() {
										
	// MENU PANELS
	// initialize the menu panels
	var animate = (AHOY.Browser.isMSIE && AHOY.Browser.version < 7) ? false : true;
	$w("Products Consumer Academic Hotels Government Senior Office").each(function(name, index) {
		var collapsiblePanel = new Spry.Widget.CollapsiblePanel(name + "Panel", { contentIsOpen: false, enableAnimation: animate });

		$(name + "PanelTab").observe("mouseover", function(evt) {
			collapsiblePanel.open();
		}).observe("mouseout", function(evt) {
			collapsiblePanel.close();
		});

		$(name + "PanelContent").observe("mouseover", function(evt) {
			collapsiblePanel.open();
		}).observe("mouseout", function(evt) {
			collapsiblePanel.close();
		});
	});
	
	// HORIZONTAL RULES
	// nest the <hr> element into a div container for customization via CSS
	// unless it has already been nested in a div with "HorzRule" class name
	var allHorzRules = $$("hr");
	allHorzRules.each(function (hr) {
		var parentNode = hr.up();
		if (!(parentNode.tagName.toLowerCase() == "div" && parentNode.hasClassName("HorzRule"))) {
			$(hr).wrap("div", { "class": "HorzRule" });
		}
	});
	
	
	// PAGE MASK
	// overlays the page with a hidden mask that is displayed when a menu is open
	if ($("PageMask")) {
		var offsetTop = $("PageBody").getHeight();
		var offsetBtm = $("PageFoot").getHeight();
		$("PageMask").hide().setOpacity(0.0).setStyle({ height: offsetTop + offsetBtm + "px" });
	}
										
	InitPopUp();
});

var isMozilla =  AHOY.Browser.isMozilla && AHOY.Browser.version <= 1.8 ? true : false;
var sbFlashParams = isMozilla ? {} : { wmode: "transparent", bgcolor: "#000000" };

// initialize Shadowbox
Shadowbox.init({
	animate: false,
	animateFade: false,
	resizeDuration: 0.5,
	displayNav: false,
	useSizzle: false,
	initialWidth: 700,
	initialHeight: 1,
    //skipSetup: true,
	players: ["swf","flv","img"],
	flashParams: sbFlashParams
});


function toggleSelectMSIE(visible) {
	// hide all <select> elements for MSIE <7
	if (AHOY.Browser.isMSIE && AHOY.Browser.version < 7) {
		$$("select").invoke("setStyle", { visibility: visible });
	}
}

function viewDemo() {
	Shadowbox.open({
		content: "/swf/Demo_v1.1.swf?flvPath=/movies/&isMozilla=" + isMozilla.toString(),
		player: "swf",
		height: 383,
		width: 498
	});
}

function closeDemo() {
	Shadowbox.close();
}