function chgLoc(url)
{	
	if (url)
	{
		document.location = url;
	}
}

function printPage()
{
	window.print();
}

var cookieMgr = new function()
{
	var self = this;
	this.c = (document.cookie) ? document.cookie : false;
	this.pairs = [];
	this.cookies = [];

	this.getAll = function()
	{
		return (this.c) ? this.cookies : false;
	};

	this.get = function(n)
	{
		return (this.cookies[n]) ? unescape(this.cookies[n]) : false;
	};

	this.set = function(n,v,e,p,d,s)
	{
		var dt = new Date();
		var nv = n+'='+escape(v);
		var str = nv +((e) ? '; expires='+e : '') +((p) ? '; path='+p : '') +((d)?'; domain='+d : '') +((s) ? '; secure' : '');
		if((n.length>0 && v.length>0) && (((e) && (e>dt)) || (!e)) && (nv.length<4000))
		{
			document.cookie = str;
			this.pairs[this.pairs.length] = nv;
			this.cookies[n] = v;
			return true;
		}
		
		return false;
	};

	this.remove = function(n,p,d)
	{
		var i;
		
		if(this.cookies[n])
		{
			document.cookie = n+'='+ ((p)?'; path='+p:'') + ((d)?'; domain='+d:'') +'; expires=Thu, 01-Jan-1970 00:00:01 GMT';
			for(i=0; i<this.pairs.length; i++)
			{
				if(this.pairs[i].indexOf(n) != -1)
				{
					this.pairs.splice(i,1);
					this.cookies[n] = null;
					return true;
				}
			}
		}
		
		return false;
	};

	this.init = function()
	{
		var i,split;
		
		if(self.c)
		{			
			self.pairs = self.c.split('; ');
			
			for(i=0; i<self.pairs.length; i++)
			{
				split = self.pairs[i].split('=');
				self.cookies[split[0]] = split[1];
			}
		}
	}();
}();

function rotateChildren(id)
{
	var i,node;
	var element = document.getElementById(id);
	if (!element)
	{
		return;
	}
	var childNodes = element.getElementsByTagName('li');
	var cookieValue = cookieMgr.get('rnn');
	var displayNum = (cookieValue) ? cookieValue : 0;

	for(i=0; i<childNodes.length; i++)
	{
		node = childNodes[i];
		
		if (node.nodeType === 1)
		{
			if (i == displayNum)
			{
				node.style.display = 'block';
				cookieMgr.set('rnn',""+(((i+1) >= (childNodes.length)) ? 0 : ++i));
			}
			else
			{
				node.style.display = 'none';
			}
		}
	}
}

function zebrize()
{
	tables = document.getElementsByTagName('table');
	for(i = 0; i < tables.length; ++i)
	{
		table = tables[i];
		if(table.className.indexOf('zebra') != -1)
		{
			if (table.className.indexOf('ignorefirst') != -1)
			{
				startTD = 1;
			}
			else
			{
				startTD = 0;
			}

			curRow = 0;
			trs = table.getElementsByTagName('tr');
			for(j = 0; j < trs.length; ++j)
			{
				tr = trs[j];
				if (tr.className.indexOf('header') == -1)
				{
					tds = tr.getElementsByTagName('td');
					for(k = startTD; k < tds.length; ++k)
					{
						tds[k].className = (tds[k].className?tds[k].className+' ':'') + ((curRow+1)%2?'odd':'even');
					}
					curRow++;
				}
			}
		}
	}
}

function initPage()
{
	rotateChildren('rotNode');
	setInterval('rotateChildren("rotNode")', 5000);
	zebrize();
}

