var ua = null;
switch(true)
{
	case navigator.userAgent.indexOf("Opera")>-1 :
		ua = "O";
		window.captureEvents(Event.MOUSEMOVE);
		window.onmousemove = function(e){mouseX = e.pageX; mouseY = e.pageY};
		break;
	case navigator.userAgent.indexOf("MSIE")>-1 :
		ua = "IE";
		break;
	case navigator.userAgent.indexOf("Gecko")>-1 :
		ua = "FF";
		window.captureEvents(Event.MOUSEMOVE);
		window.onmousemove = function(e){mouseX = e.pageX; mouseY = e.pageY};
		break;
}

function gE(id)
{
	return document.getElementById(id);
}



var Tape1 = {	

	postLoaded	: 0,

	tapeId	: 'bottom-tape',
	step		: 1,
	steps	: [1, 1],
	width	: 540,
	
	cid		: 0,
	id			: 0,
	pages	: 0,

	locked	: false,

	right : function()
	{

		if (Tape1.locked)
		{
			return false;
		}

		if (this.step < this.pages)
		{
			Tape1.locked = true;

			this.step += 1;
			this._next();
		}
	},

	set_ : function(pages, cid, id)
	{
		this.pages	= pages;
		this.cid			= cid;
		this.id			= id;

		Tape1.steps		= [1, 1];
		Tape1.step		= 1;

	}, 

	left : function()
	{
		if (Tape1.locked)
		{
			return false;
		}

		if (this.step > 1)
		{
			Tape1.locked = true;

			this.step -= 1;
			$('#bottom-tape_ul').animate({left:(-(this.step-1)*272)}, 800, function () {
				Tape1.locked = false;
			});
		}
	},


	_next_cb : function()
	{
//debugger;
		$('#bottom-tape_ul').animate({left:(-(this.step-1)*272)}, 800, function () {
				Tape1.locked = false;
			});

		this.steps[this.step] = 1;
	},

	_next : function()
	{

		if (this.steps[this.step])
		{
			this._next_cb();
		}
		else
		{
			$.get('/items.php?p=' + Tape1.step, function (data) {
				
				Tape1.width += 280;

				$('#bottom-tape_ul').width(Tape1.width).createAppend(
						'div', {className: 'divd'}, data
					);
			
				Tape1._next_cb();

			})
		}

	}

}
