// REPEAT AFTER LAST SLIDE CODE

var timerID=0;
		
		function timedMove(){
			timerID=setTimeout('moveNext()',10);
		}

function moveNext(){
var idx = sp1.getContentPanelIndex(sp1.currentPanel);
var maxPanels = sp1.getContentPanels().length - 1;
if (maxPanels == idx)
{
sp1.showFirstPanel();
}
else 
{
sp1.showNextPanel();
}
clearTimeout(timerID);
}	

function movePrev(){
var idx = sp1.getContentPanelIndex(sp1.currentPanel);
if (0 == idx)
{
sp1.showLastPanel();
}
else 
{
sp1.showPreviousPanel();
}
clearTimeout(timerID);
}

//AUTO ROTATE ON TIMER CODE

function slide(){
	var className = 'SlidingPanelsContent';		 //change the className that is on all your content panels..
	var panelCount = sp1.getContentPanelsCount();//get panel length
	var current = sp1.getCurrentPanel();		 //get current panel
	var group = sp1.getContentGroup();			 //get our group
	var panelNumber = 0;
	if(group.hasChildNodes()){
		var j = 0;
		for(var i = 0, l = group.childNodes.length; i < l; i ++){
			if(group.childNodes[i].className && group.childNodes[i].className.search(new RegExp("\\b" + className + "\\b")) != -1){ // if it has SlidingPanelsContent class we found the correct node.
				if(group.childNodes[i] == current) // if it matches our current panel, we have a number
					panelNumber = j;
				
				j++; //increase our panelcounter
			}
		}
	
	}
	sp1.showPanel(((panelNumber + 1 /* its currently 0 based, and the panelCount isn't so we need to increase */) != panelCount ? (panelNumber + 1) : 0));
};
function start(){
	window.slideShow = setInterval(slide,7000);
}
window.onload = start;

function stop(){
window.clearInterval(slideShow);
}; 