
/**
 * @author Allen
 */
function onlyNum() {
		//alert(event.keyCode);
	if (!((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 96 && event.keyCode <= 105) || (event.keyCode == 8))) {
		event.returnValue = false;
	}
}
function trim(str) {
	return str.replace(/^\s*|\s*$/g, "");
}
function isEmpty(str) {
	return str == null || str.length == 0;
}
function isEmail(str) {
	var reg = /(\S)+[@]{1}(\S)+[.]{1}(\w)+/;
	return reg.test(str);
}
function submitForm(action, trace_id) {
	document.getElementById("action").value = action;
	document.getElementById("trace_id").value = trace_id;
	document.forms[0].submit();
}
function doCheck(object) {
	var arrCHK = document.getElementsByName("roomRateChk");
	if (arrCHK.length == self.undefined) {
		return;
	} else {
		for (var i = 0, len = arrCHK.length; i < len; i++) {
			if (object.checked) {
				arrCHK[i].checked = true;
			} else {
				arrCHK[i].checked = false;
			}
		}
	}
}
function getCheckBoxValue() {
	var arrCHK = document.getElementsByName("roomRateChk");
	if (arrCHK.length == self.undefined) {
		return arrCHK.checked ? [arrCHK.value] : new Array();
	} else {
		var a = new Array();
		var num = 0;
		for (var i = 0; i < arrCHK.length; i++) {
			if (arrCHK[i].checked) {
				a[num] = arrCHK[i].value;
				num++;
			}
		}
		return a.join("-");
	}
}
function deleteByIds() {
	var ids = getCheckBoxValue();
	if (ids.length == 0) {
		alert("Have no selected!");
		return;
	}
	if (confirm("Are you sure delete?")) {
		var form = document.forms[0];
		document.getElementById("action").value = 5;
		document.getElementById("ids").value = ids;
		form.submit();
	} else {
		return;
	}
}
function updatePicture(afid) {
	showModalDialog("popUpdatePicture.jsp?trace_id=" + afid, "upload", "dialogWidth:400px;dialogHeight:300px;dialogLeft:400px;dialogTop:200px;center:yes;help:no;resizable:no;status:yes");
}
function getStrLen(str){
	var len = 0;
	var cnstrCount = 0; 
	for(var i = 0 ; i < str.length ; i++){
	  if(str.charCodeAt(i) > 255)
	   cnstrCount = cnstrCount + 1 ;
	}
	len = str.length + cnstrCount;
	return len;
}

