/**
 * 注册事件
 */
function checkRegister() {
	if (this.isNotNull('username') && this.isNotNull('password')) {
		// 用户注册
		document.getElementById('myForm').submit();
	} else {
		if (!this.isNotNull('username')) {
			this.checkNull('username');
		}
		if (!this.isNotNull('password')) {
			this.checkNull('password');
		}
	}
}
/**
 * 登陆事件
 */
function checkLogin() {
	if (this.isNotNull('username') && this.isNotNull('password')) {
		// 用户注册
		document.getElementById('myForm').submit();
	} else {
		if (!this.isNotNull('username')) {
			this.checkNull('username');
		}
		if (!this.isNotNull('password')) {
			this.checkNull('password');
		}
	}
}
/**
 * 检查控件是否为空事件
 */
function checkNull(id) {
	var element = document.getElementById(id);
	if (element.value != null && element.value != "") {
		// 失去焦点
	} else {
		alert(element.title + "必须填写!");
		element.focus();
	}
}
/**
 * 判断控件的值是否不为空
 * 
 * @param {}id
 */
function isNotNull(id) {
	var element = document.getElementById(id);
	if (element.value != null && element.value != "") {
		return true;
	} else {
		return false;
	}
}
/**
 * @description:函数：获取浏览器可用页面的尺寸
 * @return {}浏览器的宽和高
 */
function findDimensions() {
	var winWidth = 0;
	var winHeight = 0;
	// 获取窗口宽度
	if (window.innerWidth)
		winWidth = window.innerWidth;
	else if ((document.body) && (document.body.clientWidth))
		winWidth = document.body.clientWidth;
	// 获取窗口高度
	if (window.innerHeight)
		winHeight = window.innerHeight;
	else if ((document.body) && (document.body.clientHeight))
		winHeight = document.body.clientHeight;
	// 通过深入Document内部对body进行检测，获取窗口大小
	if (document.documentElement && document.documentElement.clientHeight
			&& document.documentElement.clientWidth) {
		winHeight = document.documentElement.clientHeight;
		winWidth = document.documentElement.clientWidth;
	}
	// 结果输出至两个文本框
	// alert("浏览器窗口 的 实际高度:" + winHeight + ",浏览器窗口 的 实际宽度:" + winWidth);
	// 把值存入数组中
	var win = {
		winWidth : winWidth,
		winHeight : winHeight
	};
	return win;
}
