//点击切换显示对像或者隐藏对像
function displayObj(MenuObj){
	MenuObj=document.getElementById(MenuObj);
	if(MenuObj.style.display==''){
		MenuObj.style.display='none';
	}else{
		MenuObj.style.display='';
	}
}

//全选
function CheckAll(form){
  for (var i=0;i<form.elements.length;i++){
    var e = form.elements[i];
    if (e.name != 'chkAll')
    e.checked = form.chkAll.checked;
    }
}

//删除
function del_submit(theform){
	if(confirm('提醒：你确定要删除这些数据吗？')){
		theform.action='del.asp';
		theform.submit();
		theform.action='';
	}else{
		return false;
	}
}

function reloadImgSize(imgD,FitWidth,FitHeight){
var image1=new Image();  
image1.onload = function () 
{ 
    if(this.width>0 && this.height>0)  
    {  
        if(this.width/this.height>= FitWidth/FitHeight)  
        {  
            if(this.width>FitWidth)  
            {  
                imgD.width=FitWidth;  
                imgD.height=(this.height*FitWidth)/this.width;  
            }  
            else  
            {  
                imgD.width=this.width;  
                imgD.height=this.height;  
            }  
        }  
        else  
        {  
            if(this.height>FitHeight)  
            {  
                imgD.height=FitHeight;  
                imgD.width=(this.width*FitHeight)/this.height;  
            }  
            else  
            {  
                imgD.width=this.width;  
                imgD.height=this.height;  
            }  
        }  
    } 
    image1 = null; 
} 
image1.src=imgD.src;  
imgD.style.cursor = 'hand';
}

function setcookie(name,value)
{
  var exp=new Date();
  exp.setYear(exp.getYear()+1);
  //编码：escape();unescape 解码
  document.cookie=name+"="+escape(value)+";expires="+exp.toGMTString();
}


function GetData(OpenUrl,theResultTable){
 var XmlHttp;

 createXmlHttpRequest();
 // 加随机数防止缓存
 if (OpenUrl.indexOf("?") > 0){
    OpenUrl += "&randnum=" + Math.random();
 }else{
    OpenUrl += "?randnum=" + Math.random();
 }
    XmlHttp.onreadystatechange=function(){
        if(XmlHttp.readyState==4){
            if(XmlHttp.status==200)
            {
              document.getElementById(theResultTable).innerHTML = bytes2BSTR(XmlHttp.responsebody);
            }
		//以下这3行代码重要,而且位置一定要在这里,释放内存主要就靠它了,注:这3行代码的位置一定要在if (4==xmlhttp.readyState){}里,否则无效或效果不好.
		delete XmlHttp ; 
		XmlHttp=null;
		CollectGarbage;
		///////////////////////////////////
        }
    }
    XmlHttp.open("post",OpenUrl,true);
    XmlHttp.send();

function createXmlHttpRequest(){
  if(window.ActiveXObject){
   XmlHttp = new ActiveXObject("Microsoft.XmlHttp");
  }else{
   XmlHttp = new XmlHttpRequest();
  }
} 
}