var showRun=cookieGet("showRun",1);
var showImg=cookieGet("showImg",1);
var showSpeed=5000;

showState();

function showState()
{
	if (showRun==1)
	{
		document.getElementById("showCtrl").src="../_rcm/_images/btnPause.gif";
		showInt=setInterval('showNext()',showSpeed);
	}
	else
	{
		document.getElementById("showCtrl").src="../_rcm/_images/btnPlay.gif";
		clearInterval(showInt);
	}
}

function showNext()
{
	showImg++;
	if (showImg>=imgCt) showImg=0;
	document.getElementById('showDisp').src=SSImages[showImg].src;
	document.getElementById('showCur').innerHTML=showImg+1;
	cookieSave("showImg",showImg,365);
}

function showToggle()
{
	showRun=1-showRun;
	cookieSave("showRun",showRun,365);
	if (showRun==1) showNext();
	showState();
}

/* cookie functions */

function cookieGet(cookiename,defval)
{
	var x=document.cookie.indexOf(cookiename+"=");
	if (x==-1) x=document.cookie.length+1;

	var y=document.cookie.indexOf(";",x+cookiename.length+1);
	if (y==-1) y=document.cookie.length+1;

	val=document.cookie.substr(x+cookiename.length+1,y-(x+cookiename.length+1));
	if (val=="" && defval) val=defval;
	return val;
}

function cookieSave(name,value,days)
{
	if (days)
	{
		var date=new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires="; expires="+date.toGMTString();
	}
	else var expires="";
	document.cookie=name+"="+value+expires+"; path=/";
}


