if (window.self != window.top) window.top.location = window.self.location;

function getObj(name) {
	// taken form http://www.xs4all.nl/~ppk/js/index.html?/~ppk/js/cross_dhtml.html
	if (document.getElementById) {
		var obj = document.getElementById(name);
	} else if (document.all) {
		var obj = document.all[name];
	}  else if (document.layers) {
		var obj = document.layers[name];
	} else {
		var obj = false;
	}
	return obj;
}

/*
Author: David F. Miller <http://www.sqlmagic.com/d/>
Source: <http://www.alistapart.com/articles/zebratables/>
*/

// this function is needed to work around 
// a bug in IE related to element attributes
function hasClass(obj) {
	var result = false;
	if (obj.getAttributeNode("class") != null) {
		result = obj.getAttributeNode("class").value;
	}
	return result;
}

function toggle(name) { var Obj = getObj(name); toggleObj(Obj); }
function toggleObj(obj) { if (obj.style.display=='none' || obj.style.display=='') { obj.style.display = 'block'; } else { obj.style.display = 'none'; } }

function posAlign(obj1,obj2,offSet) { obj1.style.top = obj2.offsetTop + offSet + 'px'; }

function rollOver(obj, flavor) {
	if (flavor == 'in') {
		var currentclass = (obj.className == '')? '' : obj.className + ' ';
		obj.className = currentclass + 'over';
	} else {
		obj.className = obj.className.replace('over', '');
	}
}

function writeThisIN(text,id) {
	// Source: http://www.xs4all.nl/~ppk/js/index.html?/~ppk/js/cross_dhtml.html
	if (document.getElementById) {
		x = document.getElementById(id);
		x.innerHTML = '';
		x.innerHTML = text;
	} else if (document.all) {
		x = document.all[id];
		x.innerHTML = text;
	} else if (document.layers) {
		x = document.layers[id];
		text2 = '<p>' + text + '</p>';
		x.document.open();
		x.document.write(text2);
		x.document.close();
	}
} 

function zebra(tag) {
	/*
	Author: Christian Heilmann (see <http://www.onlinetools.org/>)
	Source: <http://www.alistapart.com/articles/tableruler/>
	this function is mixed with function Stripe(id),
	provided by David F. Miller <http://www.sqlmagic.com/d/>,
	source: <http://www.alistapart.com/articles/zebratables/>
	*/
	switch(tag) {
		case 'ul' : var subtag = 'li'; break;
		case 'tbody': var subtag = 'tr'; break;
	}
	
	var even = false;
	if (document.getElementById && document.createTextNode) {
		var objs=document.getElementsByTagName(tag);
		for (var i=0;i<objs.length;i++) {
			if(objs[i].className.indexOf('zebra') !=-1) {
				var subobjs=objs[i].getElementsByTagName(subtag);
				for(var j=0;j<subobjs.length;j++)  {
					var currentclass = (subobjs[j].className == "")? "" : subobjs[j].className + " ";
					subobjs[j].className = even ? currentclass + "even" : currentclass + "odd";
					// flip from odd to even, or vice-versa
					even =  ! even;	
				}
			}
		}
	}
}

window.onload=function() {
	zebra('ul');
}