//前台

function CheckLogin(form){
	if (form.Account.value==""){
		alert("Account is null!");
		form.Account.focus();
		form.Account.select();
		return false;
	}
	if (form.Password.value==""){
		alert("Password is null!");
		form.Password.focus();
		form.Password.select();
		return false;

	}
	return true;
}

function CheckSendpwd(form){
	if (form.Account.value==""){
		alert("Account is null!");
		form.Account.focus();
		form.Account.select();
		return false;
	}
	if (form.Email.value==""){
		alert("Email is null!");
		form.Email.focus();
		form.Email.select();
		return false;

	}
	return true;
}


function CheckRegister(form){
  if(form.Name.value==''){
     alert("Please input name!");
     form.Name.focus();
     form.Name.select();
	 return false;
  }
  if(form.Company.value==''){
     alert("Please input company name!");
     form.Company.focus();
     form.Company.select();
	 return false;
  }
  if(form.Type2.checked==true && form.othertype.value==''){
     alert("please input othertype!");
     form.othertype.focus();
     form.othertype.select();
	 return false;
  }
   if(form.Type2.checked == false && form.othertype.value !=''){
     alert("Please check The Other Type of Business!");
     form.Type2.focus();
     form.Type2.select();
	 return false;
  }
  if(form.Address1.value==''){
     alert("Please input address1!");
     form.Address1.focus();
     form.Address1.select();
	 return false;
  }
   if(form.Zip.value==''){
     alert("Please input zip code!");
     form.Zip.focus();
     form.Zip.select();
	 return false;
  }
 if(form.Email.value==''){
     alert("please input email!");
     form.Email.focus();
     form.Email.select();
	 return false;
  }
  if(form.Tel.value==''){
     alert("please input phone number!");
     form.Tel.focus();
     form.Tel.select();
	 return false;
  }
 if(form.Account.value==''){
     alert("Please input ID!");
     form.Account.focus();
     form.Account.select();
	 return false;
  }
  if(form.Password.value==''){
     alert("Please input password!");
     form.Password.focus();
     form.Password.select();
	 return false;
  }
  if(form.Password2.value==''){
     alert("Please input confirm password!");
     form.Password2.focus();
     form.Password2.select();
	 return false;
  }
  if(form.Password2.value != form.Password.value){
     alert("The confirm password is different from password!");
     form.Password2.focus();
     form.Password2.select();
	 return false;
  }
 
     return true;     
}

function CheckURegister(form){
  if(form.Name.value==''){
     alert("Please input Full Name!");
     form.Name.focus();
     form.Name.select();
	 return false;
  }
  if(form.Company.value==''){
     alert("Please input Company Name!");
     form.Company.focus();
     form.Company.select();
	 return false;
  }
  if(form.Type2.checked == true && form.othertype.value==''){
     alert("Please input Other Type of Business!");
     form.othertype.focus();
     form.othertype.select();
	 return false;
  }
  if(form.Type2.checked == false && form.othertype.value !=''){
     alert("Please check The Other Type of Business!");
     form.Type2.focus();
     form.Type2.select();
	 return false;
  }
  if(form.Address1.value==''){
     alert("Please input Address1!");
     form.Address1.focus();
     form.Address1.select();
	 return false;
  }
  if(form.Zip.value==''){
     alert("Please input Zip Code!");
     form.Zip.focus();
     form.Zip.select();
	 return false;
  }
 if(form.Email.value==''){
     alert("Please input E-mail!");
     form.Email.focus();
     form.Email.select();
	 return false;
  }
  
  if(form.Tel.value==''){
     alert("Please input Tel!");
     form.Tel.focus();
     form.Tel.select();
	 return false;
  }
  if(form.Oldpassword.value==''){
     alert("Please input Old Password!");
     form.Oldpassword.focus();
     form.Oldpassword.select();
	 return false;
  }
  if(form.Newpassword.value != form.Newpassword2.value){
     alert("Password is defferent from Confirm Password!");
     form.Newpassword2.focus();
     form.Newpassword2.select();
	 return false;
  }
    return true;     
}



//後台
function CheckMLogin(form){
    if (form.MID.value == "" ) {
        alert("管理員帳號 不得為空！")
        form.MID.select()
        form.MID.focus()
        return false;
      }
    if (form.MPWD.value == "" )  {
        alert("管理員密碼 不得為空！")
        form.MPWD.select()
        form.MPWD.focus()
        return false;
      }
	  return true;
}

