var Nav = new Class({
	initialize: function(container){
		this.header = $('header');
		this.togglers = $(container).getChildren()[0].getChildren();
		this.active = false;
		this.current = 0;
		this.toggle();
	},
	toggle: function(){
		this.togglers.each(function(el, i){
			if(el.hasClass('active')) this.current = i;
			el.addEvent('mouseover', function(e){
				new Event(e).stop();
				if(this.active) this.togglers[this.active].removeClass('on');
				this.active = i;
				this.togglers[this.current].removeClass('active');
				el.addClass('on');
			}.bind(this));
		}.bind(this));

		this.header.addEvent('mouseleave', function(){
			if(this.active) this.togglers[this.active].removeClass('on');
			this.togglers[this.current].addClass('active');
		}.bind(this));
	}
});

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

window.addEvent('domready', function(){
	//new Nav('nav');

	/* Google Analytics with Outbound Tracking */
	var pageTracker = _gat._getTracker("UA-3639837-3");
	pageTracker._trackPageview();

	if(pageTracker){
		$$('a[href^=http]').each(function(el){
			el.addEvent('click',function(){
				var dd = '/outgoing/' + el.get('href').replace('http://','');
				pageTracker._trackPageview(dd);
			}.bind(this));
		});
	}
});