// JavaScript Document

function MM_changeProp(objId,x,theProp,theValue) { //v9.0
  var obj = null; with (document){ if (getElementById)
  obj = getElementById(objId); }
  if (obj){
    if (theValue == true || theValue == false)
      eval("obj.style."+theProp+"="+theValue);
    else eval("obj.style."+theProp+"='"+theValue+"'");
  }
}

var current = 0; //Current Panel

function StartSliding(){
	var spc = sp2.getContentPanelsCount(); //Returns the amount of panels (sp1 beein the name of your constructor)
	sp2.showPanel(current);
	t = setTimeout(function(){StartSliding()},12000); // 5000 beein the amount of milisec till it switches panel
	if(current == spc)
	{ 
		current = 0;
	}
	else
	{
	    current = current +1;
	}
	setButtonClass();
	return;
}

function StopSliding(){
	if(typeof(t) == 'number')
	{
	    clearTimeout(t);
	}
}
function setButtonClass(){
	var data = sp2.getCurrentPanel(); //returns the HTML object of the current panel
	var strPanelNumber = data.id.substr(data.id.lastIndexOf("p") + 1);
	for(var intPanelCount = 1; intPanelCount <= sp2.getContentPanelsCount(); intPanelCount++)
	{
	    document.getElementById("colorUpdate" + String(intPanelCount)).className = "blank";
	}
	document.getElementById("colorUpdate" + String(strPanelNumber)).className = "focalPanelIndicator";
}

function ChangeButton(intButtonNumber)
{
    current = intButtonNumber;
    sp2.showPanel(intButtonNumber);
    setButtonClass();
}