function CheckCatefrm(form){
    if (form.CatNo.value == "" ) {
        alert("產品分類代碼 不得為空！")
        form.CatNo.select()
        form.CatNo.focus()
        return false;
      }
    if (form.CatName.value == "" )  {
        alert("產品分類名稱 不得為空！")
        form.CatName.select()
        form.CatName.focus()
        return false;
      }
	  return true;
}

function CheckProdfrm(theForm){
	if (theForm.ProdID.value==""){
		alert("產品編號 不得為空！");
		theForm.ProdID.focus();
		theForm.ProdID.select();
		return false;
	}
	if (theForm.ProdName.value==""){
		alert("產品名稱 不得為空！");
		theForm.ProdName.focus();
		theForm.ProdName.select();
		return false;
	}
	return true;
}

function CheckMRegister(form){
				if(form.Name.value==''){
					alert("會員全名 不得為空！");
					form.Name.focus();
					form.Name.select();
					return false;
				}
				if(form.Company.value==''){
					alert("公司名稱 不得為空！");
					form.Company.focus();
					form.Company.select();
					return false;
				}
				if(form.Type2.checked == true && form.othertype.value==''){
					alert("請輸入其他公司型態！");
					form.othertype.focus();
					form.othertype.select();
					return false;
				}
				 if(form.Type2.checked == false && form.othertype.value !=''){
					alert("請勾選其他公司型態!");
					form.Type2.focus();
					form.Type2.select();
					return false;
				}
				if(form.Address1.value==''){
					alert("住址 不得為空！!");
					form.Address1.focus();
					form.Address1.select();
					return false;
				}
				if(form.Zip.value==''){
					alert("郵遞區號 不得為空！");
					form.Zip.focus();
					form.Zip.select();
					return false;
				}
				if(form.Email.value==''){
					alert("電子郵件信箱 不得為空！");
					form.Email.focus();
					form.Email.select();
					return false;
				}
				if(form.Tel.value==''){
					alert("電話 不得為空！");
					form.Tel.focus();
					form.Tel.select();
					return false;
				}
				if(form.Newpassword.value != form.Newpassword2.value){
					alert("確認密碼和密碼不同,請重新輸入!");
					form.Newpassword2.focus();
					form.Newpassword2.select();
					return false;
				}
				return true;     
			}

function CheckMProfile(form){
				if(form.PCompany.value==''){
					alert("公司名稱 不得為空！");
					form.PCompany.focus();
					form.PCompany.select();
					return false;
				}
				if(form.PAddress.value==''){
					alert("住址 不得為空！!");
					form.PAddress.focus();
					form.PAddress.select();
					return false;
				}
				if(form.PTel.value==''){
					alert("電話 不得為空！");
					form.PTel.focus();
					form.PTel.select();
					return false;
				}
				if(form.PEmail.value==''){
					alert("電子郵件信箱 不得為空！");
					form.PEmail.focus();
					form.PEmail.select();
					return false;
				}
				if(form.PContactPerson.value==''){
					alert("聯絡人 不得為空！");
					form.PContactPerson.focus();
					form.PContactPerson.select();
					return false;
				}
				if(form.PUrl.value==''){
					alert("網址 不得為空！");
					form.PUrl.focus();
					form.PUrl.select();
					return false;
				}
				if(form.PProfile.value==''){
					alert("公司簡介 不得為空！");
					form.PProfile.focus();
					form.PProfile.select();
					return false;
				}
				return true;     
			}
function CheckMEvent(form){
  if(form.Subject.value==''){
     alert("標題 不得為空！");
     form.Subject.focus();
     form.Subject.select();
	 return false;
  }
   
  if(form.Content.value==''){
     alert("內容 不得為空！");
     form.Content.focus();
     form.Content.select();
	 return false;
  }
     return true;
}


function CheckMEpr(form){
    if (form.Subject.value == "" ) {
        alert("電子報主旨 不得為空！")
        form.Subject.select()
        form.Subject.focus()
        return false;
      }
    if (form.Content.value == "" )  {
        alert("訊息內容 不得為空！")
        form.Content.select()
        form.Content.focus()
        return false;
      }
	  return true;
}
