// JavaScript Document

 this.obj=document.getElementsByName("ObjId");
 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(ImgObj,DWidth,DHeight){
	var img=null;
	if(img)img.removeNode(true);
	img=document.createElement("img");//创建IMG对象
	img.style.position="absolute";
	img.style.visibility="hidden";//css使对象显示
	document.body.insertAdjacentElement("beforeend",img);//在当前页面添加IMG对象的所有属性值
	img.src=ImgObj.src;//获取要添加的值
	if((img.offsetWidth>=DWidth)&&(img.offsetHeight>=DHeight)){
		if(img.offsetWidth-DWidth>=img.offsetHeight-DHeight){
			ImgObj.style.width=DWidth;
		}else{
			ImgObj.style.height=DHeight;
		}
		return true;
	}
	if((img.offsetWidth<DWidth)&&(img.offsetHeight<DHeight)){
		ImgObj.style.height=img.offsetHeight;
		ImgObj.style.width=img.offsetWidth;
		return true;
	}

	if(img.offsetWidth>=DWidth){
		ImgObj.style.width=DWidth;
		return true;
	}
	if(img.offsetHeight>=DHeight){
		ImgObj.style.height=DHeight;
		return true;
	}
	if(img.offsetWidth<DWidth){
		ImgObj.style.width=img.offsetWidth;
		return true;
	}
	if(img.offsetHeight<DHeight){
		ImgObj.style.height=img.offsetHeight;
		return true;
	}
}

