var rotban = null;
var banintid = null;
var currban = null;
var numbans = null;

function hideBan(factor, banid)
{
	if (factor == null)
	{
		tempobj = document.getElementById("rotbanset_"+banid);
		tempobj.style.display = 'none';	
		tempobj.style.height = tempobj.origheight;
	} else {
		tempobj = document.getElementById("rotbanset_"+banid);
		var tempheight = parseInt(tempobj.style.height);
		var newheight = tempheight*factor;
		tempobj.style.overflow = 'hidden';
		tempobj.style.height = newheight+"px";
	};
};

function rotateBanner()
{
	var nextban = currban+1;
	var tempobj = null;
	if (nextban < numbans)
	{
		setTimeout('hideBan(0.6,'+currban+')',0);
		setTimeout('hideBan(0.3,'+currban+')',100);
		setTimeout('hideBan(0.15,'+currban+')',200);
		setTimeout('hideBan(0.07,'+currban+')',300);
		setTimeout('hideBan(null,'+currban+')',400);
		currban = nextban;
	} else {
		for (var j = 0; j < numbans; j++)
		{
			tempobj = document.getElementById("rotbanset_"+j);
			tempobj.style.display = 'block';
		};
		currban = 0;
	};
};

function beginBanner()
{
	if (document.getElementById)
	{
		rotban = document.getElementById('home_rotban');
		if (rotban != null)
		{
			if (rotban.childNodes.length > 0)
			{
				var testchild = null; var testchildobj = null;
				numbans = 0;
				for (var i = 0; i < rotban.childNodes.length; i++)
				{
					testchild = rotban.childNodes[i];
					if (testchild.nodeName == "DIV")
					{
						testchild.id = "rotbanset_"+numbans;
						testchildobj = document.getElementById('rotbanset_'+numbans);
						testchild.origheight = testchildobj.style.height;
						numbans++;
					};
				};
				currban = 0;
				banintid = setInterval('rotateBanner()',9000);
			};
		}; 
	};
};

appendLoad(beginBanner);