// JavaScript Document that kickstarts the navigation
window.addEvent('domready', function() {
	
	var list = $$('#primaryNav li:nth-child(first)');
	for (x=0; x<list.length; x++) {
		if (list[x].parentNode.parentNode.nodeName=='DIV') {
			list[x].set('class', 'first-child');	
		}
	}
	
	var list = $$('#secondaryNav li:nth-child(first)');
	for (x=0; x<list.length; x++) {
		list[x].set('class', 'first-child');	
	}
	
	/*Moves the primary navigation in ie to the bottom of the flow*/

	if (Browser.Engine.trident && homepage==true) {
		var nav = new Element('div',{ 'html': $('primaryNav').get('html') });
		$('primaryNav').destroy();
		nav.set('id', 'primaryNav');
		nav.inject($('wrapper'), 'bottom');
	}
	
	var list = $$('#primaryNav li');
	if (Browser.Engine.trident4==true){ //if its ie6 then we need to kickstart the nav!
		for (var i=0; i<list.length; i++) {
			list[i].addEvent('mouseenter', function() {
				if (this.className=='null') {
					this.className='hover';	
				} else {
					this.className = this.className + 'hover';
				}
			});
			list[i].addEvent('mouseleave',function() {
				this.className = this.className.replace('hover','');
			});	
		}
	}
});