﻿///页面加载时执行


Shade = new function() 
{
	var handle = {};
	var shade;

	handle.show = function() 
	{
		if (!shade) 
		{
			shade = document.createElement('div');
			shade.className = 'tb-shade';
			document.body.appendChild(shade);
		}
		with((document.compatMode=='CSS1Compat')?document.documentElement:document.body) 
		{
			var ch = clientHeight, sh = scrollHeight;
			shade.style.height = (sh > ch ? sh : ch) + 'px';
			shade.style.width = offsetWidth + 'px';
			shade.style.display = 'block';
		}
	};

	handle.hide = function() 
	{
		shade.style.display = 'none';
	};

	return handle;
}
 
 function showJiroReg(x) 
 {
     if(x==1)//rename
     {
	     Shade.show();
	 }
	 if(x==2)//beizhu
     {
	     Shade.show();
	 }
	 if(x==3)//NewFiles
     {
	     Shade.show();
	 }
	 if(x==4)//move
	 {
        var j=0;
        var allInput = document.getElementsByTagName("input");
        var loopTime = allInput.length;
        for(i = 0;i < loopTime;i++)
        {
            if(allInput[i].type == "checkbox")
            {
                if(allInput[i].checked ==true)
                {
                    j++;
                }
            }
        }
        if(j<1)
        {
            alert('请选择一个文件操作！');
            return false; 
        }
        else
        {
            Shade.show();
        }
    }
    if(x==5)
    {
        var j=0;
        var allInput = document.getElementsByTagName("input");
        var loopTime = allInput.length;
        for(i = 0;i < loopTime;i++)
        {
            if(allInput[i].type == "checkbox")
            {
                if(allInput[i].checked ==true)
                {
                    j++;
                }
            }
        }
        if(j<1)
        {
            alert('请选择一个文件操作！');
            return false; 
        }
        else
        {
            Shade.show();
        }    
    }
    if(x==6)//ADDPwdFiles
    {
        var j=0;
        var allInput = document.getElementsByTagName("input");
        var loopTime = allInput.length;
        for(i = 0;i < loopTime;i++)
        {
            if(allInput[i].type == "checkbox")
            {
                if(allInput[i].checked ==true)
                {
                    j++;
                }
            }
        }
        if(j!=1)
        {
            alert('请选择一个文件操作！');
            return false; 
        }
        else
        {
            Shade.show();
        }
    }
    if(x==7)//share
    {
        var j=0;
        var allInput = document.getElementsByTagName("input");
        var loopTime = allInput.length;
        for(i = 0;i < loopTime;i++)
        {
            if(allInput[i].type == "checkbox")
            {
                if(allInput[i].checked ==true)
                {
                    j++;
                }
            }
        }
        if(j!=1)
        {
            alert('请选择一个文件操作！');
            return false; 
        }
        else
        {
            Shade.show();
        }
    }
    if(x==8)//Seach
     {
	     Shade.show();
	 }
 }
    
 function hideJiroReg() {
	 Shade.hide();
 }
 

function uploadShow_Click(DirID)
{
    if(DirID==1)
    {
    	alert('当前是根目录未能上传文件,请选择其它目录！');
    	return false;
    }
    
     Shade.show();
	 document.getElementById('uploadPanel').style.display = 'block';
}

function uploadhide_Click()
{
     Shade.hide();
	 document.getElementById('uploadPanel').style.display = 'none';
     //window.location=window.location;
}   

function btnover(obj){
obj.className="butdiv";
}
function btnout(obj){
obj.className="";
}

//多选
function selectAll(obj)
{
    var allInput = document.getElementsByTagName("input");
    var loopTime = allInput.length;
    for(i = 0;i < loopTime;i++)
    {
        if(allInput[i].type == "checkbox")
        {
            if(allInput[i].disabled==false)
            {
                allInput[i].checked = obj.checked;
            }
        }
    }
}
    
//OK/Cancel
function   CheckDel()   
{   
    var result = false;
    var allInput = document.getElementsByTagName("input");
    var loopTime = allInput.length;
    for(i = 0;i < loopTime;i++)
    {
        if(allInput[i].checked)
        {
            result = true;
            break;
        }
    }
    if(!result)
    {
        alert("请先选则要删除的记录！");
        return result;
    }
    result = confirm("你确认要删除选定的记录吗？");
    return result;
}
