
function calclength(s) {
	var count = 0;
	for (var i = 0; i < s.length; i++) {
		if (s.charAt(i) >= " " && s.charAt(i) < "~") {
			count++;
		} else {
			count = count + 2;
		}
	}
	return count;
}
function subs(s, len) {
	var count = 0;
	for (var i = 0; i < s.length; i++) {
		if (s.charAt(i) >= " " && s.charAt(i) < "~") {
			count++;
			if (count == len) {
				return s.substring(0, i);
			}
		} else {
			if (count >= len - 1) {
				return s.substring(0, i - 1);
			}
			count = count + 2;
		}
	}
	return s;
}
function calcword() {
	len = calclength(jubaoForm.tareaSummary.value);
	lblSummaryNum.innerHTML = 8000 - len;
}
function setSummaryNum() {
	calcword();
	if (calclength(jubaoForm.tareaSummary.value) > 8000) {
		alert("\u6b63\u6587\u8d85\u957f!");
		jubaoForm.tareaSummary.value = subs(jubaoForm.tareaSummary.value, 8000);
		lblSummaryNum.innerHTML = "0";
		return false;
	}
	return true;
}
function commitForm(myform) {
	if (myform.rand.value == "") {
		alert("\u8ba4\u8bc1\u7801\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u8bf7\u91cd\u65b0\u586b\u5199\uff01");
		myform.rand.focus();
		return false;
	}
	if (myform.tbxDockName.value == "") {
		alert("\u88ab\u4e3e\u62a5\u4eba\u7684\u59d3\u540d\u6216\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u8bf7\u91cd\u65b0\u586b\u5199\uff01");
		myform.tbxDockName.focus();
		return false;
	}
	var dockName = myform.tbxDockName.value;
	for (i = 0; i < dockName.length; i++) {
		if ((dockName.charAt(i) > " " && dockName.charAt(i) < ".") || (dockName.charAt(i) >= ":" && dockName.charAt(i) < "A") || (dockName.charAt(i) >= "[" && dockName.charAt(i) < "a") || (dockName.charAt(i) >= "{" && dockName.charAt(i) < "~")) {
			alert("\u88ab\u4e3e\u62a5\u4eba\u7684\u59d3\u540d\u6216\u88ab\u4e3e\u62a5\u7684\u5355\u4f4d\u540d\u79f0\u8bf7\u586b\u5199\u6c49\u5b57\uff01");
			myform.tbxDockName.focus();
			return false;
		}
	}
	if (myform.lbxDockLevel.value == "") {
		alert("\u88ab\u4e3e\u62a5\u4eba\u7ea7\u522b\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u8bf7\u91cd\u65b0\u586b\u5199\uff01");
		myform.lbxDockLevel.focus();
		return false;
	}
	if (myform.zone2.value == "") {
		alert("\u88ab\u4e3e\u62a5\u4eba\u6240\u5c5e\u5730\u533a\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u8bf7\u91cd\u65b0\u586b\u5199\uff01");
		myform.zone2.focus();
		return false;
	}
	if (myform.tbxDockAddr.value == "") {
		alert("\u88ab\u4e3e\u62a5\u4eba\u5355\u4f4d\u540d\u79f0\u6216\u5730\u5740\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u8bf7\u91cd\u65b0\u586b\u5199\uff01");
		myform.tbxDockAddr.focus();
		return false;
	}
	if (myform.lbxQuestionType.value == "") {
		alert("\u95ee\u9898\u7c7b\u522b\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u8bf7\u91cd\u65b0\u586b\u5199");
		myform.lbxQuestionType.focus();
		return false;
	}
	if (myform.tareaSummary.value == "") {
		alert("\u4e3b\u8981\u95ee\u9898\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u8bf7\u91cd\u65b0\u586b\u5199\uff01");
		myform.tareaSummary.focus();
		return false;
	} else {
		if (myform.tareaSummary.value.length > 8000) {
			alert("\u4e3b\u8981\u95ee\u9898\u7684\u5b57\u6570\u4e0d\u80fd\u591a\u4e8e8000\u4e2a\u5b57");
			return false;
		}
	}
	return true;
}
function checkSearch(myform) {
	if (myform.SearchPwd.value == "") {
		alert("\u8bf7\u8f93\u5165\u67e5\u8be2\u5bc6\u7801");
		myform.SearchPwd.focus();
		return false;
	}
	if (myform.rand.value == "") {
		alert("\u8bf7\u8f93\u5165\u8ba4\u8bc1\u7801");
		myform.rand.focus();
		return false;
	}
}


