var bind = function(el,type,func,extra)
{	
	if (el.addEventListener) {
		el.addEventListener (type, function( e ) { func(e, extra); },false);
	} else if (el.attachEvent) {
		el.attachEvent ("on" + type, function( ) { 
			var event = window.event;
			event.target = event.srcElement;
			func(event, extra); 
		});
	} else {
		el.type = function( e ) { var event = window.event ? window.event: e; event.target = document; func(event, extra); };
	}
}

var clear = function(el)
{
	while (el.childNodes.length)
		el.removeChild(el.firstChild)
}

var arrowlist = function(id)
{
	this.listId = id;
	this.list = document.getElementById(id);
	this.children = this.list.getElementsByTagName("li");
	var me = this;
	this.
		each(function() { bind(this,'click',me.clicked, me) }).
		each(function() { this.style.cursor = 'pointer' });
		
	return this;
}

arrowlist.prototype.clicked = function(e,list)
{
	list.highlight(e.target);
}

arrowlist.prototype.highlight = function(target)
{
	this.
		each(function() { this.removeAttribute("class") }).
		each(function() { this.removeAttribute("className") });
	target.setAttribute("class","active");
	target.setAttribute("className","active");
}
arrowlist.prototype.each = function(func)
{
	for (var i=0;i<this.children.length;i++)
		func.call( this.children.item(i) );
	return this;
}
arrowlist.prototype.length = function()
{
	return this.children.length;
}
arrowlist.prototype.one = function(index, func)
{
	func.call( this.children.item(index) );
	return this;
}

bind(window,"load", function() {
	bind(document.getElementById("top_header"),"click",function() { location.href='/'; });
});

