// JavaScript Document
function adsRotate(id)
{
	if ( !document.getElementById || !document.getElementsByTagName )
		return false;
	this.menu = document.getElementById(id);
	this.anchors = this.menu.getElementsByTagName("a");
}

adsRotate.prototype.init = function(initimg)
{
	var mi = this;
	document.getElementById(initimg).style.display = "block";
	for(var i = 0; i < this.anchors.length; i++)
	{
		this.anchors[i].getElementsByTagName('b')[0].onclick = function()
			{
				mi.hideOther(this);
				mi.show(this.className, this.parentNode);
			}
	}
}
adsRotate.prototype.show = function(simgid, toggler)
{
	var showImg = document.getElementById(simgid);
	toggler.className = "pos o";
	showImg.style.display = 'block';
	
	
}

adsRotate.prototype.hide = function(himgid)
{
	var showImg = document.getElementById(himgid);
	showImg.style.display = 'none';
}

adsRotate.prototype.hideOther = function(current)
{
	//alert("Hide others!");
	for(var i = 0; i < this.anchors.length; i++)
	{	
		var b = this.anchors[i].getElementsByTagName('b')[0];
		if(this.anchors[i] != current.parentNode)
		{
			//var previous = current.previousSibling;
			var a = this.anchors[i];
			this.hide(b.className);
			if(b.parentNode == this.anchors[this.anchors.length - 1]){ b.parentNode.className = "pos last"; }
			else
				{
					a.className = "pos";
				}
		}
		else if(this.anchors[i] == current.parentNode)
		{
			if(i != 0)
			{
				var pre = this.anchors[i-1];
				//alert(pre.className);
			}else
				{
					pre = null;
				}
			if(pre){ pre.className = "pos last"; }
		}
	}
}
