
/* ------------ top navigation behavior ------------ */
var nav2 = {};

nav2.mouseOver = function(obj) {
	if (obj != this.activeObj) { this.hide(); }
	clearTimeout(this.timeoutId);
	if (!this.activeObj) {
		if (obj.getElementsByTagName('DIV').length != 0) {
			this.menu = obj.getElementsByTagName('DIV')[0];
			this.menu.style.display = 'block';
		}
		this.link = obj.getElementsByTagName('A')[0];
		this.link.originalClassName = this.link.className;
		this.link.className = 'link active';
	}
	this.activeObj = obj;
} 

nav2.mouseOut = function(obj) {
	var obj = this;
	hide = function() { obj.hide(); }
	this.timeoutId = setTimeout('hide()', 300);
}

nav2.hide = function() {
	clearTimeout(this.timeoutId);
	if (this.activeObj) {
		if (this.link.originalClassName == 'link') this.link.className = 'link';
		if (this.menu) this.menu.style.display = 'none';
		this.activeObj = null;
	}
}

/* ------------ sub navigation behavior ------------ */
var nav3 = {};

nav3.toggle = function(obj) {
	var section = obj.parentNode;
	var menu = section.parentNode;
	var sections = menu.getElementsByTagName('DIV');
	for (var i=0; i<sections.length; i++) {
		if (sections[i].className == 'section expanded') {
			if (sections[i] != section) sections[i].className = 'section';
		}
	}
	(section.className == 'section') ? section.className = 'section expanded' : section.className = 'section';
	if (obj.className.indexOf('active') != -1) return false;
	return true;
}
