// JavaScript Document
//屏蔽窗口
function $(id){return document.getElementById(id);}

function Open(divPageMask,main_msg)
{
	sDisp(0);  
   document.getElementById("divPageMask").style.display="block";
   resizeMask();
   window.onResize = resizeMask;
   document.getElementById("main_msg").style.display="block";
}
function Close()
{  
	sDisp(1);
   document.getElementById("divPageMask").style.width = "0px";
   document.getElementById("divPageMask").style.height = "0px";
   document.getElementById("main_msg").style.top = "-300px";
   
   window.onResize = null;
}
function close_div()
{
	document.getElementById('msg_span').innerHTML='';
	document.getElementById('main_msg').style.display="none";
}
 
function resizeMask()
{
	document.getElementById("divPageMask").style.width = document.body.scrollWidth;
	document.getElementById("divPageMask").style.height = document.body.scrollHeight>document.body.clientHeight?document.body.scrollHeight:document.body.clientHeight;
	document.getElementById("main_msg").style.left = (document.body.offsetWidth - document.getElementById("main_msg").offsetWidth) / 2;
	document.getElementById("main_msg").style.top = (document.body.offsetHeight - document.getElementById("main_msg").offsetHeight) / 2;
}
function sDisp(val)
{var dispalyType;
   var dType=["hidden","visible"];
   var obj=document.getElementsByTagName("select");
   for (i=0;i<obj.length;i++)
   {
     obj[i].style.visibility=dType[val];
   }
}



function neverDragDivision(fObj,trObj) 
{ 
with (this)
{
 if (!fObj) return;
 this.bDraged = false;
 this.oDragOrig = document.getElementById(fObj); 
 this.oDragTr=document.getElementById(trObj);

 oDragOrig.style.cursor = "move";
 oDragOrig.onmousedown = function()
 {
	 var evt=getEvent();
	 var ofs = Offset(oDragOrig);
	oDragOrig.style.position = "absolute";
	oDragOrig.style.left = ofs.l;
	oDragOrig.style.top = ofs.t;
  	
	oDragOrig.X = (evt.clientX - ofs.l) + "px";
	oDragOrig.Y = (evt.clientY - ofs.t) + "px";
	bDraged = true;
 };  
 oDragOrig.onmousemove = function()
 {
  var evt=getEvent();
  if (!bDraged) return;
  oDragOrig.setCapture();
  oDragOrig.style.left = (evt.clientX - oDragOrig.X) + "px";
  oDragOrig.style.top = (evt.clientY - oDragOrig.Y) + "px";

 };
 oDragOrig.onmouseup = function()
 {
  bDraged = false;
  oDragOrig.releaseCapture();
 };
 oDragTr.onmouseout = function()
 {
  oDragOrig.onmousemove = '';
  oDragOrig.style.cursor = '';
  bDraged = false;
  oDragOrig.releaseCapture();
 };
 function Offset(e) {
  var t = e.offsetTop;
  var l = e.offsetLeft;
  var w = e.offsetWidth;
  var h = e.offsetHeight;
  while(e=e.offsetParent) {
   t+=e.offsetTop;
   l+=e.offsetLeft;
  }
  return { t:t, l:l, w:w, h:h }
 };
}};

// 获得事件Event对象，用于兼容IE和FireFox
function getEvent() {
	return window.event || arguments.callee.caller.arguments[0];
}


function drag(o,s)  
{  
    if (typeof o == "string") o = document.getElementById(o);
	if (typeof s == "string") s = document.getElementById(s);
    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;  
          
    s.onmousedown = function(a)  
    {  
        o.style.zIndex = 10000;  
        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;  
        }  

        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.zIndex = o.orig_index;  
        }  
    } 
	s.onmouseout = function(){
		o.style.cursor = "";
	}
	s.onmousemove = function(){
		o.style.cursor = "move";
	}
}  