var header_menu_float;
var header_menu_expanded_item;
var mouseover = false;
var start = false;

var last_tag;
var last_m_title;
var mNavVisible

function headerMenuClick(sUrl, m_title) {

	if ( sUrl ){
		document.location = sUrl;;
	}else{
		if (start)
		headerMenuExpand(m_title);
	}
}



function headerMenuExpand(m_title) {


var div					= document.getElementById('header_submenu_' + m_title);
var mlink				= document.getElementById('header_menu_link_' + m_title);
var cdiv 				= document.getElementById('header_submenuc_' + m_title);			

	if ( !header_menu_float ) {
			header_menu_float = document.createElement('DIV');
			header_menu_float.style.position = 'absolute';
			header_menu_float.className = 'header-menu-float';
			header_menu_float.style.position = 'absolute';
			//header_menu_float.style.marginTop = 0 + 'Px';
			
			//header_menu_float.style.zIndex			= 100;
			document.body.appendChild(header_menu_float);
	}

			curwidth = document.documentElement.offsetWidth;
			doccenter = (curwidth <= 962 ? (962/2) : curwidth/2)
			docleft = doccenter - 482;
			docleft = (Math.round(docleft) < 0 ? 0 : Math.round(docleft));
			//document.title = "Docleft:" + docleft + " | Doccenter:" + doccenter;
			var v=navigator.appVersion.substring(navigator.appVersion.indexOf("MSIE ")+5,navigator.appVersion.indexOf("MSIE ")+8)
			//document.title = v;
			//document.title = curwidth + " - " + docleft + " - " + parseInt(div.getAttribute("pos"));
			header_menu_float.style.left = (docleft + parseInt(div.getAttribute("pos"))) - (v == '6.0' ? (curwidth > 980 ? 10 : 0) : 0) + 'Px';
			last_m_title = m_title;
			
			header_menu_float.innerHTML 				= div.innerHTML;
			header_menu_float.onmouseover  			= check_over;
			header_menu_float.onmouseout  			= menu_mouse_out;
			//header_menu_float.style.marginLeft 	= parseInt(div.style.marginLeft)- parseInt(0) + 'px';
			header_menu_float.style.width 			= mlink.offsetWidth + 40 + 'px';
			header_menu_float.style.display 		= 'block';
			//header_menu_float.style.backgroundColor = '#000000';
			//header_menu_float.style.marginLeft = '-100px';
			header_menu_float.style.top = '142px';
			header_menu_float.style.zIndex			= 51;
}

function check_over(e){
 	mNavVisible = true;
}


function menu_mouse_out(){
  mNavVisible = false;
	window.setTimeout("headerMenuCollapse(' + last_m_title + ');", 200);
}

function headerMenuCollapse(m_title) {
	if ( header_menu_float && !mNavVisible) {
		header_menu_float.style.display = 'none';
		header_menu_expanded_item = false;
	}
}
