var wait = true;
var displayTime = 8;
var speed = 12;
var scrollitem;
var currentitem = 0;
var totalitems;
var back = false;

function infoscroll(){
	var position = parseInt(scrollitem.style.left);
	if(!wait){
		if(back)
  			position = position + speed;
  		else
 			position = position - speed;
  		
  		scrollitem.style.left = position + "px";
  		
  		if(back){
	 		if((currentitem * -209) < position){
	 			scrollitem.style.left = (currentitem * -209) + "px";
	 			if(currentitem == 0)
	 				back = false;
				wait = true;
			}
		}
		else {
	 		if((currentitem * -209) > position){
	 			scrollitem.style.left = (currentitem * -209) + "px";
	 			if(currentitem == (totalitems - 1))
	 				back = true;
				wait = true;
			}
		}
		setTimeout("infoscroll()",100);
    } else{
    	if(back)
    		currentitem--;
    	else
   			currentitem++;
    		
   	    wait = false;
		setTimeout("infoscroll()", displayTime * 1000);
	}
}

function infoscrollInit(lenght){
	totalitems = lenght;
	scrollitem = document.getElementById('infoscroll');
	scrollitem.style.left = "0px";
	scrollitem.style.width = (209 * lenght) + "px";
	infoscroll();
}


