/*******************************************************************************
____________________________ API DOCUMENTATION BEGIN ___________________________
````````````````````````````````````````````````````````````````````````````````
Functionality for previous and next control.

````````````````````````````````````````````````````````````````````````````````
_____________________________ API DOCUMENTATION END ____________________________
*******************************************************************************/

//FUNCTION-- init groups
function initGroups() {
 currentGroup = 0;
 ledPositionArr = new Array(70, 81, 92, 103, 114, 127, 137, 148, 159, 170); //led absolute left position for each group
 groupsArr = new Array(); //group array

 for(var j=1;j<=10;j++) {groupsArr.push(document.getElementById("g"+j));} //load groups
 groupsArr[currentGroup].style.display = "block";
}

//FUNCTION-- set left position of led element
function setLeftPosition() {
 if(document.all) document.getElementById("led").style.pixelLeft = ledPositionArr[currentGroup];
 else document.getElementById("led").style.left = ledPositionArr[currentGroup]+"px";
}

//FUNCTION-- sets group for viewing
function setGroup(argDirection) {
 if(pageLoaded)
 {
  groupsArr[currentGroup].style.display = "none";

  if(argDirection) //next
  {
	 if(currentGroup < groupsArr.length-1) {currentGroup += 1;}
	 else {currentGroup = 0;}
   groupsArr[currentGroup].style.display = "block";
	 setLeftPosition();
  }
  else //previous
  {
	 if(currentGroup != 0) {currentGroup -= 1;}
	 else {currentGroup = groupsArr.length-1;}
   groupsArr[currentGroup].style.display = "block";
 	 setLeftPosition();
  }
 }
}