/**
*
*/
var ie=document.all; 
var nn6=document.getElementById&&!document.all; 
var isdrag=false; 
var y,x; 
var oDragObj; 

function moveMouse(e) { 
 if (isdrag) { 
    oDragObj.style.top  =  (nn6 ? nTY + e.clientY - y : nTY + event.clientY - y)+"px"; //nTY+"px";
    oDragObj.style.left  =  (nn6 ? nTX + e.clientX - x : nTX + event.clientX - x)+"px"; //nTX+"px";
        //限制范围
    var currentX=parseInt(oDragObj.style.left);
    var currentY=parseInt(oDragObj.style.top);
    var maxX=parseInt(oDragObj.parentNode.style.width)-parseInt(oDragObj.style.width);
    var maxY=parseInt(oDragObj.parentNode.style.height)-parseInt(oDragObj.style.height);
    
    if(currentX < 0){
        oDragObj.style.left=0+"px";
    }
    if(currentY < 0){
        oDragObj.style.top=0+"px";
    }
    if(currentX > maxX){
        oDragObj.style.left=maxX+"px";
    }
    if(currentY > maxY){
        oDragObj.style.top=maxY+"px";
    }
    return false; 
 } 
} 

function initDrag(e) { 
 var oDragHandle = nn6 ? e.target : event.srcElement; 
 var topElement = "HTML"; 
 while (oDragHandle.tagName != topElement && oDragHandle.className != "myword") { 
    oDragHandle = nn6 ? oDragHandle.parentNode : oDragHandle.parentElement; 
 } 
 if (oDragHandle.className=="myword") { 
    isdrag = true; 
    oDragObj = oDragHandle; 
    nTY = parseInt(oDragObj.style.top+0); 
    y = nn6 ? e.clientY : event.clientY; 
    nTX = parseInt(oDragObj.style.left+0); 
    x = nn6 ? e.clientX : event.clientX; 
    document.onmousemove=moveMouse; 
    return false; 
 } 
} 
document.onmousedown=initDrag; 
document.onmouseup=new Function("isdrag=false"); 



//-- 控制层删除start of script 
function ssdel(obj){
//兼容firefox

	var new_tr = document.getElementById(obj).parentNode;
	//alert(new_tr);
	try{

		new_tr.removeChild(document.getElementById(obj));
	}catch(e){
	
	}
}


var Obj=''
var index=10000;//z-index;

function getFocus(obj)
{
       if(obj.style.zIndex!=index)
       {
               index = index + 2;
               var idx = index;
               obj.style.zIndex=idx;
       }
}


function G(id){
    return document.getElementById(id);
};

function GC(t){
   return document.createElement(t);
};

function getBodySize(){
   var bodySize = [];
   with(document.documentElement) {
    bodySize[0] = (scrollWidth>clientWidth)?scrollWidth:clientWidth;
    bodySize[1] = (scrollHeight>clientHeight)?scrollHeight:clientHeight;
   }
   return bodySize;
} 

function isIE(){
      return (document.all && window.ActiveXObject && !window.opera) ? true : false;
} 

function popCoverDiv(){
   if (G("cover_div")) {
    G("cover_div").style.display = '';
   } else {
    var coverDiv = GC('div');
    document.body.appendChild(coverDiv);
    coverDiv.id = 'cover_div';
    with(coverDiv.style) {
     position = 'absolute';
    // background = '#CCCCCC';
     left = '0px';
     top = '0px';
     var bodySize = getBodySize();
     width = bodySize[0] + 'px'
     height = bodySize[1] + 'px';
     zIndex = index+200;
     if (isIE()) {
      filter = "Alpha(Opacity=60)";
     } else {
      opacity = 0.6;
     }
    }
   }
}


function showwrite()
{
	popCoverDiv();
	G('cc10000').style.zIndex = index+204;
	G('cc10000').style.display='';
}

function hiddenwrite()
{

    G("cover_div").style.display = 'none';
   document.body.style.overflow = '';
   G('cc10000').style.display='none';
}



