// SHOW & HIDE LAYERS

/*
  This code is from Dynamic Web Coding 
  at http://www.dyn-web.com/
  Copyright 2001-3 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  Permission granted to use this code 
  as long as this entire notice is included.
*/

// resize fix for ns4
var origWidth, origHeight;
if (document.layers) {
	origWidth = window.innerWidth; origHeight = window.innerHeight;
	window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

var cur_lyr;	// holds id of currently visible layer
function swapLayers(id) {
  if (cur_lyr) hideLayer(cur_lyr);
  showLayer(id);
  cur_lyr = id;
}

function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "visible";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "hidden";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? getLyrRef(id,document): null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}

// get reference to nested layer for ns4
// from old dhtmllib.js by Mike Hall of www.brainjar.com
function getLyrRef(lyr,doc) {
	if (document.layers) {
		var theLyr;
		for (var i=0; i<doc.layers.length; i++) {
	  	theLyr = doc.layers[i];
			if (theLyr.name == lyr) return theLyr;
			else if (theLyr.document.layers.length > 0) 
	    	if ((theLyr = getLyrRef(lyr,theLyr.document)) != null)
					return theLyr;
	  }
		return null;
  }
}

// PLAYER WINDOW

var theHeight;
var theWidth;
var theTop;
var theLeft;
var features;

function winOpen1(url,name) {
		if (screen.width<=640){
		  	theWidth=600;
  		} else {
  		theWidth=.8*screen.width;
  		}
//	theHeight=.73*theWidth;
	theHeight=.615*theWidth + 65;
	theTop=(screen.height/2)-(theHeight/2);
	theLeft=(screen.width/2)-(theWidth/2);  	
	features='height='+theHeight+',width='+theWidth+',top='+theTop+',left='+theLeft+',resizable';
	window.open(url,name,features)
}

function winOpen2(url,name,w,h,f) {
	theTop=(screen.height/2)-(h/2);
	theLeft=(screen.width/2)-(w/2);  	
	features='height='+h+',width='+w+',top='+theTop+',left='+theLeft+','+f;
	window.open(url,name,features)
}	

// ROLLOVER

browserName=navigator.appName;
browserVer=parseInt(navigator.appVersion);
if(browserVer >=4)
version="4";
else
version="3";
if (version=="4")
{
enter_on=new Image;
enter_on.src="images/enter-on.gif";
enter_off=new Image;
enter_off.src="images/enter-off.gif";
}
function rollIn(imgName, picName)
{
if (version=="4")
{
document[imgName].src=eval(picName + "on.src");
}
}
function rollOut(imgName, picName)
{
if (version=="4")
{
document[imgName].src=eval(picName + "off.src");
}
}
