//parseInt()\u5c0d"08"\u53ca"09"\u958b\u982d\u7684\u6703\u6709\u554f\u984c
function parseInt1(str){
	if(str.length<1) return parseInt(str);
	while(str.substr(0,1)=='0'){
		str=str.substr(1,str.length);
	}
	if(str=='0') return 0;
	return parseInt(str);
}
//\u5c07\u6b04\u4f4d\u5167\u5bb9\u8f49\u6210\u5927\u5beb
function upper(column){
	column.value=column.value.toUpperCase();
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
	document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);	//reloads the window if Nav4 resized
function showLine(obj) {
	obj.style.visibility="visible";
}

function getEnterKey(e) {
	if (navigator.appName == 'Netscape' && (e.keyCode == 13 ))
		return false;
	else if (navigator.appName == 'Microsoft Internet Explorer' && (event.keyCode == 13 )) {
		//form1.onfocus;
		return false;
	}
	return true;
}

// \u5148\u5c07\u6b04\u4f4d\u53bb\u982d\u5c3e\u7a7a\u767d \u7136\u5f8c \u6aa2\u67e5\u7a7a\u767d ( InputBox\u6b04\u4f4d\u5168\u540d,\u6b04\u4f4d\u4e2d\u6587\u8a0a\u606f ) \u50b3\u56de\u8a0a\u606f String
function checkEmpty( column, name ){
	columnTrim( column );
	if( column.value.length == 0 ){
		column.style.backgroundColor="red";
		column.focus();
		return name + "\u4e0d\u53ef\u4ee5\u7a7a\u767d!\n";
	}else{
		column.style.backgroundColor="white";
		return "";
	}
}

// \u5148\u5c07\u6b04\u4f4d\u53bb\u982d\u5c3e\u7a7a\u767d \u7136\u5f8c \u6aa2\u67e5\u7a7a\u767d & \u79c0\u8a0a\u606f ( InputBox\u6b04\u4f4d\u5168\u540d,\u6b04\u4f4d\u4e2d\u6587\u8a0a\u606f ) \u56de\u50b3\u662f\u5426\u7a7a\u767d boolean
function checkEmptyAlert( column, name ){
	columnTrim( column );
	if( column.value.length == 0 ){
		column.focus();
		alert(name + "\u4e0d\u53ef\u4ee5\u7a7a\u767d!\n");
		return false;
	}
	return true;
}
// \u5148\u5c07\u6b04\u4f4d\u53bb\u982d\u5c3e\u7a7a\u767d \u7136\u5f8c \u6aa2\u67e5\u7a7a\u767d & \u79c0\u8a0a\u606f & \u5e95\u8272\u53cd\u7d05 ( InputBox\u6b04\u4f4d\u5168\u540d,\u6b04\u4f4d\u4e2d\u6587\u8a0a\u606f ) \u56de\u50b3\u662f\u5426\u7a7a\u767d boolean
function checkEmptyAlertAndShowRed( column, name ){
	columnTrim( column );
	if( column.value.length == 0 ){
		column.style.backgroundColor="red";
		alert(name + "\u4e0d\u53ef\u4ee5\u7a7a\u767d!\n");
		return false;
	}else{
		column.style.backgroundColor="white";
		return true;
	}
}
// \u5148\u5c07\u6b04\u4f4d\u53bb\u982d\u5c3e\u7a7a\u767d \u7136\u5f8c \u6aa2\u67e5\u7a7a\u767d & \u79c0\u8a0a\u606f & \u5e95\u8272\u53cd\u7d05 ( InputBox\u6b04\u4f4d\u5168\u540d,\u6b04\u4f4d\u4e2d\u6587\u8a0a\u606f ) \u56de\u50b3\u662f\u5426\u7a7a\u767d boolean
function checkFullAlertAndShowRed( column, name ,no){
	columnTrim( column );
	if( column.value.length != no ){
		column.style.backgroundColor="red";
		alert(name + "\u9700\u586b\u6eff"+no+"\u4f4d");
		return false;
	}else{
		column.style.backgroundColor="white";
		return true;
	}
}
function errorAction(column){
	column.style.backgroundColor="red";
	column.focus();
	//column.select();
}
// \u5148\u5c07\u6b04\u4f4d\u53bb\u982d\u5c3e\u7a7a\u767d \u7136\u5f8c \u6aa2\u67e5\u6578\u5b57\u6b04\u4f4d\u662f\u5426\u8f38\u5165\u6578\u5b57&\u6709\u7121\u8d85\u904e\u6574\u6578
// &\u5c0f\u6578\u4f4d\u6578 , \u6709\u932f\u8aa4\u8005\u6703\u52a0 \u53cd\u7d05
// \u8f38\u5165 ( InputBox\u6b04\u4f4d\u5168\u540d,\u6574\u6578\u4f4d\u6578,\u5c0f\u6578\u4f4d\u6578 ) \u56de\u50b3\u662f\u5426\u70ba\u6574\u6578 boolean
function checkFloat( column , I , F ){
	replaceComma( column );
	columnTrim( column );
	var S = column.value ;
	var E = parseFloat(S) ;
	if(S==""){
		column.value = 0 ;
		return "" ;
	}
	for(ii=0 ; ii<S.length ; ii++){
		E=S.substring(ii,S.length)
		if(isNaN(E)){
			column.focus();
			column.style.backgroundColor="red";
			return name + "\u8acb\u8f38\u5165\u6578\u5b57!\n";
		}
	}
	if( S.indexOf('.')==-1){
		if(S.length > I){
			column.focus();
			column.style.backgroundColor="red";
			return name + "\u6574\u6578\u90e8\u5206\u4e0d\u53ef\u5927\u65bc "+I+" \u4f4d!\n";
		}
	}else{
		if(F==0){
			column.focus();
			column.style.backgroundColor="red";
			return name + "\u8acb\u8f38\u5165\u6574\u6578!\n";
		}
		if(S.indexOf('.') > I){
			column.focus();
			column.style.backgroundColor="red";
			return name + "\u6574\u6578\u90e8\u5206\u4e0d\u53ef\u5927\u65bc "+I+" \u4f4d!\n";
		}
		if(S.substring(S.indexOf('.')+1,S.length).length > F ){
			column.focus();
			column.style.backgroundColor="red";
			return name + "\u5c0f\u6578\u90e8\u5206\u4e0d\u53ef\u5927\u65bc "+F+" \u4f4d\n";
		}
	}
	column.style.backgroundColor="white";
	return "" ;
}
// \u5148\u5c07\u6b04\u4f4d\u53bb\u982d\u5c3e\u7a7a\u767d \u7136\u5f8c \u6aa2\u67e5\u6578\u5b57\u6b04\u4f4d\u662f\u5426\u8f38\u5165\u6574\u6578 ( InputBox\u6b04\u4f4d\u5168\u540d ) \u56de\u50b3\u662f\u5426\u70ba\u6574\u6578 boolean
function checkInt(column,name){
	  replaceComma( column );
	  columnTrim( column );
	  if(column.value==""){
		column.value=0 ;
	  }
	  var num = parseInt(column.value);
	  if(isNaN(num)||num!=column.value){
		 column.style.backgroundColor="red";
		 //alert("\u8acb\u8f38\u5165\u6574\u6578");
		 //s_msg.innerText="\u8acb\u8f38\u5165\u6574\u6578";
		 return name + "\u8acb\u8f38\u5165\u6574\u6578\n";
	  }else{
		 column.value=num;
		 //return true;
		 column.style.backgroundColor="white";
		 return "";
	  }
}

