﻿

///////////////////////////////////////////////////

//  LAYER VISIBILITY


//shows Layer

function showLayer(whichLayer)
{
if (document.getElementById)
{
// this is the way the standards work
var style2 = document.getElementById(whichLayer).style;
style2.display = "block";
}
else if (document.all)
{
// this is the way old msie versions work
var style2 = document.all[whichLayer].style;
style2.display = "block";
}
else if (document.layers)
{
// this is the way nn4 works
var style2 = document.layers[whichLayer].style;
style2.display = "block";
}
}

//hides layer
function hideLayer(whichLayer)
{
if (document.getElementById)
{
// this is the way the standards work
var style2 = document.getElementById(whichLayer).style;
style2.display = "none";
}
else if (document.all)
{
// this is the way old msie versions work
var style2 = document.all[whichLayer].style;
style2.display = "none";
}
else if (document.layers)
{
// this is the way nn4 works
var style2 = document.layers[whichLayer].style;
style2.display = "none";
}
}

//toggles layer
function toggleLayer(whichLayer)
{

if (document.getElementById)
{
// this is the way the standards work
var style2 = document.getElementById(whichLayer).style;
style2.display = style2.display? "":"block";
}
else if (document.all)
{
// this is the way old msie versions work
var style2 = document.all[whichLayer].style;
style2.display = style2.display? "":"block";
}
else if (document.layers)
{
// this is the way nn4 works
var style2 = document.layers[whichLayer].style;
style2.display = style2.display? "":"block";
}
}


////////////////////////////////////////////////////


//displays menu section


function displaySubmenu (arg) {

//highlights active item

	//read page name and store.
	
	var currentpage = document.getElementById('pageName');
	
	var currentItem = currentpage.innerHTML.toLowerCase();

 //cycle through all <a> tags and make one that matches page name class = "menuactive"
	var items = document.getElementsByTagName("a");

	for (i=0; i<items.length; i++) {
	var itemName = items[i].getAttribute('id');
		if (itemName != "" && currentItem.indexOf(itemName) > -1) {
			var thisPage = itemName;
			items[i].className = "menuactive";
			}
		}

//allocate page names to respective submenu blocks

var shortFilms = new Array ('evol', 'starers', 'superfly', 'fight');
var commercials = new Array ('beyond', 'vanish', 'myers', 'camden', 'beyond');
var promos = new Array ('brasstooth', 'amira', 'rewind', 'diablo', 'moths', 'thinskin');
var corporate = new Array ('gce');

if (arg == undefined) {
	//short films
	for (s in shortFilms) {
	if (thisPage == shortFilms[s]) var _submenu = "short_films_sub";
	}
	//promos and commercials
	for (t in commercials) {
	if (thisPage == commercials[t]) var _submenu = "commercials_sub";
	}
	for (v in promos) {
	if (thisPage == promos[v]) var _submenu = "promos_sub";
	}
	//corporate
	for (u in corporate) {
	if (thisPage == corporate[u]) var _submenu = "corporate_sub";
	}
	
}

else {
_submenu = arg
}

//alert (" _submenu = " + _submenu + " and arg = " + arg)
//turn off all submenus

	var divs = document.getElementsByTagName('div');

	for (i = 0 ; i < divs.length; i++) {
		 var divstring = divs[i].id.toString();
		 
		 if (divstring.indexOf('_sub')>-1) {
		 hideLayer(divstring);
		 }
}

// turn on required submenu


var divs = document.getElementsByTagName('div');

	for (i = 0 ; i < divs.length; i++) {
		 var divstring = divs[i].id.toString();
		 if (divstring == _submenu) {
		showLayer(divstring);
		 }
}
	
}


