var isIe=(document.all)?true:false;
function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
//设置select的可见状态
function mousePosition(ev)
{
	if(ev.pageX || ev.pageY)
	{return {x:ev.pageX, y:ev.pageY};}
	return {x:window.event.x + ietruebody().scrollLeft - ietruebody().clientLeft,y:window.event.y + ietruebody().scrollTop - ietruebody().clientTop};
}
//弹出方法
function showMessageBox(pos,wWidth,menuobj,title)
{
var bWidth=parseInt(document.documentElement.scrollWidth);
var bHeight=parseInt(document.documentElement.scrollHeight);

var back=document.createElement("div");
back.id="back";
var styleStr="top:0px;left:0px;position:absolute;background:#666;width:"+bWidth+"px;height:"+bHeight+"px;";
styleStr+=(isIe)?"filter:alpha(opacity=40);":"opacity:0.40;";
back.style.cssText=styleStr;
document.body.appendChild(back);

var mesW=document.createElement("div");

mesW.id="mesWindow";

mesW.className="mesWindow";

mesW.innerHTML="<div class='mesWindowTop'><table width='100%' height='100%'><tr><td>"+title+"</td><td style='width:1px;'><input type='button' onclick=\"closeWindow('"+menuobj+"');\" title='关闭窗口' class='close' value='关闭' /></td></tr></table></div><div class='mesWindowContent' id='mesWindowContent'></div><div class='mesWindowBottom'></div>";

styleStr="left:"+(((pos.x+wWidth)>ietruebody().clientWidth)?(ietruebody().clientWidth-wWidth)/2:pos.x)+"px;top:"+(pos.y)+"px;position:absolute;width:"+wWidth+"px;";
mesW.style.cssText=styleStr;
document.body.appendChild(mesW);
if(document.getElementById('mesWindowContent')!=null)
	{
		document.getElementById('mesWindowContent').appendChild(document.getElementById(menuobj));
	}
}

function showBackground(obj,endInt)
{
	obj.filters.alpha.opacity+=1;
	if(obj.filters.alpha.opacity<endInt)
	{
		setTimeout(function(){showBackground(obj,endInt)},8);
	}
}

//关闭窗口
function closeWindow(menuobj)
{
	if(document.getElementById('back')!=null)
	{
		document.getElementById('back').parentNode.removeChild(document.getElementById('back'));
	}
	if(document.getElementById('mesWindow')!=null)
	{
		document.getElementById('All_Content').appendChild(document.getElementById(menuobj))
		document.getElementById('mesWindow').parentNode.removeChild(document.getElementById('mesWindow'));		
	}
}

//测试弹出
function testMessageBox(ev,menuobj,title)
{

var objPos = mousePosition(ev);
showMessageBox(objPos,720,menuobj,title);
}

function operCurrTitle(itsMe){	
	var parentObj = itsMe.parentNode;
	var pObj = parentObj.getElementsByTagName("p");
	var pObjCur=itsMe.nextSibling;
	if(pObj.length<1){
		pObj = parentObj.getElementsByTagName("div");
	}
	for(var i=0;i<pObj.length;i++){
		if (pObj[i]==pObjCur)
		{
			if (pObjCur.style.display=="block")
			{
				pObjCur.style.display="none";
			}
			else
			{
				pObjCur.style.display="block";
			}
		}
		else
			pObj[i].style.display = "none";
	}	
} 