// \u5148\u5c07\u6b04\u4f4d\u53bb\u982d\u5c3e\u7a7a\u767d \u7136\u5f8c \u6aa2\u67e5\u6578\u5b57\u6b04\u4f4d\u662f\u5426\u8f38\u5165\u6574\u6578 ( InputBox\u6b04\u4f4d\u5168\u540d ) \u56de\u50b3\u662f\u5426\u70ba\u6574\u6578 boolean
function checkIntAlert(column,name){
	  replaceComma( column );
	  columnTrim( column );
	  if(column.value==""){
		column.value=0 ;
	  }
	  var num = parseInt(column.value);
	  if(isNaN(num)||num!=column.value){
	  	column.focus();
		 column.style.backgroundColor="red";
		 alert(name + "\u8acb\u8f38\u5165\u6574\u6578");
		return false;
	  }else{
		 column.value=num;
		 column.style.backgroundColor="white";
		 return true;
	  }
}
// \u5148\u5c07\u6b04\u4f4d\u53bb\u982d\u5c3e\u7a7a\u767d \u7136\u5f8c \u6aa2\u67e5\u6578\u5b57\u6b04\u4f4d\u662f\u5426\u8f38\u5165\u6b63\u6574\u6578 ( InputBox\u6b04\u4f4d\u5168\u540d ) \u56de\u50b3\u662f\u5426\u70ba\u6574\u6578 boolean
function checkPositiveIntAlert(column,name){
	  replaceComma( column );
	  columnTrim( column );
	  if(column.value==""){
		column.value=0 ;
	  }
	  var num = parseInt(column.value);
	  if(isNaN(num)||num!=column.value){
	  	column.focus();
		 column.style.backgroundColor="red";
		 alert(name + "\u8acb\u8f38\u5165\u6574\u6578");
		return false;
	  }else{
		 column.value=num;
		 if ((num+"").substring(0,1)=="-"){
		 	column.focus();
		 	column.style.backgroundColor="red";
		 	alert(name + "\u4e0d\u53ef\u70ba\u8ca0\u6578");
		 	return false;
		 }else{
		 	column.style.backgroundColor="white";
		 	return true;
		 }
	  }
}
// \u5148\u5c07\u6b04\u4f4d\u53bb\u982d\u5c3e\u7a7a\u767d \u7136\u5f8c \u6aa2\u67e5\u6578\u5b57\u6b04\u4f4d\u662f\u5426\u8f38\u5165\u6578\u5b57&\u6709\u7121\u8d85\u904e\u6574\u6578
// &\u5c0f\u6578\u4f4d\u6578 , \u6709\u932f\u8aa4\u8005\u6703\u52a0 \u53cd\u7d05
// \u8f38\u5165 ( InputBox\u6b04\u4f4d\u5168\u540d,\u6574\u6578\u4f4d\u6578,\u5c0f\u6578\u4f4d\u6578 ) \u56de\u50b3\u662f\u5426\u70ba\u6574\u6578 boolean
function checkFloatAlert( column,name , I , F ){
	replaceComma( column );
	columnTrim( column );
	var S = column.value ;
	var E = parseFloat(S) ;

	if(S==""){
		column.value = 0 ;
		return true ;
	}
	for(ii=0 ; ii<S.length ; ii++){
		E=S.substring(ii,S.length)
		if(isNaN(E)){
			column.focus();
			column.style.backgroundColor="red";
			alert(name + "\u8acb\u8f38\u5165\u6578\u5b57");
			return false ;
		}
	}
	if( S.indexOf('.')==-1){
		if(S.length > I){
			column.focus();
			column.style.backgroundColor="red";
			alert(name + "\u6574\u6578\u90e8\u5206\u4e0d\u53ef\u5927\u65bc "+I+" \u4f4d");
			return false ;
		}
	}else{
		if(F==0){
			column.focus();
			column.style.backgroundColor="red";
			alert(name + "\u8acb\u8f38\u5165\u6574\u6578");
			return false ;
		}
		if(S.indexOf('.') > I){
			column.focus();
			column.style.backgroundColor="red";
			alert(name + "\u6574\u6578\u90e8\u5206\u4e0d\u53ef\u5927\u65bc "+I+" \u4f4d");
			return false ;
		}
		if(S.substring(S.indexOf('.')+1,S.length).length > F ){
			column.focus();
			column.style.backgroundColor="red";
			alert(name + "\u5c0f\u6578\u90e8\u5206\u4e0d\u53ef\u5927\u65bc "+F+" \u4f4d");
			return false ;
		}
	}
	column.style.backgroundColor="white";
	return true ;
}
// \u5148\u5c07\u6b04\u4f4d\u53bb\u982d\u5c3e\u7a7a\u767d \u7136\u5f8c \u6aa2\u67e5\u6578\u5b57\u6b04\u4f4d\u662f\u5426\u8f38\u5165\u6578\u5b57&\u6709\u7121\u8d85\u904e\u6574\u6578
// &\u5c0f\u6578\u4f4d\u6578 , \u6709\u932f\u8aa4\u8005\u6703\u52a0 \u53cd\u7d05
// \u8f38\u5165 ( InputBox\u6b04\u4f4d\u5168\u540d,\u6574\u6578\u4f4d\u6578,\u5c0f\u6578\u4f4d\u6578 ) \u56de\u50b3\u662f\u5426\u70ba\u6574\u6578 boolean
function checkPositiveFloatAlert( column,name , I , F ){
	replaceComma( column );
	columnTrim( column );
	var S = column.value ;
	var E = parseFloat(S) ;

	if(S==""){
		column.value = 0 ;
		return true ;
	}
	for(ii=0 ; ii<S.length ; ii++){
		E=S.substring(ii,S.length)
		if(isNaN(E)){
			column.focus();
			column.style.backgroundColor="red";
			alert(name + "\u8acb\u8f38\u5165\u6578\u5b57");
			return false ;
		}
	}
	if( S.indexOf('.')==-1){
		if(S.length > I){
			column.focus();
			column.style.backgroundColor="red";
			alert(name + "\u6574\u6578\u90e8\u5206\u4e0d\u53ef\u5927\u65bc "+I+" \u4f4d");
			return false ;
		}
	}else{
		if(F==0){
			column.focus();
			column.style.backgroundColor="red";
			alert(name + "\u8acb\u8f38\u5165\u6574\u6578");
			return false ;
		}
		if(S.indexOf('.') > I){
			column.focus();
			column.style.backgroundColor="red";
			alert(name + "\u6574\u6578\u90e8\u5206\u4e0d\u53ef\u5927\u65bc "+I+" \u4f4d");
			return false ;
		}
		if(S.substring(S.indexOf('.')+1,S.length).length > F ){
			column.focus();
			column.style.backgroundColor="red";
			alert(name + "\u5c0f\u6578\u90e8\u5206\u4e0d\u53ef\u5927\u65bc "+F+" \u4f4d");
			return false ;
		}
	}
	if (column.value.substring(0,1)=="-"){
	 	column.focus();
	 	column.style.backgroundColor="red";
	 	alert(name + "\u4e0d\u53ef\u70ba\u8ca0\u6578");
	 	return false;
	 }else{
	 	column.style.backgroundColor="white";
	 	return true;
	 }
}
// \u5148\u5c07\u6b04\u4f4d\u53bb\u982d\u5c3e\u7a7a\u767d \u7136\u5f8c \u6aa2\u67e5\u7a7a\u767d & \u5e95\u8272\u53cd\u7d05 ( InputBox\u6b04\u4f4d\u5168\u540d,\u6b04\u4f4d\u4e2d\u6587\u8a0a\u606f ) \u56de\u50b3\u8a0a\u606f String
function checkEmptyAndShowRed(column, name){
	columnTrim( column );
	if( column.value.length == 0 ){
		column.style.backgroundColor="red";
		return name + "\u4e0d\u53ef\u4ee5\u7a7a\u767d!\n";
	}else{
		return "";
	}
}
// \u6b04\u4f4d\u53bb","\u9ede~ ( InputBox\u6b04\u4f4d\u5168\u540d ) void
function replaceComma(column){
	var S = column.value ;
	var i=0;
	if(S.length>0){
		while(i<=S.length){
			S = S.replace(/,/,"");
			i++;
		}
	}
	column.value = S ;
}
// \u6b04\u4f4d\u53bb\u982d\u5c3e\u7a7a\u767d~ ( InputBox\u6b04\u4f4d\u5168\u540d ) void
function columnTrim( column ){
	var S = column.value ;
	if(S.length>0){
		while(S.substring(0,1)==" "){
			S = S.substring(1,S.length);
		}
		while(S.substring(S.length-1,S.length)==" "){
			S = S.substring(0,(S.length-1));
		}
	}
	column.value = S ;
}

