














 










var s_account = "";
var maxcount = 3;
var counter = 0;
var enabled = false;
var arr = new Array()
curIndex = 0;

var init = false;
var playing = true;

var playbtn = new Image();
var pausebtn = new Image();
var delay = 8000;

playbtn.src = "/site_images/icons_play.gif";
pausebtn.src = "/site_images/icons_pause.gif";

function getIndex(i){
	if (i>0){
		curIndex = ((curIndex + 1) == arr.length) ? 0 : curIndex + 1;
	}else{
		curIndex = (curIndex == 0)? arr.length - 1 : curIndex - 1;
	}
	return curIndex;
}

function loadModule(i){
	clearTimeout(timerID);
	if(mediawall && enabled){
		enabled = false;
		mediawall.document.location.replace(arr[getIndex(i)]);
	}
}

function pauseRotate(){
	clearTimeout(timerID);
	playing = false;
}

function playRotate(len){
	maxcount = (len==0) ? maxcount : (len*2);
	if(counter < maxcount){
		if (init){
			timerID = setTimeout("loadModule(1)",delay);
			counter ++
			playing = true;
		}
	}else{
		togglePlay();
	}
}

function togglePlay(){
	if (document.getElementById) imgObj = document.getElementById('play_pause'); // ie5/ns6
	else if (document.layers) imgObj = document.container.document.controls.document.play_pause; // ns4
	else imgObj = document.play_pause; // ie4
	if (playing) {
		pauseRotate();	
		imgObj.src = playbtn.src;		
	}
	else {
		if(counter >= maxcount) counter = 0;
		playRotate(0);
		imgObj.src = pausebtn.src;	
	}
}

function setRotation(rArr){
	if (rArr) arr = rArr;
	if (arr.length > 1) displayControls(true);
	else displayControls(false);
	init = true;
	enabled = true;
	if (playing && arr.length > 1) playRotate(arr.length);
}

function displayControls(mode) {
	var m = (mode == true) ? "visible" : "hidden";
	if (document.getElementById) document.getElementById('controls').style.visibility = m; // ie5/ns6
	else if (document.layers) document.container.document.controls.visibility = m; // ns4
	else document.all.controls.style.visibility = m; // ie4
}
