// JavaScript Document



// 计算窗口中心位置
// @param w 窗口的宽度
// @param h 窗口的高度
// @return local 窗口坐标数组
function getWindowCenter(w, h) {
	var local = new Array(2);
	local[0] = (screen.availWidth - w - 10) / 2;
	local[1] = (screen.availHeight - h - 30) / 2;
	return local;
}

// 弹出窗口
// @param url 文件地址
// @param name 窗口名称
// @param w 窗口宽度
// @param h 窗口高度
function popUpWindow(url, name, w, h) {
	var local = getWindowCenter(w, h);
	var featrue = "width=" + w + ",height=" + h + ",left=" + local[0] + ",top=" + local[1] + ",scrollbars=yes,resizable=yes";
	window.open(url, name, featrue);
}

function menuSwitch() {
	if (document.all["MenuFrame"].style.display == "none") {
		document.all["MenuFrame"].style.display = "block";
		document.all["MenuSwitchImg"].src = "Images/menu_switch_close.gif";
	} else {
		document.all["MenuFrame"].style.display = "none";
		document.all["MenuSwitchImg"].src = "Images/menu_switch_open.gif";
	}
}

function SelectAll() {
   var a = document.getElementsByTagName("input");
   if(a[0].checked==true){
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = false;
   }
   else
   {
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = true;
   }
}

function userOnlyTest() {
	var username = document.all["username"].value;
	var email = document.all["email"].value;
	popUpWindow("CheckUserOnly.asp?username=" + username + "&email=" + email, "check_user_only", 200, 80);
}