//CheckBox Status For Form
//课程全选 反选
function fwholeAll(formID){
   for(var i=0; i<document.forms[formID].length; i++){
      if (document.forms[formID][i].tagName=="INPUT"){
         if (document.forms[formID][i].type=="checkbox"){
             document.forms[formID][i].checked=true;
         }
      }
   }
}
function freverseAll(formID){
  for(var i=0; i<document.forms[formID].length; i++){
  	if (document.forms[formID][i].tagName=="INPUT"){
	 	if (document.forms[formID][i].type=="checkbox"){
		 	if(document.forms[formID][i].checked==false){
				document.forms[formID][i].checked=true;
			}else{
				document.forms[formID][i].checked=false;
			}
		 }
  	}
  }     
}
function fcancelAll(formID) {
  for(var i=0; i<document.forms[formID].length; i++){               
      if (document.forms[formID][i].tagName=="INPUT"){
         if (document.forms[formID][i].type=="checkbox"){
             document.forms[formID][i].checked=false;
         }
      }
  }
}

//Confim Infomation
function chkConfirm(msgCont){
	if(confirm(msgCont)){
		event.returnValue=true;
	}else{
		event.returnValue=false;
	}
}
//Check Select Status 
function chkFormExec(){
//	    var curSltObj=$(cSelectObj);
//		var curBtnObj=$(cButtonObj);
	//	if(curSltObj.selectedIndex!==0){
//			curBtnObj.value='执行['+curSltObj.options[curSltObj.selectedIndex].innerHTML+']操作';
//		}else{
//			curBtnObj.value='执行操作';
//		}
//		
		if(document.listForm.selectID.value!='0'){
			document.listForm.formExec.disabled=false;
		}else{
			document.listForm.formExec.disabled=true;
		}
}
//Check Search Data
//Call Event:onkeyup/onpropertychange
function chkSearch(sTextID,sButtonID){
	var sText=$(sTextID);
	var sBtn=$(sButtonID);
	if(sText.value.trim().length>0){
		sBtn.disabled=false;
	}else{
		sBtn.disabled=true;
	}
}

function ChkPost(){
	var chkok = true;
	if (chkok) {if (frm.oTitle.value.length<1) {alert('文章标题不能为空!');frm.oTitle.focus();chkok=false;}}
	if (chkok) {if (frm.username.value.length<1) {alert('联系人不能为空!');frm.username.focus();chkok=false;}}
	if (chkok) {if (frm.startTime.value.length<1) {alert('开课时间不能为空!');frm.startTime.focus();chkok=false;}}
	if (chkok) {if (frm.tel.value.length<1) {alert('联系电话不能为空!');frm.tel.focus();chkok=false;}}
	if (chkok) {if (frm.title.value.length<1) {alert('信息Title不能为空!');frm.title.focus();chkok=false;}}
	if (chkok) {if (frm.Address.value.length<1) {alert('授课地址不能为空!');frm.Address.focus();chkok=false;}}
	if (chkok) {if (frm.qq.value.length<5||frm.qq.value.length>11) {alert('QQ号码最少5位最多11位!');frm.qq.focus();chkok=false;}}
	if (chkok) {if (frm.content.value.length<1) {alert('文章内容不能为空!');frm.content.focus();chkok=false;}}
	if (chkok) {frm.submit();}	
}
function Chkorg(){
	var chkok = true;
	if (chkok) {if (frm.title.value.length<1) {alert('机构名称不能为空!');frm.title.focus();chkok=false;}}
	if (chkok) {if (frm.addr.value.length<1) {alert('联系地址不能为空!');frm.addr.focus();chkok=false;}}
	if (chkok) {if (frm.yzbm.value.length<1) {alert('邮政编码不能为空!');frm.yzbm.focus();chkok=false;}}
	
	if (chkok) {if (frm.name.value.length<1) {alert('联系人不能为空!');frm.name.focus();chkok=false;}}
	if (chkok) {if (frm.tel.value.length<1) {alert('联系电话不能为空!');frm.tel.focus();chkok=false;}}
	if (chkok) {if (frm.content.value.length<1) {alert('机构介绍不能为空!');frm.content.focus();chkok=false;}}
	if (chkok) {frm.submit();}	
}

