/*
	active tab hide select Version 1
	written by Chris Munn for GForces
	@Desc jscript for dropdown navigation to retain the active class on the initial hovered a tag also hides select boxes within a specific id
*/				
				
function getPreviousSibling(s) { 
	s = s.previousSibling;
	while (s && !s.tagName) {
		s = s.previousSibling;
	} 
	return s;
}

function activeNavHideSelect() {
	var hoverTags = document.getElementById("nav").getElementsByTagName("a");
	var hoverUL = document.getElementById("nav").getElementsByTagName("ul");
	var IE6 = /msie|MSIE 6/.test(navigator.userAgent);
	
	for (var i=0; i<hoverTags.length; i++) { 
		
		hoverTags[i].onmouseover=function() { 
			if (this.className == 'subNav') { 
				getPreviousSibling( this.parentNode.parentNode ).className = 'active';
				if (IE6) { hideShowSelect('hide'); }
			} else {
				if (this.parentNode.className != 'noSubNav') {
					if (IE6) { hideShowSelect('hide'); }
				}
				
				this.className = 'active';
			}
		} 
		
		
		hoverTags[i].onmouseout=function() { 
			if (this.className == 'subNav') { 
				getPreviousSibling( this.parentNode.parentNode ).className = '';
				hideShowSelect('show');
			} else {
				this.className = '';
				if (IE6) { hideShowSelect('show'); }
			}
		} 
		
	}
	
	for (var j=0; j<hoverUL.length; j++) { 
		
		hoverUL[j].onmouseover=function() { 
			if (this.className == 'subNav') { 
				getPreviousSibling( this ).className = 'active';
				if (IE6) { hideShowSelect('hide'); }
			}
		} 
		
		
		hoverUL[j].onmouseout=function() { 
			if (this.className == 'subNav') { 
				getPreviousSibling( this ).className = '';
				if (IE6) { hideShowSelect('show'); }
			}
		} 
		
	}
}

function hideShowSelect ( option ) {
	var selectTags = document.getElementById("frmSearch").getElementsByTagName("select");
	
	if (option == 'hide') {
		for (var k=0; k<selectTags.length; k++) {
			selectTags[k].style.display = 'none';
		}
	} else {
		for (var k=0; k<selectTags.length; k++) {
			selectTags[k].style.display = 'block';
		}
	}
}