// \u5b57\u4e32\u53bb\u982d\u5c3e\u7a7a\u767d~ ( \u5b57\u4e32 ) \u56de\u50b3\u5b57\u4e32 String
function AllTrim(S){
	if(S.length>0){
		while(S.substring(0,1)==" "){
			S = S.substring(1,S.length);
		}
		while(S.substring(S.length-1,S.length)==" "){
			S = S.substring(0,(S.length-1));
		}
	}
	return S;
}
function insert() {
	var item;
	item=parseInt(form1.count.value);
	item++;
	form1.count.value=item;
	newTR=t1.insertRow();
	newTR.align="center";
	newTD=newTR.insertCell();
	newTD.insertAdjacentHTML("AfterBegin","<input type=checkbox name=beSelect value="+item+">");
	newTD=newTR.insertCell();
	newTD.insertAdjacentHTML("AfterBegin","<input type=text name=manu_seq_"+item+" size=10 maxlength=3>");
	newTD=newTR.insertCell();
	newTD.insertAdjacentHTML("AfterBegin","<input type=text name=manu_no_"+item+" size=10 maxlength=2 onfocus='insert()'>");
	newTD=newTR.insertCell();
	newTD.insertAdjacentHTML("AfterBegin","<label style='background : Silver;width : 80%;text-align : left;'></label>");
	newTD=newTR.insertCell();
	newTD.insertAdjacentHTML("AfterBegin","<select name=enter_account_"+item+"><option>Y</option><option>N</option></select>");
}
function insert(i) {
	var item;
	item=parseInt(form1.count.value);
	if(item > i)	return;
	item++;
	form1.count.value=item;
	newTR=t1.insertRow();
	newTR.align="center";
	newTD=newTR.insertCell();
	newTD.insertAdjacentHTML("AfterBegin","<input type=checkbox name=beSelect value="+item+">");
	newTD=newTR.insertCell();
	newTD.insertAdjacentHTML("AfterBegin","<input type=text name=manu_seq_"+item+" size=10 maxlength=3>");
	newTD=newTR.insertCell();
	newTD.insertAdjacentHTML("AfterBegin","<input type=text name=manu_no_"+item+" size=10 maxlength=2 onfocus='insert("+item+")'>");
	newTD=newTR.insertCell();
	newTD.insertAdjacentHTML("AfterBegin","<label style='background : Silver;width : 80%;text-align : left;'></label>");
	newTD=newTR.insertCell();
	newTD.insertAdjacentHTML("AfterBegin","<select name=enter_account_"+item+"><option>Y</option><option>N</option></select>");
}
function go(url){
	location.href = url;
}
var ca_daysInMonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
function getDaysInMonth(year,month) {  //\u53d6\u5f97\u6bcf\u6708\u7684\u5929\u6578(year:\u897f\u5143\u5e74,month:\u5f9e1\u958b\u59cb)
	if (1 == (month-1))
		return ((0 == year % 4) && (0 != (year % 100))) || (0 == year % 400) ? 29 : 28;
	else
		return ca_daysInMonth[month];
}
//\u65e5\u671f
function checkDate(column,name){
	columnTrim( column );
	var targetstr = column.value.split("/");
	year=eval(targetstr[0]);
	month=eval(targetstr[1]);
	day=eval(targetstr[2]);	
	
	var dayInMonth = getDaysInMonth(year+1911,month-1);
        if(column == "") {
	    	column.style.backgroundColor="red";
            return name + "\u4e0d\u80fd\u7a7a\u767d!\n";
        } else if(column.value.length < 8 || isNaN(year) || isNaN(month) || isNaN(day) || column.value.charAt(targetstr[0].length)!= '/' || column.value.charAt(targetstr[0].length+targetstr[1].length+1) != '/') {
	    	column.style.backgroundColor="red";
            return name + "\u65e5\u671f\u683c\u5f0f\u4e0d\u7b26!(YY/MM/DD)\n";
        } else if(year+1911 > 3000 || year+1911 < 1900) {
	    	column.style.backgroundColor="red";
            return name + "\u5e74\u4efd\u4e0d\u7b26!\n";
        } else if(month > 12 || month < 1) {
	    	column.style.backgroundColor="red";
            return name + "\u6708\u4efd\u4e0d\u7b26!\n";
        } else if(day > dayInMonth || day < 1) {
	    	column.style.backgroundColor="red";
            return name + "\u65e5\u4e0d\u7b26!\n";
        } else{
        	column.style.backgroundColor="white";
        }
        //column.value=year+'/'+month+'/'+day;
        return "";
}
//\u6aa2\u67e5\u5e74\u53ca\u6708
function checkYearMonth(column,name){
	columnTrim( column );
	var targetstr = column.value.split("/");
	var yearleng = targetstr[0].length;
	//alert(yearleng);
	if(targetstr[0].substr(0,1)=="0") targetstr[0]=targetstr[0].substr(1,targetstr[0].length);
	if(targetstr[0]=="") targetstr[0]="0";
	//alert(targetstr[0]);
	year=parseInt(targetstr[0]);
	month=parseInt(targetstr[1]);
	//alert(targetstr[0]+'-'+targetstr[1]+'     '+year+'-'+month);
	if(targetstr[1]=="08")	month =8;
	else if(targetstr[1]=="09")	month =9;
	else month=parseInt(month);
	//alert(column.value.length < 3);
	//alert(isNaN(year));
	//alert(isNaN(month));
	//alert(column.value.charAt(yearleng));
        if(column.value == "") {
	    	column.style.backgroundColor="red";
            return name + "\u4e0d\u80fd\u7a7a\u767d!\n";
        } else if(column.value.length < 3 || isNaN(year) || isNaN(month) || column.value.charAt(yearleng)!= '/' ) {
	    	column.style.backgroundColor="red";
            return name + "\u65e5\u671f\u683c\u5f0f\u4e0d\u7b26!(\u6c11\u570b\u5e74\uff1aYYY/MM)\n";
        } else if(year+1911 > 3000 || year+1911 < 1900) {
	    	column.style.backgroundColor="red";
            return name + "\u5e74\u4efd\u4e0d\u7b26!\n";
        } else if(month > 12 || month < 1) {
	    	column.style.backgroundColor="red";
            return name + "\u6708\u4efd\u4e0d\u7b26!\n";
        } else{
        	column.style.backgroundColor="white";
        }
        column.value=year+'/'+month;
        return "";
}
//\u6aa2\u67e5\u9577\u5ea6\u8d85\u904e\u9650\u5236-\u4f7f\u7528CheckLen()
function GetLength (s){
   var strlen = s.length ;
   var c = '' ;
   var i ;
   var j = 0 ;

   if (strlen > 0) {
      for (i = 0, j = 0; i < strlen; i++) {
         c = escape(s.charAt(i)) ;
         if (c.charAt(0) == '%') {
            if (c.length == 3) j++ ;
            else               j += 2 ;
         }
         else j++ ;
      }
      return j;
   }
   else return 0 ;
}

