function slider (divname, width)
{
	this.object = new getobject(divname);
	this.count	= 0;
	this.timer;
	this.init = function ()
	{
		var divs = this.object.object.getElementsByTagName("div");
		var count = 0;
		var content = document.createElement("div");
		for (var i = 0; i < divs.length; i++)
		{
			if (divs[i].className == "fotoalbumthumb")
			{
				count++;
			}
		}
		
		this.object.setwidth(count * width);
		this.count = count;
		
	};
	this.fix = function ()
	{
		if (this.object.object.style.marginLeft == "")
			this.object.object.style.marginLeft = "0px";
	}
	this.back = function ()
	{
		var This = this;
		This.fix();
		var Target = parseFloat(This.object.object.style.marginLeft) + width;
		if (Target%width ==0)
		{
			var Amount = Math.ceil(Target / width) * -1;
			if (Amount > -1 &&
				Amount <= this.count)
			{
				var animate = function ()
				{
					if (parseFloat(This.object.object.style.marginLeft) + 5 < Target)
					{
						This.object.object.style.marginLeft =parseFloat(This.object.object.style.marginLeft) + 5 + "px";
						This.timer = setTimeout(function () { animate(); }, 15);
					}
					else
					{
						This.object.object.style.marginLeft =Target + "px";
						clearTimeout(This.timer);
					}
				}
				animate();
			}
		}
		
	}
	this.next = function ()
	{
		var This = this;
		This.fix();
		var Target = parseFloat(This.object.object.style.marginLeft) - width;
		if (Target%width ==0)
		{
			var Amount = Math.ceil(Target / width) * -1;
			if (Amount > -1 &&
				Amount+2 < this.count)
			{
				var animate = function ()
				{
					if (parseFloat(This.object.object.style.marginLeft) - 5 > Target)
					{
						This.object.object.style.marginLeft =parseFloat(This.object.object.style.marginLeft) - 5 + "px";
						This.timer = setTimeout(function () { animate(); }, 15);
					}
					else
					{
						This.object.object.style.marginLeft =Target + "px";
						clearTimeout(This.timer);
					}
				}
				animate();
			}
		}
	}
	this.init();
}
