﻿
 var msgoldonloadHndlr=window.onload, msgpopupHgt, msgactualHgt, msgtmrId=-1, msgresetTimer;
        var msgtitHgt, msgcntDelta, msgtmrHide=-1, msghideAfter=4000, msghasFilters=true;
        var msgshowBy=null, msgdxTimer=-1, msgpopupBottom;
        var _center=false;
        var msgnMsg,msgnTitle,msgbChangeTexts=false;
        
        function msgespopup_ShowPopup(show)
        {
          if (msgdxTimer!=-1&& (typeof el.filters.blendTrans=="object")) { el.filters.blendTrans.stop(); }

          if ((msgtmrHide!=-1) && ((show!=null) && (show==msgshowBy)))
          {
            clearInterval(msgtmrHide);
            msgtmrHide=setInterval(msgespopup_tmrHideTimer,msghideAfter);
            return;
          }
          if (msgtmrId!=-1) return;
          msgshowBy=show;

          elCnt=GetTopObject('msg_content');
          elTit=GetTopObject('msg_header');
          el=GetTopObject('msg');
          if(elCnt==null||elTit==null||el==null)
          {return;}
          el.style.left='';

          el.style.filter='';

          if (msgtmrHide!=-1){clearInterval(msgtmrHide);} msgtmrHide=-1;

          elTit.style.display='none';
          elCnt.style.display='none';
          var offsettop=0;

          if (navigator.userAgent.indexOf('Opera')>=0)
               {el.style.top=(document.body.scrollTop+screen.availHeight-220)+'px';}
          else{
          if(typeof(window.pageYOffset)!="undefined")
           {el.style.bottom=(window.top.document.body.scrollHeight*1-window.pageYOffset*1-window.top.document.body.offsetHeight*1+1*msgpopupBottom)+'px';}
           else
          {
            el.style.bottom=(window.top.document.body.scrollHeight*1-window.top.document.documentElement.scrollTop*1-window.top.document.body.offsetHeight*1+1*msgpopupBottom)+'px';
          }}
             msgactualHgt=0; el.style.height=msgactualHgt+'px';
          el.style.visibility='';
          if (!msgresetTimer) el.style.display='';
           {msgtmrId=setInterval(msgespopup_tmrTimer,10);}
        }
        function msgespopup_winLoad()
        {
         /* if (msgoldonloadHndlr!=null) msgoldonloadHndlr();//日程表中有问题,打开表表单关闭再显示窗口表单也出来了*/

          elCnt=GetTopObject('msg_content');
          elTit=GetTopObject('msg_header');
          el=GetTopObject('msg');
          if(elCnt==null||elTit==null||el==null||!elTit) return;
          msgpopupBottom=el.style.bottom.substr(0,el.style.bottom.length-2);
          msgtitHgt=elTit.style.height.substr(0,elTit.style.height.length-2);
          msgpopupHgt=el.style.height;
          msgpopupHgt=msgpopupHgt.substr(0,msgpopupHgt.length-2); msgactualHgt=0;
          msgcntDelta=msgpopupHgt-(elCnt.style.height.substr(0,elCnt.style.height.length-2));

          if (true)
          {
            msgresetTimer=true;
            msgespopup_ShowPopup(null);
          }
        }
        
        function msgespopup_tmrTimer()
        {
          var el=GetTopObject('msg');
          if(el==null)
          {
           if (msgresetTimer)
            {clearInterval(msgtmrId); msgresetTimer=false;}
            msgtmrId=setInterval(msgespopup_tmrTimer,10);
            return;
          }
          if (msgresetTimer)
          {
            el.style.display='';
            clearInterval(msgtmrId); msgresetTimer=false;
            msgtmrId=setInterval(msgespopup_tmrTimer,10);
          }
          msgactualHgt+=5;
          if (msgactualHgt>=msgpopupHgt)
          {
            msgactualHgt=msgpopupHgt; clearInterval(msgtmrId); msgtmrId=-1;
            GetTopObject('msg_content').style.display='';
            if (msghideAfter!=-1) {msgtmrHide=setInterval(msgespopup_tmrHideTimer,msghideAfter);}
          }
          if (msgtitHgt<msgactualHgt-6)
            {GetTopObject('msg_header').style.display='';}
          if ((msgactualHgt-msgcntDelta)>0)
          {
            elCnt=GetTopObject('msg_content');
            elCnt.style.display='';
            elCnt.style.height=(msgactualHgt-msgcntDelta)+'px';
          }
          el.style.height=msgactualHgt+'px';
        }
        
        function msgespopup_tmrHideTimer()
        {
          clearInterval(msgtmrHide); msgtmrHide=-1;
          var el=GetTopObject('msg');
           if(el==null)
          {
           if (msgresetTimer)
            {clearInterval(msgtmrId);} msgresetTimer=false;
            msgtmrId=setInterval(msgespopup_tmrTimer,10);
            return;
          }
          if (msghasFilters)
          {
            var backCnt=GetTopObject('msg_content').innerHTML;
            var backTit=GetTopObject('msg_header').innerHTML;
            GetTopObject('msg_content').innerHTML='';
            GetTopObject('msg_header').innerHTML='';
         
           if(typeof(el.filters)!="object")
             { el.style.display='none';}
            else
            {
              el.style.filter='blendTrans(duration=1)';
              if(typeof el.filters.blendTrans=="object")
              {el.filters.blendTrans.apply();}
              el.style.visibility='hidden';
              if(typeof el.filters.blendTrans=="object")
              {el.filters.blendTrans.play();}
            }
            GetTopObject('msg_content').innerHTML=backCnt;
            GetTopObject('msg_header').innerHTML=backTit;
            
            msgdxTimer=setInterval(msgespopup_dxTimer,1000);
          }
          else  {el.style.display='none';}
        }
        
         function msgespopup_dxTimer()
        {
          clearInterval(msgdxTimer);
           msgdxTimer=-1;
        }
     
        function msgespopup_Close()
        {
          if (msgtmrId==-1){
            el=GetTopObject('msg');
            if(el!=null){el.style.filter='';el.style.display='none';}
           if (msgtmrHide!=-1) {clearInterval(msgtmrHide);};msgtmrHide=-1;
          }
        }
      function beginhide()
      {
      if(msghideAfter==600000) return;
           if(msgtmrHide!=-1)
           {clearInterval(msgtmrHide);}
            msgtmrHide=setInterval(msgespopup_tmrHideTimer,1000);
      }
      function clearhide()
      {
        if(msgtmrHide!=-1)
        {clearInterval(msgtmrHide);}
        msgtmrHide=-1;
      }
      function massage(title,message)
      {  
          this.msgnTitle=title ;
        this.msgnMsg  = message;  
        var el=GetTopObject("msg");
         if(!el){alert(message);return;}
        var ContentHtml,HeaderHtml;
        el.style.display="none";
        el.style.position="absolute";
        el.style.width="240px";
        el.style.height="125px";
           var scrollTop=0;
        if(document.all){scrollTop=document.documentElement.document.body.scrollTop;}
        else{scrollTop=window.top.document.documentElement.scrollTop;}
        if(scrollTop==0)
                  {scrollTop=document.documentElement.scrollTop;}
        if(_center)
        {
           el.visibility = "visible";
           el.style.right=(document.body.clientWidth/2-150)+"px";
           el.style.bottom=(window.top.document.body.scrollHeight-scrollTop-200)+"px";
          var movediv = $('_mainfrDiv');
          if(movediv)
          {
             el.style.bottom="";
             var h=middldiv.style.top;
             if(h==null||h=="")
             {h="0";}
             if(h.indexOf("px")>0)
             {h=h.substring(0,h.indexOf("px",0));}
              if(h.indexOf("pt")>0)
               {h=h.substring(0,h.indexOf("pt",0));}
               h=(parseInt(h)+150);
	          el.style.top=h+"px";
	       }
          }
        else
        {
          el.style.right="15px";
           if(navigator.appVersion.toLowerCase().indexOf("msie 7.0")>0||!document.all)
           {el.style.top=(scrollTop*1+screen.availHeight*1-235)+"px";}/*IE7,firefox,ok,document.documentElement.scrollTopIE7取不到值*/
          else
            {el.style.bottom=(document.documentElement.scrollTop+15)+"px";}/*IE6 ok*/
        }
        
        HeaderHtml='<div id=\"msg_header\" style="width:240px;height:25px;">'+
        '<div class="headerleft" ></div>'+
        '<div class="headermiddl" align="left" style=" width:192px" ><div style="margin: 5px 0px 0px 5px; height:20px;">bowuit</div></div>'+
        '<div class="headermiddl"><div style="cursor:help" title="help" id="helpdiv" onclick="javascript:bwhelp();" class="headerhelp" onmousemove="javascript:this.className=\'headerhelp1\'" onmouseout="javascript:this.className=\'headerhelp\'"></div>'+
        '<div style="cursor:pointer" title="close" id="closediv" onclick="javascript:msgespopup_Close();" class="headerclose" onmousemove="javascript:this.className=\'headerclose1\'" onmouseout="javascript:this.className=\'headerclose\'"></div>'+
        '</div><div class="headerright"></div></div>';
         ContentHtml='<div class="messageframe" align="center" id="msg_content" onmouseover="clearhide()" onmouseout="beginhide()" onmousedown="event.cancelBubble=true;" align="center">'+
        '<div class="fmessagecontent"><table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"height:100%; width:100%;\"><tr><td style=\"height:100%; width:100%;vertical-align:middle;text-align:center;\">'+ message+'</td></tr></table></div></div></div>';
       ContentHtml=HeaderHtml+ ContentHtml;
       
        if(GetTopObject('IFRAME'))
         {ContentHtml+="<iframe src=\"\" border=\"0\" frameborder=\"no\" scrolling=\"no\" style=\"position:absolute; visibility:inherit; top:0px; left:0px; width:196px; height:100px; z-index:-1; filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';\"></iframe>";}
          
          el.innerHTML=ContentHtml;
        msgespopup_winLoad();
         if(typeof bwplay=="function")
        {bwplay('message',{volume:400});}
      } 
      function massagebox(message,aftertime)
      { 
       _center=false;
       if(typeof aftertime=="undefined")
        {msghideAfter=5000;}
        else
         {msghideAfter=aftertime;}

        massage("bowuit",message);
      }
       function msgcenter(message,aftertime)
      {  
       _center=true;
        if(typeof aftertime=="undefined")
        {msghideAfter=5000;}
        else
         {msghideAfter=aftertime;}
        massage("bowuit",message);
      }
    
      function GetTopObject(objectId)
      {  
        if(window.top.document.getElementById && window.top.document.getElementById(objectId)) {
	    return document.getElementById(objectId);
        } else if (window.top.document.all && window.top.document.all(objectId)) {
	    return window.top.document.all(objectId);
        } else if (window.top.document.layers && window.top.document.layers[objectId]) {
   	    return window.top.document.layers[objectId];
         } else {
	   return false;
    }
      }