function horzTicker( horzName )
{
	this.name = horzName;
	this.num = 5;
	this.numSwitch = 5;
	this.current = 0;
	this.autoSwitch = 0;
	this.loop = 0;
	this.next = "<div style=\"float: right\"><img src=\"http://dev.globalbattleground.com/images/next.gif\" style=\"border: 0\"/></div>";
	this.prev = "<div style=\"float: left;\"><img src=\"http://dev.globalbattleground.com/images/previous.gif\" style=\"border: 0\"/></div>";
	this.div;
	this.timer;
	this.prevL;
	this.nextL;
	this.items = new Array();
	this.itemsD = new Array();
	this.setDiv = function(divid)
	{
		if (document.getElementById(divid))
		{
			this.div = document.getElementById(divid);
			return 1;
		}
		alert("Can't find div!");
		return 0;
	}
	this.addItem = function(item)
	{
		this.items[this.items.length] = item;
	}
	this.render = function()
	{
		var i = 0;
		var amt = this.num + this.current;
		var p = this;
//		this.div.innerHTML = '';
		if (this.num < this.items.length || this.loop)
			prevL.onclick = function () { p.prevF(); };
		else
			prevL.onclick = "";
//			this.div.innerHTML += "<a onclick=\"" + this.name + ".prevF()\">" + this.prev + "</a>";
		if (this.num > this.items.length)
		{
			amt = this.items.length;
		}
		for (i = 0; i < this.items.length; i++)
			this.itemsD[i].style.display = 'none';
		for (i = this.current; i < amt; i++)
		{
			this.itemsD[i].style.display = '';
//			document.getElementById(this.name + '_' + i).style.display = "";
//			this.div.innerHTML += this.items[i];
		}
		if (this.num < this.items.length || this.loop)
		{
			nextL.onclick = function() { p.nextF(); };
		}
		else
			nextL.onclick = "";
//			this.div.innerHTML += "<a onclick=\"" + this.name + ".nextF()\">" + this.next + "</a>";
		if (this.autoSwitch > 0)
		{
				clearTimeout(this.timer);
				this.timer = window.setTimeout(this.name + ".nextF()", (this.autoSwitch * 1000));
		}
		parent.Lightview.updateViews();
		//minmax_scan();
	}
	this.createAll = function()
	{
		var i = 0;
		var temp;
		prevL = document.createElement('a');
		prevL.id = this.name + '_prev';
		prevL.innerHTML = this.prev;
		this.div.appendChild(prevL);
//		this.div.innerHTML += '<a onclick="" id="' + this.name + '_prev">' + this.prev + '</a>';
		for (i = 0; i < this.items.length; i++)
		{
			temp = document.createElement('div');
			temp.id = this.name + '_' + i;
			temp.style.display = 'none';
			temp.innerHTML = this.items[i];
			this.itemsD[this.itemsD.length] = temp;
			this.div.appendChild(temp);
//			this.div.innerHTML += '<div id="' + this.name + '_' + i + '" style="display: none;">' + this.items[i] + '</div>';
		}
		nextL = document.createElement('a');
		nextL.id = this.name + '_next';
		nextL.innerHTML = this.next;
		this.div.appendChild(nextL);
//		this.div.innerHTML += '<a onclick="" id="' + this.name + '_next">' + this.next + '</a>';
		this.render();
	}
	this.prevF = function()
	{
		if (this.current > 0 && this.current - this.numSwitch >= 0)
			this.current = this.current - this.numSwitch;
		else if (this.current - this.numSwitch < 0)
			this.current = 0;
		else if (this.loop)
			this.current = this.items.length - this.num;
		this.render();
	}
	this.nextF = function()
	{
		jQuery('#sliderContent').animate({opacity: 'hide'}, "500");
		if (this.current + this.numSwitch < this.items.length && this.current + 2 * this.numSwitch < this.items.length)
			this.current = this.current + this.numSwitch;
		else if (this.current + this.numSwitch < this.items.length && this.current + 2 * this.numSwitch > this.items.length)
			this.current = this.items.length - this.numSwitch;
		else if (this.loop)
			this.current = 0;
//		this.render();
		window.setTimeout(this.name + ".render()", 500);
	}
}