function CheckLen(column, maxlen,name){
   var strlen = 0 ;
   strlen = GetLength (column.value) ;
   if (strlen > maxlen*2) {
      //alert ("\u5099\u8a3b\uff1a\u9577\u5ea6\u8d85\u904e\u9650\u5236,\u8acb\u522a\u6e1b\u5b57\u6578.(\u9650"+maxlen+"\u500b\u4e2d\u6587\u5b57,\u6216"+maxlen*2+"\u500b\u82f1\u6587\u5b57\u6bcd)") ;
      column.select() ;
      column.focus() ;
      return name + "\u9577\u5ea6\u8d85\u904e\u9650\u5236,\u8acb\u522a\u6e1b\u5b57\u6578.\n(\u9650"+maxlen+"\u500b\u4e2d\u6587\u5b57,\u6216"+maxlen*2+"\u500b\u82f1\u6587\u5b57\u6bcd)";
   }
   return "" ;
}


/***Added By SuperSoft 2003-3-26***/
//\u6821\u9a57\u662f\u6574\u6578\u6216\u6d6e\u9ede\u6578
function isIntFloat(str){
  var result=true;
  
  var reg1=/^(\d+).(\d{1,3})$/;
  var reg2=/^(\d+)$/;
 
  if ((!reg1.test(str))&&(!reg2.test(str))){
    result=false;
    return result;
  }
    
  return result;
}

