var isIe=(document.all)?true:false; //设置select的可见状态
function setSelectState(state){
  var objl=document.getElementsByTagName('select');
  for(var i=0;i<objl.length;i++){
  	objl[i].style.visibility=state;
  }
}

function mousePosition(ev){
  if(ev.pageX || ev.pageY){
    return {x:ev.pageX, y:ev.pageY};
  }
  return{x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,y:ev.clientY + document.body.scrollTop - document.body.clientTop  };
}

 //弹出方法
function showMessageBox(wTitle,content,pos,wWidth,wHeight){
  closeWindow();
  var bWidth=parseInt(document.documentElement.scrollWidth)-20;
  var bHeight=parseInt(document.documentElement.scrollHeight);
  var abHeight=parseInt(document.body.scrollHeight);
  var abTop=parseInt(document.documentElement.scrollTop);
  abHeight =(bHeight>abHeight)?bHeight:abHeight;   
  
  if(isIe){
    setSelectState('hidden');
  }
  var back=document.createElement("div");
  back.id="back";
  var styleStr="top:0px;left:0px;position:absolute;background:#666;width:"+bWidth+"px;height:"+abHeight+"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'><div class='mesWindowContent' id='mesWindowContent'>"+content+"</div><div class='mesWindowBottom'></div>";
  styleStr="left:"+(bWidth-wWidth)/2+"px;top:"+(abTop+130)+"px;position:absolute;width:"+wWidth+"px;";
  //px;top:原来写法(((pos.y-wHeight)>0)?((pos.y+wHeight/2>abHeight)?(pos.y-wHeight-20):(pos.y-wHeight/2)):((abHeight-wHeight)/2-100)))
  mesW.style.cssText=styleStr;  document.body.appendChild(mesW);
}

function showBackground(obj,endInt){
  obj.filters.alpha.opacity+=1;
  if(obj.filters.alpha.opacity<endInt){
    setTimeout(function(){showBackground(obj,endInt)},8);
  }
} //关闭窗口

function closeWindow(){
  if(document.getElementById('back')!=null){
    document.getElementById('back').parentNode.removeChild(document.getElementById('back'));
  }
  if(document.getElementById('mesWindow')!=null){
    document.getElementById('mesWindow').parentNode.removeChild(document.getElementById('mesWindow'));
  }
  if(isIe){
    setSelectState('');
  }
} //测试弹出

function testMessageBox(ev,webtitle,weburl,webwidth,wHeight){
  var objPos  = mousePosition(ev);
  messContent="<div style='padding:3px 0px 3px 0px;text-align:center'><IFRAME id='ifr_pgv' scrolling='no' src='about:Tabs' width=99% height="+wHeight+"></IFRAME></div>";
  showMessageBox(webtitle,messContent,objPos,webwidth,wHeight); 
  ifr_pgv.location.href = weburl;
}