function scroller (type,obj,objs,interval,speed) {
	this.type = type;
	this.obj = obj;
	this.objs = objs;
	this.interval = interval;
	this.speed = speed;
	this.intMove = "";
}

scroller.prototype.init = function () {
	var o = eval(this.obj);
	if (this.objs.container.offsetHeight>this.objs.mask.offsetHeight) {
		if (this.type=="vertical"||this.type=="multi") {
			this.objs.scUp.onmouseover = function () { o.intMove = setInterval("callMoveUp("+o.obj+");",o.interval); }
			this.objs.scDn.onmouseover = function () { o.intMove = setInterval("callMoveDown("+o.obj+");",o.interval); }
			this.objs.scUp.onmouseout = this.objs.scDn.onmouseout = function () { o.stop(); }
			if (this.objs.container.style.top=="") this.objs.container.style.top = "0px";
			this.endY = parseInt(this.objs.container.style.top) - this.objs.container.offsetHeight + this.objs.mask.offsetHeight;
		}
	}
	if (this.objs.container.offsetWidth>this.objs.mask.offsetWidth) {
		if (this.type=="horizontal"||this.type=="multi"&&this.objs.container.offsetWidth>this.objs.mask.offsetWidth) {
			this.objs.scLeft.onmouseover = function () { o.intMove = setInterval("callMoveLeft("+o.obj+");",o.interval); }
			this.objs.scRight.onmouseover = function () { o.intMove = setInterval("callMoveRight("+o.obj+");",o.interval); }
			if (this.objs.container.style.left="") this.objs.container.style.left = "0px";
			this.objs.scLeft.onmouseout = this.objs.scRight.onmouseout = function () { o.stop(); }
			if (this.objs.container.style.left=="") this.objs.container.style.left = "0px";
			this.endX = parseInt(this.objs.container.style.left) - this.objs.container.offsetWidth + this.objs.mask.offsetWidth;
		}
	}
}

function callMoveUp (o) { o.up(); }
function callMoveDown (o) { o.down(); }
function callMoveLeft (o) { o.left(); }
function callMoveRight (o) { o.right(); }

scroller.prototype.up = function () {
	with (this.objs.container) style.top = (parseInt(style.top)<0) ?parseInt(style.top) + this.speed + "px" :"0px";
}

scroller.prototype.down = function () {
	with (this.objs.container) style.top = (parseInt(style.top)>this.endY) ?parseInt(style.top) - this.speed + "px" :this.endY + "px";
}

scroller.prototype.left = function () {
	with (this.objs.container) style.left = (parseInt(style.left)<0) ?parseInt(style.left) + this.speed + "px" :"0px";
}

scroller.prototype.right = function () {
	with (this.objs.container) style.left = (parseInt(style.left)>this.endX) ?parseInt(style.left) - this.speed + "px" :this.endX + "px";
}

scroller.prototype.stop = function () {
	clearInterval(this.intMove);
}

scroller.prototype.initSpecial = function () {
	this.oldOn = {};
	this.init();
	this.moveToItemOn();
	this.initEvent();
}

scroller.prototype.moveToItemOn = function () {
	this.moveToItems = this.objs.container.getElementsByTagName('a');
	this.moveToItemsOn = "";
	this.moveToWidth = 0;
	this.space = 10;
	for (var i=0;i<this.moveToItems.length&&this.moveToItemsOn=="";i++) {
		if (this.moveToItems[i].getElementsByTagName('strong')[0]=="[object]"||this.moveToItems[i].getElementsByTagName('strong')[0]=="[object HTMLSpanElement]") this.moveToItemsOn = this.moveToItems[i].getElementsByTagName('strong')[0];
		this.moveToWidth += this.moveToItems[i].offsetWidth + this.space;
	}
	if (this.moveToWidth-this.moveToItemsOn.offsetWidth!=this.space&&this.objs.container.offsetWidth>this.objs.mask.offsetWidth) with(this.objs.container) style.left = parseInt(style.left) - this.moveToWidth + parseInt(this.moveToItemsOn.offsetWidth) + "px";
	this.oldOn = this.moveToItemsOn.parentNode;
}

scroller.prototype.initEvent = function () {
	var o = this;
	for (var i=0;i<this.moveToItems.length;i++) {
		this.moveToItems[i].onclick = function () {
			this.innerHTML = "<strong>" + this.innerHTML + "</strong>";	
			o.oldOn.innerHTML = o.oldOn.innerHTML.substring(8,o.oldOn.innerHTML.indexOf("</"));
			o.oldOn = this;
		}
	}
}
