CareersFilter = function(){
	this.currentFilterWrap = Element.get("currentFilter");
	
	if (this.currentFilterWrap) {
		this.filterList = Element.get("teamFilter");
		this.currentFilter = Element.parseSelector("div", this.currentFilterWrap);
		this.options = Element.parseSelector("li", this.filterList);
	
		Element.setXY(this.filterList, 0, -Element.getSize(this.filterList).height);
		Element.setWidth(this.currentFilter[0], Element.getSize(this.filterList).width);
		Element.setWidth(this.filterList, Element.getSize(this.currentFilter[0]).width);
		
		this.attachEvents();
	}
}

CareersFilter.prototype.attachEvents = function(){
		
	Events.add({
				element: this.currentFilterWrap,
				type: "mouseover",
				handler: this.showFilters,
				context: this
		});
	Events.add({
			element: this.currentFilterWrap,
			type: "mouseout",
			handler: this.hideFilters,
			context: this
	});
	
	for(var i in this.options){
		Events.add({
				element: this.options[i],
				type: "click",
				handler: this.selectFilter,
				context: this
		});
		
		Events.add({
				element: this.options[i],
				type: "mouseover",
				handler: this.over,
				context: this
		});
		
		Events.add({
				element: this.options[i],
				type: "mouseout",
				handler: this.out,
				context: this
		});
	}
}

CareersFilter.prototype.showFilters = function(){
	Element.setVisibility(this.filterList, "visible");
}
CareersFilter.prototype.hideFilters = function(){
	Element.setVisibility(this.filterList, "hidden");
}

CareersFilter.prototype.selectFilter = function(event, el){
	var newFilter = el.getAttribute("value");
	window.location.href = 'careers.asp?filter='+ escape(newFilter);
}
CareersFilter.prototype.over = function(event, el){
	Element.addClass(el, "over");
}
CareersFilter.prototype.out = function(event, el){
	Element.removeClass(el, "over");
}

/*--------------- Initialize --------------*/
function initCareersFilter(){
	var careersFilter = new CareersFilter();
}

//parse charts
Events.add({
	element: window,
	type: "load",
	handler: initCareersFilter
});