//\u6821\u9a57\u662f\u5426\u70ba\u6574\u6578
function isInt(str){
  var result=true;
    
  var reg=/^(\d+)$/;
  if (!reg.test(str)){
    result=false;
    return result;
  }
    
  return result;
}

//\u6821\u9a57\u662f\u5426\u70ba\u96f6
function isZero(strInt){
  var result=true;
  
  for(var i=0; i<strInt.length; i++){
    if (strInt.charAt(i)!='0'){
      if(strInt.charAt(i)!='.'){
        result=false;
        break;
      }
    }
  }
  return result;
}




//\u6aa2\u67e5\u662f\u5426\u70baInteger\u6216Float
function isIntFloat(str){
  var result=true;
  
  var reg1=/^(\d+).(\d{1,3})$/;
  var reg2=/^(\d+)$/;
 
  if ((!reg1.test(str))&&(!reg2.test(str))){
    result=false;
    return result;
  }
    
  return result;
}

//\u6aa2\u67e5\u662f\u5426\u70baInteger
function isInt(str){
  var result=true;
    
  var reg=/^(\d+)$/;
  if (!reg.test(str)){
    result=false;
    return result;
  }
    
  return result;
}

//\u6aa2\u67e5\u662f\u5426\u70ba0
function isZero(strInt){
  var result=true;
  
  for(var i=0; i<strInt.length; i++){
    if (strInt.charAt(i)!='0'){
      if(strInt.charAt(i)!='.'){
        result=false;
        break;
      }
    }
  }
  return result;
}

