<!--
String.prototype.get   =   function(name)   
  {   
      var   reg   =   new   RegExp("(^|&|\\?)"+   name   +"=([^&]*)(&|$)"),   r;   
      if   (r=this.match(reg))   return   unescape(r[2]);   return   null;   
  }
function getCookieVal (offset)
{
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
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 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" : "");
}
function SetCookieTwo (first,second,value)
{
	var strcookie=document.cookie;
	var strcookfirst=GetCookie(first);
	if (strcookfirst==null)
	{
		document.cookie=first+"="+second+"="+escape (value) ;
	}
	else
	{
		var strcooksecond=GetCookie(first).get(second);
		if (strcooksecond==null)
		{
			strcookfirst=first+"="+strcookfirst+"&"+second+"="+escape (value) ;
			document.cookie=strcookfirst ;
		}
		else
		{
			var strnewcookfirst=strcookfirst.replace(second+"="+escape(strcooksecond),second+"="+escape(value));
			document.cookie=first+"="+strnewcookfirst;
		}
	}
}
function CheckIsNull(obj,msg)
{
	if(obj.value=="")
	{
		alert(msg);
		obj.focus();
		return false;
	}
	return true;
}
function EnterTab()
{
    if(event.keyCode == 13)event.keyCode = 9;
}

function CheckIsZero(obj,msg)
{
	if(obj.value==""||obj.value=="0")
	{
		alert(msg);
		obj.focus();
		return false;
	}
	return true;
}

function chkfloat(sId)
{
	if(isNaN(sId.value))
	{
		alert("非法输入，输入格式应该为小数（如：xxxx.xx,123.40）！");
		while(isNaN(sId.value))
			sId.value=sId.value.substring(0,sId.value.length-1);
			return false;
	}
}

function chkint(sId)
{
	if(/[^0-9]/g.test(sId.value))
	{
		alert("非法输入，输入格式应该为整数（如：3100）！");
		while(/[^0-9]/g.test(sId.value))
		sId.value=sId.value.substring(0,sId.value.length-1);
		return false;
	}
}
function Isdate(sdate)
{
    execScript('n = isdate(\"'+sdate+'\")','vbscript');
    return n;
}

function checkImage(sId,obj)
{
	if(document.all[sId].value!="")
	{
		if((document.all[sId].value.toUpperCase().indexOf(".GIF") == -1)&& (document.all[sId].value.toUpperCase().indexOf(".JPG") == -1) && (document.all[sId].value.toUpperCase().indexOf(".BMP") == -1)&& (document.all[sId].value.toUpperCase().indexOf(".JPEG") == -1)) 
		{
			alert("请选择要上传的图片(格式为gig、jpg、bmp、jpeg)文件！");
			obj.focus();
			event.returnValue = false;
			return false;
		}
		document.all["a"+sId].value="1";
	}
	else
	{
		document.all["a"+sId].value="0";
	}
	return true;
}

function checkImageSize(simg)
{
	var simgsize=parseInt(document.all[simg].fileSize/1024);
	if(simgsize>500||simgsize<0)
	{
	  alert("当前图片大小为"+simgsize+"KB,图象大小范围应该在0~500KB！请重新选择上传!");
	  return false;
	}
	return true;
}
function View(simg,stplj)
	{
		if(document.all[stplj].value=="")
		{
			document.all[simg].src="img/nullimg.gif";
		}
		else
		{
			document.all[simg].src=document.all[stplj].value;
		}
	}
function OpenPage(htmlurl,top,left,width,height)
{
	var strtemp=",top="+top;
	strtemp=strtemp+",left=";
	strtemp=strtemp+left;
	strtemp=strtemp+",width=";
	strtemp=strtemp+width;
	strtemp=strtemp+",height=";
	strtemp=strtemp+height;
	var newwin=window.open(htmlurl,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no"+strtemp);
	newwin.focus();
	return false;
}
//-->