var Site = {

	Positions: {
		curr: null,
		init: function() {
			this.element = document.getElement("#jobPositions");						
			this.wrappers = this.element.getElements(".jobItem");
			this.toggles = this.element.getElements(".jobTitle");
			this.togd = this.element.getElements(".jobDesc");
			
			this.toggles.each(function(el, i) {
				//this.togd[i].hide();
				el.addEvents({
					"click": function() {						
						this.show(i);
					}.bind(this),
					"mouseenter": function() {						
						el.addClass("over");
					}.bind(this),
					"mouseleave": function() {
						el.removeClass("over");
					}.bind(this)
				});
			}, this);
			
			if (window.location.hash) {
				var start = window.location.hash;
				if (start.indexOf("#") != -1) {
					start = parseInt(start.replace("#", ""));
					if (start <= this.toggles.length) this.show(start - 1);
				}				
				
			}
			
		},
		
		show:function(index) {						
			if ($chk(this.curr) && this.curr != index) {
				//this.togd[this.curr].hide();
				this.wrappers[this.curr].removeClass("active");

			}
			
			var display = (this.togd[index].getStyle("display") == "none");
			//this.togd[index][display ? "show" : "hide"]();	
			this.wrappers[index][display ? "addClass" : "removeClass"]("active");
			
			this.curr = index;
		}
		
	}
};

