// JavaScript Document
String.prototype.trim = function () {
	return this.replace(/^\s+|\s+$/img, "");
};
function DrawImage(ImgD, iwidth, iheight) {
	var image = new Image();
	image.src = ImgD.src;
	if (image.width > 0 && image.height > 0) {
		flag = true;
		if (image.width / image.height >= iwidth / iheight) {
			if (image.width > iwidth) {
				ImgD.width = iwidth;
				ImgD.height = (image.height * iwidth) / image.width;
			} else {
				ImgD.width = image.width;
				ImgD.height = image.height;
			}
		} else {
			if (image.height > iheight) {
				ImgD.height = iheight;
				ImgD.width = (image.width * iheight) / image.height;
			} else {
				ImgD.width = image.width;
				ImgD.height = image.height;
			}
		}
	}
}
function checkLogin(form) {
	if (form.username.value.trim() == "") {
		window.alert("请输入用户名！");
		form.username.focus();
		return false;
	}
	if (form.password.value.trim() == "") {
		window.alert("请输入密码");
		form.password.focus();
		return false;
	}
	if (form.vCode.value.trim() == "") {
		window.alert("请输入验证码");
		form.vCode.focus();
		return false;
	}
	return true;
}
function quit() {
		window.location.href='http://www.21food.cn/member/quit.jsp';
}

function f_switch_view() {
	var ids = f_switch_view.arguments;
	if (ids.length < 1) {
		return;
	}
	var objToView = document.getElementById(ids[0]);
	var objToHide;
	if (objToView) {
		objToView.style.display = "";
	}
	for (i = 1; i < ids.length; i++) {
		objToHide = document.getElementById(ids[i]);
		if (objToHide) {
			objToHide.style.display = "NONE";
		}
	}
}
function chkimg(id) {
	var img = document.getElementById(id);
	if (!img) {
		return;
	}
	var src = img.src;
	var i = src.indexOf("?");
	if (i >= 0) {
		src = src.substring(0, i);
	}
	src = src + "?" + (new Date()).getTime();
	img.src = src;
}

