function validEmail(email){
  invalidChars = " /:,;";

  if (email ==" "){
    return false;
  }

  for (i=0; i<invalidChars.length; i++){
    badChar = invalidChars.charAt(i);
    if(email.indexOf(badChar,0) > -1){
      return false;
    }
  }

  atPos =email.indexOf("@",1);
  if(atPos ==  -1) {
    return false;
  }

  periodPos = email.indexOf(".", atPos);
  if (periodPos == -1){
    return false;
  }

  if(periodPos+3 > email.length) {
   return false;
  }
  return true;
}

function isANum(str){
  for(i=0;i<str.length;i++){
    ch = str.substring(i,i+1);
    if (ch < "0" || ch > "9"){
      return false;
    }
  }
  return true;
}

function chkForm(formName){
/*
 if (formName.Surname.value ==""){
    alert("請輸入您的姓氏..");
    formName.Surname.focus();
    formName.Surname.select();
    return false;
  }
*/
 if (formName.Name.value ==""){
    alert("請輸入您的名字..");
    formName.Name.focus();
    formName.Name.select();
    return false;
  }

  if (!validEmail(formName.Email.value)){
    alert("請輸入正確電郵地址..");
    formName.Email.focus();
    formName.Email.select();
    return false;
  }
  countryOption = -1;
  for(i=0; i<formName.Country.length;i++){
   if(formName.Country[i].selected && formName.Country[i].value !=""){
     countryOption=i;
   }
  }
  if(countryOption == -1 && formName.OtherCountry.value==""){
    alert("請填寫您所屬的國家..");
    return false;
  }

  if(formName.topic.value==""){
	alert("請選擇您的主題..");
	return false;
  }

  if(formName.Details.value==""){
	alert("請填寫您的意見..");
	return false;
  }

   return true;
 
}


