/*
	New Nav Bar JS
*/

DOM = (document.getElementById) ? 1 : 0;

/*
	Show or Hide sub-menu 'subm'
*/

function menuex(subm) {
	if(!DOM) {
		return;
	}
	submobj = document.getElementById(subm);
	if(submobj.style.display == 'none') {
		submobj.style.display = '';
	} else {
		submobj.style.display = 'none';
	}

}

/*
	Hide 'subms' sub-menus
*/

function menuhd(subms) {
	var i = 0;
	if(DOM) {
		for( i = 0; i < subms; i++ ) {
			submobj = document.getElementById('subm' + i);
			submobj.style.display = 'none';
		}
	}
}

/*
	Hide a given submenu
*/

function menuhide(subm) {
	if(DOM) {
		submobj = document.getElementById(subm);
		submobj.style.display = 'none';
	}
}	

/*
	Highlight or Un-highlight 'what', dependent on 'on' and also do it to 'other'
*/
function menuhl(what, on, other) {
	if(!DOM) {
		return;
	}
	what = what.parentElement;
	extra = document.getElementById(other);
	if(on) {
		what.style.backgroundColor = '#6699CC';
		if(extra) {
			extra.style.backgroundColor = '#6699CC';
		}
	} else {
		what.style.backgroundColor = '#DAE6F3';
		if(extra) {
			extra.style.backgroundColor = '#DAE6F3';
		}

	}

}

/*
	New version, takes two element id's, finds then and changes their colours.
*/

function menuhl2(what, on, other) {
	if(!DOM) {
		return;
	}
	what = document.getElementById(what);
	extra = document.getElementById(other);
	if(on) {
		what.style.backgroundColor = '#6699CC';
		if(extra) {
			extra.style.backgroundColor = '#6699CC';
		}
	} else {
		what.style.backgroundColor = '#DAE6F3';
		if(extra) {
			extra.style.backgroundColor = '#DAE6F3';
		}

	}

}

function menuhlboyz(what, on, other) {
	if(!DOM) {
		return;
	}
	what = document.getElementById(what);
	extra = document.getElementById(other);
	if(on) {
		what.style.backgroundColor = '#FFCCFF';
		if(extra) {
			extra.style.backgroundColor = '#FFCCFF';
		}
	} else {
		what.style.backgroundColor = '#DAE6F3';
		if(extra) {
			extra.style.backgroundColor = '#DAE6F3';
		}

	}

}

function surfto(selector) {
        var myindex=selector.selectedIndex
        if (selector.options[myindex].value != "0") {
         location=selector.options[myindex].value;}
}
