﻿
function ValidateForm(theForm)
{

  if (theForm.name.value.length < 2)
  {
	alert("聯絡人為必要資訊, 請輸入. 謝謝");
	theForm.name.focus();
        return(false)
  }

  if (theForm.tel.value.length < 7)
  {
	alert("聯絡電話為必要資訊, 請輸入. 謝謝");
	theForm.tel.focus();
        return(false)
  }  

  if (theForm.mobile.value.length < 7)
  {
	alert("手機號碼為必要資訊, 請輸入. 謝謝");
	theForm.mobile.focus();
        return(false)
  }

  if (theForm.email.value.length < 1)
  {
	alert("EMAIL為必要資訊, 請輸入. 謝謝");
	theForm.email.focus();
        return(false)
  } else {
      apos=theForm.email.value.indexOf("@");
      dotpos=theForm.email.value.lastIndexOf(".");
      if (apos<1||dotpos-apos<2)
        {
        alert("EMAIL格式不正確, 請重新輸入. 謝謝"); 
        theForm.email.focus();
        return false;
        }
  }

  if (!(theForm.fit_type[0].checked) & !(theForm.fit_type[1].checked) & !(theForm.fit_type[2].checked) & !(theForm.fit_type[3].checked) & !(theForm.fit_type[4].checked) & !(theForm.fit_type[5].checked) & !(theForm.fit_type[6].checked) & !(theForm.fit_type[7].checked))
  {
	alert("請選擇旅遊型態");
	theForm.fit_type[0].focus()
        return(false);
  }

  if (!(theForm.area[0].checked) & !(theForm.area[1].checked))
  {
	alert("請選擇旅遊區域");
	theForm.area[0].focus()
        return(false);
  }  

  if (theForm.location1.value.length < 2)
  {
	alert("請輸入旅遊地點. 謝謝");
	theForm.location1.focus();
        return(false)
  }  

  if (theForm.startdate.value.length < 2)
  {
	alert("請選擇出發日期. 謝謝");
	theForm.startdate.focus();
        return(false)
  }    

  if (theForm.duration.value.length < 1)
  {
	alert("請輸入旅遊天數. 謝謝");
	theForm.duration.focus();
        return(false)
  }

  if (theForm.adult.value.length < 1)
  {
	alert("請輸入參團人數. 謝謝");
	theForm.adult.focus();
        return(false)
  }  

  if (!(theForm.budget[0].checked) & !(theForm.budget[1].checked) & !(theForm.budget[2].checked) & !(theForm.budget[3].checked) & !(theForm.budget[4].checked) & !(theForm.budget[5].checked) & !(theForm.budget[6].checked) & !(theForm.budget[7].checked) & !(theForm.budget[8].checked) & !(theForm.budget[9].checked))
  {
	alert("請選擇預算(每人)");
	theForm.budget[0].focus()
        return(false);
  }
  

  
}




function Validatore(theForm)
{
  if (theForm.b2.value.length < 8)
  {
	alert("請輸入正確工號");
	theForm.b2.focus();
        return(false)
  }

  if (!(theForm.b6[0].checked) & !(theForm.b6[1].checked))
  {
	alert("請選擇你電話是否為專線或分機");
	theForm.b6[0].focus()
        return(false);
  }

  if (theForm.b3.value.length < 3)
  {
	alert("請輸入成本中心");
	theForm.b3.focus();
        return(false)
  }

  if (theForm.b4.value.length < 1)
  {
	alert("請輸入主管姓名");
	theForm.b4.focus();
        return(false)
  }

  if (theForm.b5.value.length < 1)
  {
	alert("請輸入主管E-Mail");
	theForm.b5.focus();
        return(false)
  }
  
  if (theForm.e1.value.length < 1)
  {
	alert("請輸入你的英文姓名");
	theForm.e1.focus();
        return(false)
  }

  if (theForm.e2.value.length < 1)
  {
	alert("請輸入你的job title");
	theForm.e2.focus();
        return(false)
  }

  if (theForm.b0.value == "Taipei")
  {
	  if (theForm.e4.value.length < 1)
	  {
		alert("請輸入你的部門名稱");
		theForm.e4.focus();
        	return(false)
	  } 

         if (theForm.e12.options[0].selected)
          {
		alert("請選擇你的樓層位置");
		theForm.e12.focus();
		return(false)
	  }	

  }

  if (theForm.e7.value.length != 4)
  {
	alert("請輸入你的專線(後四碼)或分機號碼");
	theForm.e7.focus();
        return(false)
  }

  if (theForm.e8.value.length != 4)
  {
	alert("請輸入你的FAX 前4碼");
	theForm.e8.focus();
        return(false)
  }

  if (theForm.e9.value.length != 4)
  {
	alert("請輸入你的FAX 後4碼");
	theForm.e9.focus();
        return(false)
  }

  if (theForm.e11.value.length < 1)
  {
	alert("請輸入你的E-Mail");
	theForm.e11.focus();
        return(false)
  }


}



function Validatorc(theForm)
{

  if (theForm.c1.value.length < 1)
  {
	alert("請輸入你的中文姓名");
	theForm.c1.focus();
        return(false)
  }

  if (theForm.c2.value.length < 1)
  {
	alert("請輸入你的職稱");
	theForm.c2.focus();
        return(false)
  }

  if (theForm.b0.value == "Taipei")
  {
	  if (theForm.c4.value.length < 1)
	  {
		alert("請輸入你的部門名稱");
		theForm.c4.focus();
        	return(false)
	  } 

  }
 
}