function Chkjob(){
	var chkok = true;
	if (chkok) {if (frm.name.value.length<1) {alert('职位名称不能为空!');frm.name.focus();chkok=false;}}
	if (chkok) {if (frm.Num.value.length<1) {alert('招聘人数不能为空!');frm.Num.focus();chkok=false;}}
	if (chkok) {frm.submit();}	
}

function ChangePassword(){
	var chkok = true;
	if (chkok) {if (frm.oldpassword.value.length<1) {alert('原始密码不能为空!');frm.oldpassword.focus();chkok=false;}}
	if (chkok) {if (frm.password.value.length<1) {alert('新密码不能为空!');frm.password.focus();chkok=false;}}
	if (chkok) {if (frm.password.value.length<6) {alert('密码不能少于六位!');frm.password.focus();chkok=false;}}
	if (chkok) {if (frm.repassword.value.length<1) {alert('重复密码不能为空!');frm.repassword.focus();chkok=false;}}
	if (chkok) {if (frm.password.value!=frm.repassword.value) {alert('二次密码不相同!');frm.repassword.focus();chkok=false;}}
	if (chkok) {frm.submit();}	
}
function username()//添加用户
{
var selectedindex = document.frm.CoAuthor.selectedIndex;
document.frm.username.value = document.frm.CoAuthor.options[selectedindex].value;
}
//检查注册用户信息
function checkReg()
{
	var chkok = true;
	if (chkok) {if (regForm.username.value.length<1) {alert('用户名不能为空!');regForm.username.focus();chkok=false;}}
	if (chkok) {if (regForm.email.value.length<1) {alert('电子邮件不能为空!');regForm.email.focus();chkok=false;}}
	if (chkok) {if (regForm.password.value.length<1) {alert('新密码不能为空!');regForm.password.focus();chkok=false;}}
	if (chkok) {if (regForm.password.value.length<6) {alert('密码不能少于六位!');regForm.password.focus();chkok=false;}}
	if (chkok) {if (regForm.repassword.value.length<1) {alert('重复密码不能为空!');regForm.repassword.focus();chkok=false;}}
	if (chkok) {if (regForm.password.value!=regForm.repassword.value) {alert('二次密码不相同!');regForm.repassword.focus();chkok=false;}}
	if (chkok) {if (regForm.regUserQuestion.value.length<1) {alert('用户问题不能为空!');regForm.regUserQuestion.focus();chkok=false;}}
	if (chkok) {if (regForm.regUserAnswer.value.length<1) {alert('问题答案不能为空!');regForm.regUserAnswer.focus();chkok=false;}}
	if (chkok) {if (regForm.isAgree.checked==false) {alert('您没有同意协议条款!');regForm.isAgree.focus();chkok=false;}}
	if (chkok) {regForm.submit();}
}

//检测用户登陆
function chklogin()
{   
    var chkok = true; 
	if (chkok) {if (loginForm.username.value.length<1) {alert('登陆用户名不能为空!');loginForm.username.focus();chkok=false;}}
	if (chkok) {if (loginForm.password.value.length<1) {alert('登陆密码不能为空!');loginForm.password.focus();chkok=false;}}
    if (chkok) {loginForm.submit();}	

}
//盛情友情链接
function Chklink(){
	var chkok = true;
	if (chkok) {if (frm.myWebName.value.length<1) {alert('网站名称不能为空!');frm.myWebName.focus();chkok=false;}}
	if (chkok) {if (frm.myUrl.value.length<1) {alert('链接地址不能为空!');frm.myUrl.focus();chkok=false;}}
	if (chkok) {if (frm.myContent.value.length<1) {alert('网站描述不能为空!');frm.myContent.focus();chkok=false;}}
	if (chkok) {if (frm.YourUrl.value.length<1) {alert('链接出现地址不能为空!');frm.YourUrl.focus();chkok=false;}}
	if (chkok) {frm.submit();}	
}
//检测注册用户名是否被占用
function CheckName(gotoURL) {
   var ssn=regForm.username.value.toLowerCase();
	   var open_url = gotoURL + "?username=" + ssn;
	   window.open(open_url,'','status=0,directories=0,resizable=0,toolbar=0,location=0,scrollbars=0,width=180,height=100');
}
