var off=148;
if(navigator.appName == "Netscape")
	off= 145;

var tileSlider = {
	pageSize: 1,
	offset: off,
	delay: 10,
	sliderObj: { },
	timeout: {},
	count: 0, 
	pos: 0,
	curPos: 0,
	counter: 0,
	
	init:function(newTileCount, newSliderObj){
		this.count = newTileCount;
		this.sliderObj = newSliderObj;
		this.sliderObj.style.width = this.offset + (newTileCount * this.offset) + 'px';
	},

	prev:function(){
		var curPage = (Math.ceil(Math.abs(this.pos / this.offset)) / this.pageSize) + 1;
		if (curPage > 1) {
			this.curPos = this.pos;
			this.pos += (this.offset * this.pageSize);
			this.timeout = setTimeout('tileSlider.moveTiles(\'right\');',this.delay); 
		}
	},

	next:function(){
		var lastPage = (Math.ceil(this.count / this.pageSize));
		var curPage = (Math.ceil(Math.abs(this.pos / this.offset)) / this.pageSize) + 1;
		if (curPage < lastPage) {
			this.curPos = this.pos;
			this.pos = this.pos - (this.offset * this.pageSize);
			this.timeout = setTimeout('tileSlider.moveTiles(\'left\');',this.delay); 
		}
	},
	
	moveTiles:function(direction) {
		var k = false;
		this.curPos = (direction == 'left')?this.curPos - (this.offset/4):this.curPos + (this.offset/4);
		k = (direction == 'left')?this.curPos >= this.pos:this.curPos <= this.pos;
		if (k)
		{
			this.sliderObj.style.left = this.curPos + "px";
			this.timeout = setTimeout('tileSlider.moveTiles(\''+direction+'\');',this.delay); 
		} else {
			this.sliderObj.style.left = this.pos + "px";
		}
	},

	initevent:function() {
		if(document.getElementById('tilesh') && document.getElementById('numpiclooph')) {
			tileSlider.init(document.getElementById('numpiclooph').value, document.getElementById('tilesh'));
			this.counter = 0;
		} else {
			if(this.counter < 10000) {
				setTimeout('tileSlider.initevent()', 1000);
				this.counter += 1000;
			} else
				this.counter = 0;
		}
	}

}
