<!-- 
var docEle = function(id) 
{
    var obj= document.getElementById(id);
    obj.style.visibility = 'visible';
    obj.style.display    = ''; 
    return obj;
}
var body_element_id=null;
//-----popup_close-------------------------------------------
function popup_close()
{
    var obj=document.getElementById('popupExit');
    if(document.all)
    {
        obj.fireEvent("onclick");
    }
    else
    {
        var evt = document.createEvent('HTMLEvents');   
        evt.initEvent('click',true,true);   
        obj.dispatchEvent(evt);   
    }
}
// ----- popup_show ------------------------------------------------------------
function popup_show(title,id,width,height)
{
    var popup_dragging = false;
    var popup_mouseX;
    var popup_mouseY;
    var popup_mouseposX;
    var popup_mouseposY;
    var popup_oldfunction;   
    var ie      = navigator.appName == "Microsoft Internet Explorer";
    
    var element               =  docEle("popupClass");
    element.className         = 'popup_class';
    element.style.height      = ((height || 260) + 30) + 'px';
    element.style.width       = (width || 400)+'px';      
    element.onmousedown       = popup_mousedown;
    
    var drag_element          =  docEle("popupDrag");
    drag_element.className    = 'menu_form_header';    
    drag_element.style.height = '30px';  
    drag_element.style.width  = '98%';  
    drag_element.onmousedown  = popup_mousedown;
    
    var exit_element          = docEle("popupExit");
    exit_element.className    = 'menu_form_exit';
    exit_element.src          = '/Admin/Images/close.png';
    exit_element.title        = 'Close';
    exit_element.onclick      = popup_exit; 
    
    var title_element         = docEle("popupTitle");
    title_element.innerHTML   = title;
     
    if(body_element_id!=null && id!=body_element_id)
    {
        var old_body_element  = docEle(body_element_id);
        old_body_element.style.visibility = 'hidden';
        old_body_element.style.display    = 'none'; 
    }        
    var body_element          = docEle(id);   
    body_element_id           = id;
    body_element.className    = 'menu_form_body';    
    body_element.style.width  = '98%';     
    body_element.style.height = (height || 260)+'px'; 
    
    var iframe_element        = docEle("popupIFrame");
    iframe_element.className  = 'iframe_for_hide';
    iframe_element.style.frameBorder="0px";
    
    newDivCenter();
    //弹出层滚动居中

    function newDivCenter()
    { 
        if(document.body.scrollTop){
            element.style.left=(document.documentElement.clientWidth-element.clientWidth)/2+document.body.scrollLeft+"px";
            element.style.top=(document.documentElement.clientHeight-element.clientHeight)/2+document.body.scrollTop+"px";
        }else{
            element.style.left=(document.documentElement.clientWidth-element.clientWidth)/2+document.documentElement.scrollLeft+"px";
            element.style.top=(document.documentElement.clientHeight-element.clientHeight)/2+document.documentElement.scrollTop+"px";
        }        
    }
    
  // ----- Attach Events ---------------------------------------------------------  

    if (ie)
         document.attachEvent('onmousedown', popup_mousepos);
    else document.addEventListener('mousedown', popup_mousepos, false);
    if (ie)
         document.attachEvent('onmousemove', popup_mousemove);
    else document.addEventListener('mousemove', popup_mousemove, false);
    if (ie)
         document.attachEvent('onmouseup', popup_mouseup);
    else document.addEventListener('mouseup', popup_mouseup, false);
    
      
    // ----- popup_mousepos --------------------------------------------------------
    function popup_mousepos(e)
    {
      popup_mouseposX = ie ? window.event.clientX : e.clientX;
      popup_mouseposY = ie ? window.event.clientY : e.clientY;
    }
    function popup_display(x)
    {
      var win = window.open();
      for (var i in x) win.document.write(i+' = '+x[i]+'<br />');
    }
    // ----- popup_mousedown -------------------------------------------------------
    function popup_mousedown(e)
    {
      if ( ie && window.event.button != 1) return;
      if (!ie && e.button            != 0) return;
      if(popup_dragging){return;}
      
      var eventSrc =!ie? e.target : (window.event ? window.event.srcElement : null);  
      var tagName=eventSrc!=null?eventSrc.tagName.toLowerCase():'';   
      if (tagName == "select" || tagName=="input" || tagName=="textarea") return;
      
      popup_dragging = true;
      popup_mouseX   = ie ? window.event.clientX : e.clientX;
      popup_mouseY   = ie ? window.event.clientY : e.clientY;      
      if (ie)
           popup_oldfunction      = document.onselectstart;
      else popup_oldfunction      = document.onmousedown;
      if (ie)
           document.onselectstart = new Function("return false;");
      else document.onmousedown   = new Function("return false;");
    }
    // ----- popup_mousemove -------------------------------------------------------
    function popup_mousemove(e)
    {
      if (!popup_dragging) return;   
      var mouseX = ie ? window.event.clientX : e.clientX;
      var mouseY = ie ? window.event.clientY : e.clientY;
      element.style.left = (element.offsetLeft+mouseX-popup_mouseX)+'px';
      element.style.top  = (element.offsetTop +mouseY-popup_mouseY)+'px';
      popup_mouseX = ie ? window.event.clientX : e.clientX;
      popup_mouseY = ie ? window.event.clientY : e.clientY;
    }
    // ----- popup_mouseup ---------------------------------------------------------
    function popup_mouseup(e)
    {
      if (!popup_dragging) return;
      popup_dragging = false;
      if (ie)
           document.onselectstart = popup_oldfunction;
      else document.onmousedown   = popup_oldfunction;
    }
    // ----- popup_exit ------------------------------------------------------------
    function popup_exit(e)
    {
      popup_mouseup(e);
      
      body_element.style.visibility='hidden';
      body_element.style.display='none';      
      
      element.style.visibility = 'hidden';
      element.style.display    = 'none';     
    }
}
    
-->
