function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function bwcheck(){ 
	// browsercheck 
     this.ver=navigator.appVersion
     this.agent=navigator.userAgent
     this.dom=document.getElementById?1:0
     this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
     this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
     this.ie4=(document.all && !this.dom)?1:0;
     this.ie=this.ie4||this.ie5||this.ie6
     this.mac=this.agent.indexOf("Mac")>-1
     this.opera5=this.agent.indexOf("Opera 5")>-1
     this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
     this.ns4=(document.layers && !this.dom)?1:0;
     this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
     return this
}
var bw=new bwcheck();

function getobj(objectId) {
    // function to get an object given its id
    if(document.getElementById && document.getElementById(objectId)) {
		return document.getElementById(objectId); 		 // W3C DOM
    } else if (document.all && document.all(objectId)) { // MSIE 4 DOM
		return document.all(objectId);
    } else return false;
}
function get_page_left(o) {
    var ol=o.offsetLeft;
    while ((o=o.offsetParent) != null) { ol += o.offsetLeft; }
    return ol;
}
function get_page_top(o) {
    var ot=o.offsetTop;
    while ((o=o.offsetParent) != null) { ot += o.offsetTop; }
    return ot;
}
function get_window_height() {
	if (window.innerHeight) {
		return window.innerHeight - 18;
	} else if (document.documentElement && document.documentElement.offsetHeight != null) {
		return document.documentElement.offsetHeight;
	} else if (document.body && document.body.clientHeight != null) {
		return document.body.clientHeight;
	} 	
}
function get_scroll_y() {
	if (document.documentElement && document.documentElement.scrollTop != null) {
		return document.documentElement.scrollTop;
	} else if (document.body && document.body.scrollTop != null) {
		return document.body.scrollTop;
	} else if (window.scrollY != null) {
		return window.scrollY;
	} else if (typeof(window.pageYOffset) == 'number') { 
		return window.pageYOffset;
	}
}

var over_section;
function clear_prev_menu() {
	// reset the last menu	
	if (over_section) {
		menu = getobj('sec_' + over_section);
		if (menu && menu.style) menu.style.visibility = 'hidden';
		anchor_item = getobj('a_' + over_section);
		if (anchor_item) {
			if  (over_section == current_menu) anchor_item.className="nav1";
			else anchor_item.className="nav1";
		}
	}	
}

function show_menu(section) {
	min_left = 10;
	max_right = 781;
	if (bw.ie5 && bw.mac) {
		min_left -= 10;
		max_right -= 10;
	}
	keep_menu();

	// hide the current section nav
	if (section != current_menu) {
		current = getobj('sec_' + current_menu);
		if (current && current.style) current.style.visibility = 'hidden';
	}
	pri_item = getobj('pri_' + section);
	menu = getobj('sec_' + section);

	if (pri_item && menu && menu.style) {
		pri_left = get_page_left(pri_item);
		pri_width = pri_item.offsetWidth;
		
		center_obj = getobj('center_' + section);
		if (center_obj) {
			// center the menu around this item
			menu_pos = get_page_left(menu);
			center_pos = get_page_left(center_obj);
			menu_offset = (center_obj.offsetWidth / 2) + center_pos - menu_pos;
		} else {
			// center the menu relative to its own width
			menu_offset = menu.offsetWidth / 2;
		}
		menu_left = pri_left + (pri_width / 2) - menu_offset;
		if (menu_left + menu.offsetWidth > max_right) 
			menu_left = max_right - menu.offsetWidth;
		if (menu_left < min_left) 
			menu_left = min_left;
		menu.style.left = menu_left + 'px';
		menu.style.visibility = 'visible';
		over_section = section;
	}
}

function section_show(section) {
	clear_prev_menu();
	// highlight new menu
	menu_anchor = getobj('a_' + section);
	if (menu_anchor) {
		if (section == current_menu) menu_anchor.className="nav1onhover";
		else menu_anchor.className="nav1hover";
	}
	show_menu(section);
}

var timeout;
function reset_menu() {
	clear_prev_menu();
	// highlight original selected menu
	menu_anchor = getobj('a_' + current_menu);
	if (menu_anchor) {
		menu_anchor.className="nav1on";
	}
	show_menu(current_menu);
}
function keep_menu() {
	clearTimeout(timeout);
}
function leave_menu() {
	if (current_menu == '') wait_time = 3000;
	else wait_time = 700;
	timeout = setTimeout('reset_menu()', wait_time);
}
function load_menu() {
	// called first from nav_footer (to position menu quickly) and again from body.onload, 
	// when page loading has completed, to correct position in some browsers (IE 5 Mac)
	if(current_menu) show_menu(current_menu);
}



