function reloadVImg() {
	var v = $("vimage");
	v.src = "/code.jpg" + "?date" + new Date();
}
function userComeOn() {
	var command = new Command("UserComeOnCmd");
	command.setCallback(function () {
	 reloadVImg();
	});
	command.execute();
}
function userLogin() {
	clearMsg();
	var command;
	command = new Command("UserLoginCmd");
	command.setParameters("loginForm");
	command.setCallback(loginBack);
	//command.setForword("/home/index.html",window.parent);
	command.setError(loginError);
	command.execute();
}
function clearMsg() {
	DWRUtil.setValue("userMsg", "");
	DWRUtil.setValue("vcodeMsg", "");
	DWRUtil.setValue("loginMsg", "");
}
function loginBack(d) {
	var code = d ? d.id : null;
	if (code == "3") {
		openWin("http://www.clickeye.com.cn/notice/notice_01.html", 292, 179);
	} else {
		if (code == "4") {
			openWin("http://www.clickeye.com.cn/notice/notice_02.html", 292, 107);
		} else {
			window.parent.location = "/home/index.html";
		}
	}
}
function loginError(errors) {
	for (var p in errors) {
		if (p == "vcodeMsg") {
			alert(errors[p]);
			reloadVImg();
		} else {
			alert(errors[p]);
		}
	}
	DWRUtil.setValues("user", {userId:"", userPass:"", vcode:""});
}
function openWin(url, w, h) {
	var w = window.open(url, "newwin", "height=" + h + ", width=" + w + ", top=50,left=200, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no");
	w.focus();
}

