// JavaScript Document
 function sel1(){
    for(i=0;i<obj.length;i++)
     obj[i].checked=true;
     
  }
  
   function sel2(){
     for(i=0;i<obj.length;i++)
     obj[i].checked=!obj[i].checked;
  }
  
 function sel3(){
    for(i=0;i<obj.length;i++)
    obj[i].checked=false;
 }
 
//客户端Cookies创建函数

function SetCookie(name, value){
				var argv = SetCookie.arguments;
				var argc = SetCookie.arguments.length;
				var expires = argc > 2 ? argv[2] : null;
				var path = argc > 3 ? argv[3] : null;
				var domain = argc > 4 ? argv[4] : null;
				var secure = argc > 5 ? argv[5] : false;
				document.cookie = name + "=" + escape (value) + (expires == null ? "" : ("; expires=" + expires.toGMTString())) + (path == null ? "" : ("; path=" + path)) + (domain == null ? "" : ("; domain=" + domain)) + (secure == true ? "; secure" : "");
}
//COOKIES获取

function getCookieVal(offset)
{
	var endstr = document.cookie.indexOf(";", offset);
	if (endstr == -1) endstr = document.cookie.length;
	return URLStringCov(unescape(document.cookie.substring(offset, endstr))).replace("'","");
}

function GetCookie(name)
{
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen)
	{
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg) return getCookieVal(j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return null;
}

function URLStringCov(aStr){
	bStr="";
	cStr="";
	for(position=0;position<aStr.length;position++){
		bStr=aStr.substring(position,position+1);
		if(bStr=="+"){
			bStr=" ";
		}
		cStr=cStr+bStr;
	}
	return cStr
}

//当客户端进行FORM数据提交时，使该FORM区域内所有对象不可用
function FormSubmit(aForm){
	return true;
	for (var i=0;i<aForm.elements.length;i++)
    {
    var e = aForm.elements[i];
    e.disabled=true;
    }
	
}

//判断对象是否是一个可能的日期格式值，日期格式：YYYY-MM-DD
function isdate(strDate){
   var strSeparator = "-"; //日期分隔符
   var strDateArray;
   var intYear;
   var intMonth;
   var intDay;
   var boolLeapYear;

   strDateArray = strDate.split(strSeparator);

   if(strDateArray.length!=3) return false;

   intYear = parseInt(strDateArray[0],10);
   intMonth = parseInt(strDateArray[1],10);
   intDay = parseInt(strDateArray[2],10);

   if(isNaN(intYear)||isNaN(intMonth)||isNaN(intDay)) return false;

   if(intMonth>12||intMonth<1) return false;

   if((intMonth==1||intMonth==3||intMonth==5||intMonth==7||intMonth==8||intMonth==10||intMonth==12)&&(intDay>31||intDay<1)) return false;

   if((intMonth==4||intMonth==6||intMonth==9||intMonth==11)&&(intDay>30||intDay<1)) return false;

   if(intMonth==2){
      if(intDay<1) return false;

      boolLeapYear = false;
      if((intYear%100)==0){
         if((intYear%400)==0) boolLeapYear = true;
      }
      else{
         if((intYear%4)==0) boolLeapYear = true;
      }

      if(boolLeapYear){
         if(intDay>29) return false;
      }
      else{
         if(intDay>28) return false;
      }
   }

   return true;
}
//控制图片对象在一定区域内等级显示
////////////////////////////////////////////////////////////////
//ImgAre(ImgObj,DWidth,DHeight),ImgAre(图片对象,指定宽,指定高)//
////////////////////////////////////////////////////////////////
function ImgAre(obj,MaxWidth,MaxHeight){
	if(obj.resized) return;
	img=new Image();
	img.src=obj.src;
	if (img.width>MaxWidth && img.height>MaxHeight){
			if (img.width/img.height>MaxWidth/MaxHeight) {
					obj.height=MaxWidth*img.height/img.width;
					obj.width=MaxWidth;
			}else {
					obj.width=MaxHeight*img.width/img.height;
					obj.height=MaxHeight;
			}
	}else if (img.width>MaxWidth) {
			obj.height=MaxWidth*img.height/img.width;
			obj.width=MaxWidth;
	}else if (img.height>MaxHeight) {
			obj.width=MaxHeight*img.width/img.height;
			obj.height=MaxHeight;
	}else{
			obj.width=img.width;
			obj.height=img.height;
	}
	obj.resized=true;
}
function aImgAre(ImgObj,DWidth,DHeight){
	var aImg=null;
	if(aImg)aImg.removeNode(true);
	aImg=document.createElement("img");//创建IMG对象
	aImg.style.display="none";
	aImg.style.position="absolute";
	document.body.insertAdjacentElement("beforeend",aImg);//在当前页面添加IMG对象的所有属性值
	aImg.src=ImgObj.src;//获取要添加的值
	if(aImg.readyState!="complete") return false;
	aImg.style.display="";
	var aImgWH=aImg.offsetWidth/aImg.offsetHeight;
	var aImgHW=aImg.offsetHeight/aImg.offsetWidth;
	var aImgW=aImg.offsetWidth;
	var aImgH=aImg.offsetHeight;
	aImg.style.display="none";//css使对象显示
	if(aImgW>DWidth && aImgH>DHeight){
		if(aImgW/DWidth>aImgH/DHeight){
			ImgObj.width=DWidth;
			ImgObj.height=DWidth*aImgHW;
			return false;
		}else{
			ImgObj.height=DHeight;
			ImgObj.width=DHeight*aImgWH;
			return false;
		}
	}
	if(aImgW>DWidth){
		ImgObj.width=DWidth;
		ImgObj.height=DWidth*aImgHW;
		return false;
	}
	if(aImgH>DHeight){
		ImgObj.height=DHeight;
		ImgObj.width=DHeight*aImgWH;
		return false;
	}
	if(aImgW<DWidth && aImgH<DHeight){
		ImgObj.height=aImgH;
		ImgObj.width=aImgW;
		return false;
	}
}