var ScrollerH_w = 619;
var timer;
var AllowScroll;

//Set variables for the scrollers
var CategoryProducts = 8; //<< - Amount of products on the bottom
var CategoryProductWidth = 102;

var InnerScrollerH_w = CategoryProducts * CategoryProductWidth;

//var InnerScrollerV_h = document.getElementById("InnerScrollerV").offsetHeight;
//var InnerScrollerH_w = document.getElementById("InnerScrollerH").offsetWidth;

//ALLOW OR DISABLE SCROLL

//Horizontal
function startScrollLeft()
{
	AllowScroll = 1;
	moveLeft();
}
function startScrollRight()
{
	AllowScroll = 1;
	moveRight();
}

//Stop
function stopScroller()
{
	AllowScroll = 0;
}



//MOVE H SCROLLER TO THE LEFT
function moveLeft()
{
		var DifferenceH = (InnerScrollerH_w - ScrollerH_w) * (-1);
		var CurrentPosition = document.getElementById("InnerScrollerH").style.left;
		var CurrentPositionH = CurrentPosition.split("px");
		CurrentPositionH = CurrentPositionH.join("");
				
		if(CurrentPositionH > DifferenceH)
		{
			if(AllowScroll == 1)
			{
				$("#InnerScrollerH").animate({"left": "-=10px"}, 1);
				timer=setTimeout("moveLeft()",100);
			}
		}
}
//MOVE H SCROLLER TO THE RIGHT
function moveRight()
{
		var DifferenceH = (InnerScrollerH_w - ScrollerH_w) * (-1);
		var CurrentPosition = document.getElementById("InnerScrollerH").style.left;
		var CurrentPositionH = CurrentPosition.split("px");
		CurrentPositionH = CurrentPositionH.join("");
	
		if(CurrentPositionH < -1)
		{
			if(AllowScroll == 1)
			{
				$("#InnerScrollerH").animate({"left": "+=10px"}, 1);
				timer=setTimeout("moveRight()",100);
			}
		}
}
