function letItRoll(holderId,shortlistClassname,elm,s,way){
	this.id = letItRoll.Instances.length;
	letItRoll.Instances[this.id] = this;
	this.c;
	this.rollerHolder;
	this.rollerHolderCon;
	this.dists;
	this.itWid;
	this.scrWid;
	this.choser;
	this.elm = elm;
	this.ds;
	this.lists;
	this.roller;
	this.a;
	this.holderId = holderId;
	this.shortlistClassname = shortlistClassname;
	this.s = s;
	this.way = way;
	this.mutliply = multiplicator;
	this.anim = animate;
	this.mutliply();
	this.start2 = start2;
}

letItRoll.Instances = new Array();
rollie = new Array();

function multiplicator(){
	this.c = 0;
	this.rollerHolder = document.getElementById(this.holderId);
	this.rollerHolderCon = this.rollerHolder.innerHTML;
	this.dists = this.rollerHolder.getElementsByTagName(this.elm);
	if(this.way == "vertical"){
		this.itWid = this.dists[0].offsetHeight;
		this.scrWid = this.rollerHolder.offsetHeight;
	}
	else
	{
		this.itWid = this.dists[0].offsetWidth;
		this.scrWid = this.rollerHolder.offsetWidth;
	}
	this.choser = this.scrWid/this.itWid;
	if(this.choser > 2 && this.choser < 100){
		this.choser = Math.ceil(this.choser);
	}
	else
	{
		this.choser = 2;
	}
	for(i=0;i<this.choser;i++){
		this.rollerHolder.innerHTML = this.rollerHolder.innerHTML + this.rollerHolderCon;
	}
	this.ds = this.s;
	this.lists = this.rollerHolder.getElementsByTagName(this.elm);
	this.roller = new Array();
	this.a = new Array();
	for(i=0;i<this.lists.length;i++){
		if(this.lists[i].className == this.shortlistClassname){
			this.lists[i].id = this.shortlistClassname + this.c;
			this.roller[this.c] = document.getElementById(this.shortlistClassname + this.c);
			this.a[this.c] = 0;
			this.c++;
		}
	}
	this.anim();
}

function animate(){
	this.c = new Array();
	for(this.k=0;this.k<this.roller.length;this.k++){
		this.c[this.k] = this.k*this.itWid;
		if(this.way == "vertical"){
			this.roller[this.k].style.top = this.c[this.k] + this.a[this.k] + 'px';
		}
		else
		{
			this.roller[this.k].style.left = this.c[this.k] + this.a[this.k] + 'px';
		}
		if(this.c[this.k] + this.a[this.k] < -this.itWid){
			this.a[this.k] = eval(this.choser*this.itWid) - this.c[this.k];
		}
		this.a[this.k] = this.a[this.k] - this.ds;
	}
}

function loader(who){
	obj = window;
	evt = 'load';
	if (obj.attachEvent){
		obj.attachEvent('on'+evt,who);
	}
	else if (obj.addEventListener){
		obj.addEventListener(evt,who,false);
	}
}

function start2 () {
	window.setInterval('letItRoll.Instances['+this.id+'].anim()', 60);
}
function doIt(holderId,shortlistClassname,elm,s,way,mouseStop){
	rollie[holderId] = new letItRoll(holderId,shortlistClassname,elm,s,way,mouseStop);
	
	if(!mouseStop) {
		rollie[holderId].rollerHolder.onmouseover = function(){
			rollie[holderId].ds=0;
		}
		rollie[holderId].rollerHolder.onmouseout = function(){
			rollie[holderId].ds=rollie[holderId].s;
		}
	}
	rollie[holderId].start2();
}
function rollIt(screen,roll,elm,s,way,mouseStop,type)
{
	if(way == "vertical")
	{
		var style = "jsmultiscroll-v";
	}
	else
	{
		var style = "jsmultiscroll-h";
	}
	
	if(type == "network")
	{
		$(document).ready
		(
			function()
			{
				// Check if netwerk hook is set
				if($('.networkHookOuter').length)
				{
					$('.networkHookItemContainer').each
					(
						function()
						{
							// Cache this
							var $this = $(this);
							
							// Get link elements
							var link = $this.find('.networkHookItemLink a').attr('href');
							var target = $this.find('.networkHookItemLink a').attr('target');
							var title = $this.find('.networkHookItemLink a').attr('title');
							
							// If link is set wrap image
							if(link)
							{
								// Get image source
								var img = $this.find('.hookNetworkLogo').html();
								
								// Check if title is not set -> empty
								if(!title){var title = '';}
								
								// Replace div with image
								$this.replaceWith('<a href="'+link+'" target="'+target+'" title="'+title+'">'+img+'</a>');
							}
						}
					);
					
					// Wrap all items
					$('.networkHookOuter a').wrapAll('<div id="'+screen+'" class="'+style+'"><div class="'+roll+'"></div></div>');
				}
			}
		);
	}
	else if(type == "shortlist")
	{
		$(document).ready
		(
			function()
			{
				// Check if shortlist hook is set
				if($('.jslOuter').length)
				{
					// Remove cleaners
					$('.jslKwCleaner').remove();
					
					// Wrap all items
					$('.jslItemContainer').wrapAll('<div id="'+screen+'" class="'+style+'"><div class="'+roll+'"></div></div>');
				}
			}
		);
	}

	var looper = function(){doIt(screen,roll,elm,s,way,mouseStop);}
	loader(looper);
}
