Event.observe(window, 'load', function() {
/*
 *
 * homepage/subpage movie menu
 *
 */
	var isIE6 = (typeof document.body.style.maxHeight == "undefined");
	var isSubPage = Try.these(
		function() {
			return $("subpage").match("body");
		},
		function() {
			return false;
		}
	);
	$$("div.movie").each(function(movie) {
		Event.observe(movie, "mouseover", function() {
			if (isIE6 && isSubPage) {
				// for IE 6
				movie.setStyle({background:"#000033"});
			}
			movie.immediateDescendants().each(function(childElement) {
				childElement.setStyle({visibility:"visible"});
			});
		});
	});
	$$("div.movie").each(function(movie) {
		Event.observe(movie, "mouseout", function() {
			if (isIE6 && isSubPage) {
				// for IE 6
				movie.setStyle({background:"#999999 url(../images/web/subpagePosterbg.jpg)"});
			}
			movie.immediateDescendants().each(function(childElement) {
				childElement.setStyle({visibility: childElement.hasClassName("poster") ? "visible" : "hidden"});
			});
		});
	});

/*
 *
 * subpage sub-menu
 *
 * currently this just handles the rollover for sitelink
 *
 */
	if(isSubPage) {
		var synopsisOnly = $("screenings").match("h2.subNavSynopsisOnly");
	}
	if(isSubPage &&  !synopsisOnly) {
		 $$("div.subNav h2").each(function(subnav) {
			Event.observe(subnav, "mouseout", function() {
				subnav.setStyle({
					background:"#333333",
					border:"#999999 1px solid"
				});
				if(subnav.readAttribute("id") == "screenings") {
					subnav.immediateDescendants().each(function(childElement) {
						childElement.setStyle({visibility:"hidden"});
					});
				}
			});
			Event.observe(subnav, "mouseover", function() {
				subnav.setStyle({
					background:"#000033",
					border:"#000033 1px solid"
				});
				if(subnav.readAttribute("id") == "screenings") {
					subnav.immediateDescendants().each(function(childElement) {
						childElement.setStyle({visibility:"visible"});
				});
				}
			});
		});
	}
})
