

/*************************************************************************

  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

  regarding conditions under which you may use this code.

  This notice must be retained in the code as is!

*************************************************************************/

			

var isRotating = true;



var gnNumPodLayers = 5;



// onresize for ns4

var origWidth, origHeight;

if (document.layers) {

	origWidth = window.innerWidth; origHeight = window.innerHeight;

	window.onresize = function() { funPositionAds(); if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }

}



var cur_lyr = 1;	// holds id of currently visible layer

function swapLayers(id, nNumLayers) {

	if (nNumLayers != null) gnNumPodLayers = nNumLayers;

	if (cur_lyr != id) {

		hideLayer(cur_lyr);

		showLayer(id);

		cur_lyr = id;

	}

}



function showLayer(id) {

	var lyr = getElemRefs("lyr" + id);

	var btn = getElemRefs("podbutton" + id);

	if (lyr && lyr.css) {

		lyr.css.visibility = "visible";

		if (btn.className) btn.className = "buttonon";

		else if (btn.setAttribute) btn.setAttribute("class","buttonon");

	}

}



function hideLayer(id) {

	var lyr = getElemRefs("lyr" + id);

	var btn = getElemRefs("podbutton" + id);

	if (lyr && lyr.css) {

		lyr.css.visibility = "hidden";

		if (btn.className) btn.className = "buttonoff";

		else if (btn.setAttribute) btn.setAttribute("class","buttonoff");

	}

}



function getElemRefs(id) {

	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;

	if (el) el.css = (el.style)? el.style: el;

	return el;

}



function initLayers(id) {

	if (cur_lyr) hideLayer(cur_lyr);

	showLayer(id);

	cur_lyr = id;

	thetimer = setTimeout("RotateLayer()",5000);

	index1 = 1;

}



function RotateLayer() {

	index1 = index1 + 1

	if (index1 == gnNumPodLayers+1) {

		index1 = 1;

	}

	swapLayers(index1 );

	thetimer = setTimeout("RotateLayer()",5000);

}



function StartRotation() {

	if (isRotating == false) {

		thetimer = setTimeout("RotateLayer()",5000);

		isRotating = true;

	}

}



function StopRotation() {

	isRotating = false;

	clearTimeout(thetimer);

}



function PrevRotation() {

	index1 = index1 - 1

	if (index1 == 0) {

		index1 = gnNumPodLayers;

	}

	swapLayers(index1);

}

			

function NextRotation() {

	index1 = index1 + 1

	if (index1 == gnNumPodLayers+1) {

		index1 = 1;

	}

	swapLayers(index1);

}	