
var certonaScrollVar = 0;

function certonaScrollLeft()
{
    //the actual response may not contain resx.rrnum number of items, so we need to check for this.
    var rrnum = getActualNumOfElements();

    //hide the rightmost visibile item and leave it alone
    document.getElementById('certonaScroller_'+((certonaScrollVar+3)%rrnum)).style.display = 'none';
    //bring the rightmost hidden item to the left side
    var myScrollerUL = document.getElementById('certonaScroller_'+((certonaScrollVar+rrnum-1)%rrnum));
    var ul = myScrollerUL.parentNode;

    ul.insertBefore(myScrollerUL,document.getElementById('certonaScroller_'+certonaScrollVar));

    if(certonaScrollVar == 0)
    {
      certonaScrollVar = rrnum;
    }
    certonaScrollVar = (certonaScrollVar - 1);
    document.getElementById('certonaScroller_'+certonaScrollVar).style.display = 'block';
}

function certonaScrollRight()
{
    //the actual response may not contain resx.rrnum number of items, so we need to check for this.
    var rrnum = getActualNumOfElements();

    //hide the leftmost item
    document.getElementById('certonaScroller_'+certonaScrollVar).style.display = 'none';
    
    //bring it to the right side
    var myScrollerUL = document.getElementById('certonaScroller_'+certonaScrollVar);
    var ul = myScrollerUL.parentNode;

    ul.appendChild(myScrollerUL);
    if(certonaScrollVar == rrnum-1)
    {
      certonaScrollVar = -1;
    }
    certonaScrollVar = (certonaScrollVar + 1);
    document.getElementById('certonaScroller_'+((certonaScrollVar+3)%rrnum)).style.display = 'block';
}

function getActualNumOfElements()
{
   var index = parseInt(resx.rrnum) - 1;
   while(document.getElementById('certonaScroller_'+index) == null)
   {
      index--;
   }
   return index+1;
}


	


