function  checkNavigator(){
	if(navigator.appName.indexOf("Microsoft") != -1){
		return true;
	}
	else{
		return false;
	}
}
/***
 * 参数e 是对象传递的触发事件 FF下想访问event对象必须传递event参数
 * 参数o 是目标DIV对象
 */   


function getIEVersonNumber()
{
	var ua = navigator.userAgent;
	var msieOffset = ua.indexOf("MSIE ");
	if(msieOffset < 0)
	{
		return 0;
	}
	return parseFloat(ua.substring(msieOffset + 5, ua.indexOf(";", msieOffset)));
}
function detectMouse(e,o,dest) { 
	/* FF 下判断鼠标是否离开DIV */
	var destination=document.getElementById(''+dest);
	if(!checkNavigator()) { 
		var x = e.clientX + document.body.scrollLeft;
		var y = e.clientY + document.body.scrollTop ;
		var left = o.offsetLeft;
		var top = o.offsetTop;
		var w = o.offsetWidth;
		var h = o.offsetHeight;
		var destinationleft = destination.offsetLeft;
		var destinationtop = destination.offsetTop;
		var destinationw = destination.offsetWidth;
		var destinationh = destination.offsetHeight;

		if(y < top || 
				y > (h + top) || 
				x > (left + w) || 
				x<left ) { 
			if (y < destinationtop || 
					y > (destinationh + destinationtop) || 
					x > (destinationleft + destinationw) || 
					x< destinationleft ) { 
				return true;
			}
		}
	}

	/* IE */
	if((o.contains(event.toElement) == false)) {
		if((destination.contains(event.toElement) == false)){
			return true;
		}
	}

}

if(!checkNavigator()){
	if(typeof(HTMLElement)!="undefined")    // 给firefox定义contains()方法，ie下不起作用
	{   
		HTMLElement.prototype.contains=function(obj)   
		{   
			while(obj!=null&&
					typeof(obj.tagName)!="undefind"){ //通过循环对比来判断是不是obj的父元素
				if(obj==this) 
					return true;   
				obj=obj.parentNode;
			}   
			return false;   
		};   
	}  

	Event.prototype.__defineGetter__("fromElement",   function   ()   {   
		var   node;   
		if   (this.type   ==   "mouseover")   
			node   =   this.relatedTarget;   
		else   if   (this.type   ==   "mouseout")   
			node   =   this.target;   
		if   (!node)   
			return;   
		while   (node.nodeType   !=   1)   
			node   =   node.parentNode;   
		return   node;   
	});   
	Event.prototype.__defineGetter__("toElement",   function   ()   {   
		var   node;   
		if   (this.type   ==   "mouseout")   
			node   =   this.relatedTarget;   
		else   if   (this.type   ==   "mouseover")   
			node   =   this.target;   
		if   (!node)   
			return;   
		while   (node.nodeType   !=   1)   
			node   =   node.parentNode;   
		return   node;   
	});
}
function getObjectLocationLeft(paraElement) {
	var xPos = eval(paraElement).offsetLeft;
	var currentElement = eval(paraElement).offsetParent;
	while (currentElement != null) {
		xPos += currentElement.offsetLeft;
		currentElement = currentElement.offsetParent;
	}
	return xPos;
}

function getObjectLocationTop(paraElement) {
	var yPos = eval(paraElement).offsetTop;
	var currentElement = eval(paraElement).offsetParent;
	while (currentElement != null) {
		yPos += currentElement.offsetTop;
		currentElement = currentElement.offsetParent;
	}
	return yPos;
}


function showMenu(mainMenuName,subMenuName,menuNo)
{	
	var mainMenuShowId=document.getElementById(''+mainMenuName);
	var menuShowId=document.getElementById(''+subMenuName);


// alert("ds1s"+getObjectLocationLeft(mainMenuShowId));
// alert("ds2s"+mainMenuShowId.height/2);

	if(!checkNavigator()){
		var x=0;
		var y=0;
	//	var x1=Number(""+getObjectLocationLeft(mainMenuShowId));
	//	var y1=Number(""+getObjectLocationTop(mainMenuShowId));
		var x1=parseInt(""+getObjectLocationLeft(mainMenuShowId));
		var y1=parseInt(""+getObjectLocationTop(mainMenuShowId));
		x=x1;
		y=y1;
	
		x=x+menuNo * 80;
		y=y+30 ;
		menuShowId.style.left=x+"px";
		menuShowId.style.top=y+"px"; 
	}else{
		// IE
		// var version=checkNavigatorVersion();
		var version=getIEVersonNumber();
		// alert("d"+version);
		var x=0;
		var y=0;
	//	var x1=Number(""+getObjectLocationLeft(mainMenuShowId));
	//	var y1=Number(""+getObjectLocationTop(mainMenuShowId));
		var x1=parseInt(""+getObjectLocationLeft(mainMenuShowId));
		var y1=parseInt(""+getObjectLocationTop(mainMenuShowId));
		x=x1;
		y=y1;
		//var orderN=Number(""+order);
		//alert("ds"+x1);
		if(version>=8){
			//x=parseInt(""+getObjectLocationLeft(mainMenuShowId),10) ;
			//y=parseInt(""+getObjectLocationTop(mainMenuShowId),10) ;
	
			//alert("sd");
			x=x+menuNo * 80;
			y=y+30 ;
			
			//alert("xt3453x"+x);
		//	x=getObjectLocationLeft(mainMenuShowId)+90 ;
			//y=getObjectLocationTop(mainMenuShowId)+30 ;	
		}else if(version>=7){
			x=getObjectLocationLeft(mainMenuShowId) ;
			y=getObjectLocationTop(mainMenuShowId)+30 ;
		}else{
			x=getObjectLocationLeft(mainMenuShowId) ;
			y=getObjectLocationTop(mainMenuShowId)+30 ;
		}
		menuShowId.style.left=x;
		menuShowId.style.top=y;
	}

	menuShowId.style.display="block";	

}
function hiddenMenu(mainMenuName,subMenuName)
{
	var mainMenuShowId=document.getElementById(''+mainMenuName);
	var menuShowId=document.getElementById(''+subMenuName);
	menuShowId.style.display="none"; 
}