//\u6aa2\u67e5\u662f\u5426\u70ba\u7a7a\u767d\uff0c\u5982\u679c\u6b63\u786e\uff0c\u5247\u6062\u590d\u6b63\u5e38\u7684backgroundColor
function checkEmptyWithBG(column, bgcolor){
	columnTrim( column );
	if( column.value.length == 0 ){
		column.style.backgroundColor="red";
		column.focus();
		return "\u4e0d\u53ef\u4ee5\u7a7a\u767d!\n";
	}else{
		if (column.readOnly)
		  column.style.backgroundColor= bgcolor;
		else
		  column.style.backgroundColor= "white";
		return "";
	}
}

//\u6aa2\u67e5\u5217\u8868\u4e2d\u591a\u5217\u6578\u636e\u7684\u5408\u6cd5\u6027

function check_all_qty(order, recvd, bgcolor1, bgcolor2, alertmsg){
  var msg = "", msg1 = "";
  
  for(var i=0; i<order.length; i++){
  	msg1 = check_qty(order[i], recvd[i], bgcolor1, bgcolor2, alertmsg);
  	if (msg1 != "")
  	  msg = msg1;
  }
  
  return msg;
}

//\u6bd4\u8f03\u5169\u500b\u6578\u636e\u7684\u5927\u5c0f
function check_qty(order, recvd, bgcolor1, bgcolor2, alertmsg){

  columnTrim( order );
  columnTrim( recvd );
  
  if ((order.value.length == 0) || (recvd.value.length == 0)){
    return "";
  }
  
  if (parseFloat(order.value) < parseFloat(recvd.value)){
    
    order.style.backgroundColor="red";
    recvd.style.backgroundColor="red";
    return alertmsg;
    
  }
  else{
  	order.style.backgroundColor = bgcolor1;
  	recvd.style.backgroundColor = bgcolor2;
    return "";
  }
}

//\u6aa2\u67e5supply_cd_h\u662f\u5426\u70ba\u7a7a\uff0c\u6216\u8005\u70ba'S'
function check_supply(supply, bgcolor, alertmsg){
  var msg="";
  
  msg = checkEmpty(supply, "");
  if ((msg != "") || (supply.value == "S")){
    supply.style.backgroundColor="red";
    return alertmsg;
  }
  
  supply.style.backgroundColor=bgcolor;
  return "";
}

//\u6aa2\u67e5\u5217\u8868\u4e2d\u591a\u5217\u7684supply_cd_f\u5408\u6cd5\u6027

function check_all_supply(supply, bgcolor, alertmsg){
  var msg = "", msg1="";
  
  for(var i=0; i<supply.length; i++){
    msg1 = check_supply(supply[i], bgcolor, alertmsg);
    if (msg1 != "")
  	  msg = msg1;
  }
  return msg;
}

function compareDate(sTime1,sTime2,bgcolor,alertmsg){
	t1 = Date.parse(sTime1.value);
	t2 = Date.parse(sTime2.value);
	if ((t1-t2)>0){
	  sTime1.style.backgroundColor="red";
	  sTime2.style.backgroundColor="red";
	  return alertmsg;
	}else{
	  if (sTime1.readOnly)
		sTime1.style.backgroundColor=bgcolor;
      else
        sTime1.style.backgroundColor="white";
      if (sTime2.readOnly)  
	    sTime2.style.backgroundColor=bgcolor;
	  else
	    sTime2.style.backgroundColor="white";
	  return "";
	}
}







