	function MouseOverBg(obj) {
		obj.style.backgroundColor='#FFFF66';
		obj.style.cursor='pointer';
	}
	function MouseOutBg(obj,c_color) {
		if (c_color==null) {
			c_color="#FFFFFF";
		}
		obj.style.backgroundColor=c_color;
	}
	function ChinaCountry(val) {
		if (val=="CN") {
			document.getElementById('p1').style.display="none";
			document.getElementById('p2').style.display="";
			document.getElementById('province_a').disabled=false;
			document.getElementById('province').disabled=true;
			document.getElementById('province').id="province_b";
			document.getElementById('province_a').className="man";
			document.getElementById('province_a').id="province";
			document.getElementById('province_b').className="";
		} else {
			document.getElementById('p2').style.display="none";
			document.getElementById('p1').style.display="";
			document.getElementById('province_b').disabled=false;
			document.getElementById('province').disabled=true;
			document.getElementById('province').id="province_a";
			document.getElementById('province_b').className="man";
			document.getElementById('province_b').id="province";
			document.getElementById('province_a').className="";
		}
	}
	
	function LTrim( value ) {
		
		var re = /\s*((\S+\s*)*)/;
		return value.replace(re, "$1");
		
	}

	// Removes ending whitespaces
	function RTrim( value ) {
		
		var re = /((\s*\S+)*)\s*/;
		return value.replace(re, "$1");
		
	}
	
	// Removes leading and ending whitespaces
	function trim( value ) {
		
		return LTrim(RTrim(value));
		
	}
	
		/*-------Change the Type-------*/
	function changeMenu(menu) {
		document.menu_form.DBType.value = menu;
		if (menu=="Payment") {
			document.menu_form.DBAction.value = "View_Order";
		} else if (menu=="Management") {
			document.menu_form.DBAction.value = "Report";
		} else {
			document.menu_form.DBAction.value = "View";
		}
		document.menu_form.sqlView.value="";
		document.menu_form.sort.value="";
		document.menu_form.pos.value = 0;
		document.menu_form.submit();
	}
	
	/*-------Change the DBAction-------*/
	function changeActionMenu(menu) {
		document.menu_form.DBAction.value = menu;
		if (menu=="View")
			document.menu_form.pos.value = 0;
		document.menu_form.submit();
	}
	function changeActionMenuAdmin(menu) {
		document.menu_form.DBAction.value = menu;
		if (menu=="View") {
			document.menu_form.pos.value = 0;
			document.menu_form.sqlView.value="";
			document.menu_form.sort.value="";
		}
		document.menu_form.submit();
	}
	
	/*-------Check All checkbox-------*/
	function CheckAll(fmobj, all_box) {
		for (var i=0;i<fmobj.elements.length;i++) {
			var e = fmobj.elements[i];
		  if ((e.name != all_box.name) && (e.type=='checkbox') && (!e.disabled)) {
		  	e.checked = all_box.checked;
		  }
		}
	}

	/*-------To Edit or Delete a specific record-------*/
	function submitAction(DBaction, record, DBType, lang) {
		if (lang==null) {
			lang="en";
		}

		switch (DBaction) {
			case "View_Single":
				document.menu_form.DBAction.value = "View_Single";
				document.menu_form.DBType.value = DBType;
				document.menu_form.record.value = record;
				document.menu_form.submit();
				break;
			case "Back":
				document.menu_form.DBAction.value = "View";
				document.menu_form.DBType.value = DBType;
				document.menu_form.record.value = record;
				document.menu_form.submit();
				break;
			case "Edit":
				if (lang=="sch") {
					msg="确定更改本资料？";
				} else {
					msg="Are you going to Modify this Record?";
				}
				question = confirm(msg);
				if (question !="0") {
					document.menu_form.DBAction.value = "Edit";
					document.menu_form.record.value = record;
					document.menu_form.DBType.value = DBType;
					document.menu_form.submit();
				} else {
					return false;
				}
				break;
			case "Delete":
				if (lang=="sch") {
					msg="确定删除 '" + record + "' 资料？";
				} else {
					msg="Are you sure to Delete Record '" + record + "'?";
				}
				question = confirm(msg);
				if (question !="0") {
					document.menu_form.DBAction.value = "Delete";
					document.menu_form.record.value = record;
					document.menu_form.DBType.value = DBType;
					document.menu_form.submit();
				} else {
					return false;
				}
				break;
			case "password":
				if (lang=="sch") {
					msg1 = "发送电邮到此用户？";
					msg2 = "电邮发送完毕！";
				} else {
					msg1 = "Send email to this user?";
					msg2 = "Email sent!";
				}
				question = confirm(msg1);
				if (question !="0") {
					document.menu_form.DBAction.value = "password";
					document.menu_form.record.value = record;
					document.menu_form.DBType.value = DBType;
					alert(msg2);
					document.menu_form.submit();
				} else {
					return false;
				}
				break;
			case "confirmation":
				if (lang=="sch") {
					msg1 = "发送电邮到此用户？";
					msg2 = "电邮发送完毕！";
				} else {
					msg1 = "Send email to this user?";
					msg2 = "Email sent!";
				}
				question = confirm(msg1);
				if (question !="0") {
					document.menu_form.DBAction.value = "confirmation";
					document.menu_form.record.value = record;
					document.menu_form.DBType.value = DBType;
					alert(msg2);
					document.menu_form.submit();
				} else {
					return false;
				}
				break;
			case "visitor":
				if (lang=="sch") {
					msg1 = "发送电邮到此用户？";
					msg2 = "电邮发送完毕！";
				} else {
					msg1 = "Send email to this user?";
					msg2 = "Email sent!";
				}
				question = confirm(msg1);
				if (question !="0") {
					document.menu_form.DBAction.value = "visitor";
					document.menu_form.record.value = record;
					document.menu_form.DBType.value = DBType;
					alert(msg2);
					document.menu_form.submit();
				} else {
					return false;
				}
				break;
		}
	}
	
		function AcceptCompulsory(fmobj,lang) {
		var rtnBoolean = false;
		for (var i=0;i<fmobj.elements.length;i++) {
			var e = fmobj.elements[i];
			if (e.type=='checkbox') {
				if (e.checked) {
			  	rtnBoolean = true;
			  }
			}
		}
		if (lang=="en") {
				msg1 = "Send email to the selected records?";
				msg2 = "Email sent!";
				msg3 = "Please check at least one checkbox";
			} else {
				msg1 = "发送电邮到已选用户？";
				msg2 = "电邮发送完毕！";
				msg3 = "请选择最少一个用户！";
			}
		if (rtnBoolean) {
			question = confirm(msg1);
			if (question !="0") {
				alert(msg2);
				return true;
			} else {
				return false;
			}
		} else {
			alert(msg3);
			return false;
		}
	}
	
	function changePage(pos_page, sqlView, DBType) {
		document.menu_form.pos.value = pos_page;
		document.menu_form.sqlView.value = sqlView;
		document.menu_form.DBType.value = DBType;
		document.menu_form.submit();
	}
	