//全选/全不选
function formCheckAll(form){
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
		if (e.name != 'CheckAll' && e.name != 'Commend')
			e.checked = form.CheckAll.checked;
	}
}

//用于判断全选记录的函数
function checkall(all)
{
    var chkAll = document.getElementById(all);
    for (var i=0; i<document.all.length; i++)
    {
	    var c = document.all[i];
        if (typeof(c) == typeof(chkAll) && c.disabled == false)
	        document.all[i].checked = chkAll.checked;
    }
}

//判断窗口是否已打开,同时提示用户
var openPage = null;
function showOpenPage(uRl) {
	try{
		if(openPage != null) {
			openPage.close();
		}
		openPage = window.open(uRl, '温州市瓯海区景山小学', '');
		if(openPage != null && typeof(openPage.document)=="object"){
		}else{
			return alert("浏览器屏蔽了弹出窗口，请重新设置，允许本系统打开弹出新窗口！");
		}
	}catch(e){
		return alert("浏览器屏蔽了弹出窗口，请重新设置，允许本系统打开弹出新窗口！");
	}
}

//子窗口式显示
function ShowDialog(url, width, height, optValidate) {
	if (optValidate) {
		//是否需要验证
	}
	var arr = showModalDialog(url, window, "dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:no;status:no");
	arr.focus();
}

//判断只能输入数字
function IsNum(theField){
    if (!IsNumer(theField.value))
    {
        alert("该区域只能输入数字！");
	    theField.value ="";
	    theField.focus();
    }
}
function IsNumer(s){
    var Number = "0123456789.";
    for (i = 0; i < s.length;i++)
	{
	    var c = s.charAt(i);
	    if (Number.indexOf(c) == -1) return false;
	}
    return true;
}

//搜索验证
function checkSearchForm(theForm){
	if (theForm.searchKey.value == ""){
		alert("搜索关键字不能为空！");
		theForm.searchKey.focus();
		return false;
	}
	return true;
}

//登陆验证
function checkLoginForm(theForm){
	if (theForm.txtUserName.value == ""){
		alert("用户名不能为空！");
		theForm.txtUserName.focus();
		return false;
	}
	if (theForm.txtPassword.value == ""){
		alert("密码不能为空！");
		theForm.txtPassword.focus();
		return false;
	}
	return true;
}

//家长反馈验证
function checkFeedbackForm(theForm){
	if (theForm.RealName.value == ""){
		alert("姓名不能为空！");
		theForm.RealName.focus();
		return false;
	}
	if (theForm.Tel.value == ""){
		alert("电话不能为空！");
		theForm.Tel.focus();
		return false;
	}
	if (theForm.Title.value == ""){
		alert("反馈主题不能为空！");
		theForm.Title.focus();
		return false;
	}
	if (theForm.Content.value == ""){
		alert("反馈内容不能为空！");
		theForm.Content.focus();
		return false;
	}
	return true;
}

//加入收藏
function AddFavorite(){
	window.external.AddFavorite('http://www.wzjsxx.net', '温州市瓯海区景山小学');	
}