//\u4ee5\u4e0b\u70ba\u53c3\u8003\u7528\uff0c\u5c1a\u672a\u6574\u7406
/*
function checkEmail(emailObj){
	columnTrim(emailObj);
	var email = emailObj.value;
	var len = email.length;
	if( len == 0 )
		return "\u96fb\u5b50\u90f5\u4ef6\u4fe1\u7bb1\u4e0d\u53ef\u4ee5\u7a7a\u767d!\n";
	for(var i=0;i<len;i++){
		var c= email.charAt(i);
		if(!((c>="A"&&c<="Z")||(c>="a"&&c<="z")||(c>="0"&&c<="9")||(c=="-")||(c=="_")||(c==".")||(c=="@")))
			return "\u96fb\u5b50\u90f5\u4ef6\u5730\u5740\u53ea\u80fd\u662f\u6578\u5b57,\u82f1\u6587\u5b57\u6bcd\u53ca'-','_'\u7b49\u7b26\u865f,\u5176\u4ed6\u7684\u7b26\u865f\u90fd\u4e0d\u80fd\u4f7f\u7528!\n";
   }
   if((email.indexOf("@")==-1)||(email.indexOf("@")==0)||(email.indexOf("@")==(len-1)))
	  return "\u60a8\u7684\u96fb\u5b50\u90f5\u4ef6\u5730\u5740\u4e0d\u6b63\u78ba!\n";
   if((email.indexOf("@")!=-1)&&(email.substring(email.indexOf("@")+1,len).indexOf("@")!=-1))
	  return "\u60a8\u7684\u96fb\u5b50\u90f5\u4ef6\u5730\u5740\u4e0d\u6b63\u78ba!\n";
   if((email.indexOf(".")==-1)||(email.indexOf(".")==0)||(email.lastIndexOf(".")==(len-1)))
	  return "\u60a8\u7684\u96fb\u5b50\u90f5\u4ef6\u5730\u5740\u4e0d\u5b8c\u5168!\n";
   return "";
}

function checkIdcard(idcardObj,msg){
	columnTrim(idcardObj);
	var idcard = idcardObj.value;
	var error = false;
	//if( idcard.length <= 0 )
		//return msg+"\u4e0d\u53ef\u4ee5\u7a7a\u767d!\n";
	if( idcard.length > 0 )	{
 str="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 val="1011121314151617341819202122352324252627282932303133";
 first=str.indexOf(idcard.substr(0,1).toUpperCase());
 if (first==-1) {
 	return msg+"\u586b\u5beb\u4e0d\u6b63\u78ba\uff01\n";
 }
 for (i=2; i < 9; i++) {
  if (idcard.substr(i,1) >= "0" && idcard.substr(i,1) <= "9") continue;
		return msg+"\u586b\u5beb\u4e0d\u6b63\u78ba\uff01\n";
 }
 str1=val.substr(first*2,2);
 v1=parseInt(str1.substr(0,1));
 v2=parseInt(str1)%10;
 total=v1+v2*9+parseInt(idcard.substr(1,1))*8+parseInt(idcard.substr(2,1))*7+parseInt(idcard.substr(3,1))*6;
 total=total+parseInt(idcard.substr(4,1))*5+parseInt(idcard.substr(5,1))*4+parseInt(idcard.substr(6,1))*3;
 total=total+parseInt(idcard.substr(7,1))*2+parseInt(idcard.substr(8,1))+parseInt(idcard.substr(9,1));
 if ((total%10)!=0) {
     return msg+"\u586b\u5beb\u4e0d\u6b63\u78ba\uff01\n";
}
if(form1.accountid.value==idcard){
	return msg+"\u8207\u5e33\u865f\u4e0d\u53ef\u76f8\u540c\uff01\n";
}
}
	return "";
}

function checkTel(telObj,msg){
	columnTrim(telObj);
	var tel = telObj.value;
	var error = false;
	if( tel.length <= 0 )
		return msg+"\u4e0d\u53ef\u4ee5\u7a7a\u767d!\n";
	for( i = 0 ; i < tel.length ; i++ ) {
		if( !( ( tel.charAt(i) >= '0' && tel.charAt(i) <= '9' ) ) ) {
			error = true;
			break;
		}
	}
	if( error == true )
		return msg+"\u53ea\u80fd\u662f\u6578\u5b57,\u5176\u4ed6\u7684\u7b26\u865f\u90fd\u4e0d\u80fd\u4f7f\u7528!\n";
	return "";
}
function checkAccountId(accountIdObj){
	columnTrim(accountIdObj);
	var accountId = accountIdObj.value;
	if( accountId.length <= 0 )
		return("\u5e33\u865f\u4e0d\u53ef\u4ee5\u7a7a\u767d!\n");
	if( accountId.length > 10 )
		return("\u5e33\u865f\u9577\u5ea6\u8d85\u904e\u4e86\u5341\u500b\u5b57\u5143\u7684\u9650\u5236!\n");
	for( i = 0 ; i < accountId.length ; i++ ){
		if( accountId.charAt(i) >= 'A' && accountId.charAt(i) <= 'Z' )
			return "\u5e33\u865f\u4e0d\u53ef\u4ee5\u542b\u6709\u5927\u5beb\u5b57\u5143 !\n";
		if( !( ( accountId.charAt(i) >= 'a' && accountId.charAt(i) <= 'z' ) || ( accountId.charAt(i) >= '0' && accountId.charAt(i) <= '9' ) || ( accountId.charAt(i) == '_' ) || ( accountId.charAt(i) == '.' ) || ( accountId.charAt(i) == '-' ) ) )
			return "\u5e33\u865f\u53ea\u80fd\u662f\u6578\u5b57,\u82f1\u6587\u5b57\u6bcd\u53ca\u300c_\u300d\u300c-\u300d\u300c.\u300d\u7b49\u7b26\u865f,\u5176\u4ed6\u7684\u7b26\u865f\u90fd\u4e0d\u80fd\u4f7f\u7528 !\n";
	}
	return "";
}
function checkPasswd(passwd, passwd1){
	if( passwd == '')
		return ("\u5bc6\u78bc\u4e0d\u53ef\u4ee5\u7a7a\u767d !\n");
	for( var i = 0 ; i < passwd.length ; i++ )
		if( passwd.charAt(i) == ' ' || passwd.charAt(i) == '\'' || passwd.charAt(i) == '\"')
			return ("\u5bc6\u78bc\u4e0d\u53ef\u4ee5\u542b\u6709\u7a7a\u767d\u6216\u55ae\u96d9\u5f15\u865f !\n");
		if( passwd.length > 10)
			return ("\u5bc6\u78bc\u6700\u591a\u53ea\u80fd\u8f38\u516510\u500b\u5b57 !\n");
		if( passwd != passwd1 )
			return("\u5bc6\u78bc\u5fc5\u9808\u8207\u78ba\u8a8d\u5bc6\u78bc\u76f8\u540c,\u8acb\u91cd\u65b0\u8f38\u5165!\n");
		return "";
}
function checkSelect(select,msg){
	if( select.options[0].selected == true )
		return msg + "\u5fc5\u9808\u9078\u64c7 !\n";
	return "";
}
function checkBirthdayYear(yearObj){
	columnTrim(yearObj);
	var year = yearObj.value;
	var error = false;
	if( year.length != 4 )
		return ("\u751f\u65e5\u5e74\u4efd\u5fc5\u9808\u662f\u897f\u5143\u5e74, \u4f8b\u5982 1974 \u5e74!\n");
	for( i = 0 ; i < year.length ; i++ ) {
		if( !( year.charAt(i) >= '0' && year.charAt(i) <= '9' ) ) {
			error = true;
			break;
		}
	}
	if( error == true )
		return ("\u751f\u65e5\u5e74\u4efd\u5fc5\u9808\u662f\u897f\u5143\u5e74, \u4f8b\u5982 1974 \u5e74!\n");
	return "";
}
// \u5148\u5c07\u6b04\u4f4d\u53bb\u982d\u5c3e\u7a7a\u767d \u7136\u5f8c \u6aa2\u67e5\u6578\u5b57\u6b04\u4f4d\u662f\u5426\u8f38\u5165\u6578\u5b57&\u6709\u7121\u8d85\u904e\u6574\u6578
// &\u5c0f\u6578\u4f4d\u6578 , \u6709\u932f\u8aa4\u8005\u6703\u52a0 \u53cd\u7d05
// \u8f38\u5165 ( InputBox\u6b04\u4f4d\u5168\u540d,\u6574\u6578\u4f4d\u6578,\u5c0f\u6578\u4f4d\u6578 ) \u56de\u50b3\u662f\u5426\u70ba\u6574\u6578 boolean
function checkDateMark( column ){
	columnTrim( column );
	var S = column.value ;
        var Array1=new Array(12);
        var Array2=new Array(3);
        Array1[0]="1";
        Array1[1]="2";
        Array1[2]="3";
        Array1[3]="4";
        Array1[4]="6";
        Array1[5]="5";
        Array1[6]="7";
        Array1[7]="8";
        Array1[8]="9";
        Array1[9]="A";
        Array1[10]="B";
        Array1[11]="C";
        Array2[0]="B";
        Array2[1]="M";
        Array2[2]="E";
        for (var i=0;i<12;i++){
	     for(var j=0;j<3;j++){
 	         if(S.substring(0,1)==Array1[i]&&S.substring(1,2)==Array2[j]) return true;
  	     }
	}
	return false ;
}
//\u6aa2\u67e5\u65e5\u671f
function checkDateAndShowRed(column,name) {
	columnTrim( column );
	var S = column.value ;
 	if( column.value.length == 0 ){
	    column.style.backgroundColor="red";
	    return name + "\u4e0d\u53ef\u4ee5\u7a7a\u767d!\n";
	}
 	var checkValue=chDateFmt(S);
	if (isNaN(checkValue))  {
        column.style.backgroundColor="red";
	    return name + "\u5fc5\u9808\u70ba\u6578\u5b57(\u65e5\u671f)\u683c\u5f0f!\n";
    }else if (this.chDate(checkValue)!="") {
        switch (parseInt(this.chDate(checkValue))) {
            case 0:
                column.style.backgroundColor="red";
                return name + "\u65e5\u671f\u683c\u5f0f\u5fc5\u9808\u70ba 7 \u78bc \u6216 8 \u78bc!\n";
            case 1:
                column.style.backgroundColor="red";
                return name + "\u65e5\u671f\u683c\u5f0f\u6708\u4efd\u6709\u8aa4!\n";
            case 2:
                column.style.backgroundColor="red";
                return name + "\u65e5\u671f\u683c\u5f0f\u65e5\u5b50\u6709\u8aa4!\n";
            case 3:
                column.style.backgroundColor="red";
                return name + "\u65e5\u671f\u683c\u5f0f\u5fc5\u9808\u70ba\u6578\u5b57!\n";
        }
	}
    return "";
}
// \u7531 yyy/mm/dd , yyyy/mm/dd, yyy-mm-dd, yyyy-mm-dd \u8f49\u63db\u65e5\u671f\u683c\u5f0f\u81f3  yyyymmdd, yyymmdd
function chDateFmt(str) {
	var s=str.split("/");
	if (s.length==1)
		s=str.split("-");
	var generalDate="";
	for (var i=0;i<s.length;i++) {
		generalDate+=s[i];
	}
	return generalDate;
}
function chDate(str) {
	var len=str.length;
	var yy=str.substring(0,len-4);
	if (len<7||len>8)
		return "0";
		if (str.substr(len-4,2).substr(0,1)=="0")
		var mm=parseInt(str.substr(len-3,1));
	else
		var mm=parseInt(str.substr(len-4,2));
	if (str.substr(len-2,2).substr(0,1)=="0")
		var dd=parseInt(str.substr(len-1,1));
	else
		var dd=parseInt(str.substr(len-2,2));
	if (isChar(str.substr(len-4,2))||isChar(str.substr(len-2,2)||isChar(yy))  )
		return "3";
	if (mm>12)
		return "1";
	else {
		switch (mm) {
			case 1:case 3:case 5:case 7:case 8:case 10:case 12:
				if (dd>31)    return "2";
				else		  return "";
				break;
			case 4:case 6:case 9:case 11:
				if (dd>30)    return "2";
				else		  return "";
				break;
			case 2:
				if (dd>29)	return "2";
				else if (dd==29)    {
					if (isReun(yy))
						return "";
					else
						return "2";
				}
				else		  return "";
				break;
			default:
				return "3";
		}
	}
}
*/

