﻿  //window.onresize = enetresizeDiv;
//window.onerror = function(){}
var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,enetobjTimer,i = 0;

function enetgetMsg()
{
    
    divTop = parseInt(oo.style.top,10);
    divLeft = parseInt(oo.style.left,10);
    divHeight = oo.offsetHeight;
    divWidth = oo.offsetWidth;
    docWidth = window.screen.availWidth;
    docHeight = window.screen.availHeight;
    
    enetobjTimer=setInterval(enetmoveDiv,10);
} 
    　
function enetresizeDiv()
{
    i+=1
    if(i>200) 
        close("BroadcastArea");//enetcloseDiv() //自动关闭时间
    try{;
    enetdivHeight = parseInt(oo.offsetHeight,10);
    enetdivWidth = parseInt(oo.offsetWidth,10);
    enetdocWidth = document.body.clientWidth;
    enetdocHeight = document.body.clientHeight;
    //oo.style.top = enetdocHeight - enetdivHeight + parseInt(document.body.scrollTop,10);
    oo.style.left = docWidth - divWidth;
    }
    catch(e){}
}
function enetmoveDiv()
{
   // try
   // {
    //if(parseInt(oo.style.top,10) <= (enetdocHeight - enetdivHeight + parseInt(document.body.scrollTop,10)))
   if(parseInt(oo.style.top,10)<=docHeight-divHeight*2+50)
    {
      
    window.clearInterval(enetobjTimer)
    //enetobjTimer = window.setInterval("enetresizeDiv()",1)
   // window.clearInterval(enetobjTimer);//是否自动关闭 
    
    }
    //enetdivTop = parseInt(oo.style.top,10)
    oo.style.display="block";
    oo.style.top = parseInt(oo.style.top,10)-1;
    
   // }
    //catch(e){}
}
function enetcloseDiv()
{
    oo.style.visibility='hidden';
    if(enetobjTimer) window.clearInterval(enetobjTimer)
}

function drag(o,s){  
    if (typeof o == "string") o = document.getElementById(o);  
    o.orig_x = parseInt(o.style.left) - document.body.scrollLeft;  
    o.orig_y = parseInt(o.style.top) - document.body.scrollTop;  
    o.orig_index = o.style.zIndex;  
          
    o.onmousedown = function(a)  
    {  
        this.style.cursor = "move";  
        this.style.zIndex = 100;  
        var d=document;  
        if(!a)a=window.event;  
        var x = a.clientX+d.body.scrollLeft-o.offsetLeft;  
        var y = a.clientY+d.body.scrollTop-o.offsetTop;  
        //author: www.longbill.cn  
        d.ondragstart = "return false;"  
        d.onselectstart = "return false;"  
        d.onselect = "document.selection.empty();"  
                  
        if(o.setCapture)  
            o.setCapture();  
        else if(window.captureEvents)  
            window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);  

        d.onmousemove = function(a)  
        {
                    
            if(!a)a=window.event;  
            o.style.left = a.clientX+document.body.scrollLeft-x;  
            o.style.top = a.clientY+document.body.scrollTop-y;  
            o.orig_x = parseInt(o.style.left) - document.body.scrollLeft;  
            o.orig_y = parseInt(o.style.top) - document.body.scrollTop; 
            var castArea
            //castArea.innerText=o.style.left+ ":" +o.style.top 
        }  

        d.onmouseup = function()  
        {  
            if(o.releaseCapture)  
                o.releaseCapture();  
            else if(window.captureEvents)  
                window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);  
            d.onmousemove = null;  
            d.onmouseup = null;  
            d.ondragstart = null;  
            d.onselectstart = null;  
            d.onselect = null;  
            o.style.cursor = "normal";  
            //o.style.zIndex = o.orig_index;  
        }  
    }  
      
//    if (s)  
//    {  
//        var orig_scroll = window.onscroll?window.onscroll:function (){};  
//        window.onscroll = function ()  
//        {  
//            orig_scroll();  
//            o.style.left = o.orig_x + document.body.scrollLeft;  
//            o.style.top = o.orig_y + document.body.scrollTop;  
//        }  
//    }  
}