function LineCdChange()
{
  oi=document.grpfrg.Line_cd.selectedIndex;
  for(i=document.grpfrg.Country.length-1;i>=0;i--)
    document.grpfrg.Country.options[i] = null;
  for(cx=0;cx<COUNTRY[oi].length;cx++) {
    document.grpfrg.Country.options[cx]= COUNTRY[oi][cx];    
  }    
  document.grpfrg.Country.options[0].selected=true;
  findex1 = document.grpfrg.Country.selectedIndex;
  for(i=document.grpfrg.City.length-1;i>=0;i--)
    document.grpfrg.City.options[i] = null;
  for(i=0;i<CITY[findex][findex1].length;i++) {
    document.grpfrg.City.options[i] = CITY[oi][findex1][i];
  }    
  document.grpfrg.City.options[0].selected = true;
  if ( document.grpfrg.Line_cd.selectedIndex != 0 ) {
    document.grpfrg.LineData.value = document.grpfrg.Line_cd.options[document.grpfrg.Line_cd.selectedIndex].value
    document.grpfrg.CountryData.value = "" ;
    document.grpfrg.CityData.value = "" ;
  } else {
    document.grpfrg.LineData.value = "" ;
    document.grpfrg.CountryData.value = "" ;
    document.grpfrg.CityData.value = "" ;
  }
}
function CountryChange()
{
  fi=document.grpfrg.Line_cd.selectedIndex;
  ri=document.grpfrg.Country.selectedIndex;
  for(i=document.grpfrg.City.length-1;i>=0;i--)
    document.grpfrg.City.options[i] = null;
  for(cx=0;cx<CITY[fi][ri].length;cx++) {
    document.grpfrg.City.options[cx]= CITY[fi][ri][cx];
  }    
  document.grpfrg.City.options[0].selected = true;
  if ( document.grpfrg.Country.selectedIndex != 0 ) {
    document.grpfrg.CountryData.value = document.grpfrg.Country.options[document.grpfrg.Country.selectedIndex].value
    document.grpfrg.CityData.value = "" ;
  } else {
    document.grpfrg.CountryData.value = "" ;
    document.grpfrg.CityData.value = "" ;
  }
}
function CityChange()
{
  if ( document.grpfrg.City.selectedIndex != 0 ) {
    document.grpfrg.CityData.value = document.grpfrg.City.options[document.grpfrg.City.selectedIndex].value
  } else {
    document.grpfrg.CityData.value = "" ;
  }
}
function grpFrgSend()
{
  if (document.grpfrg.LineData.value == "") {
    alert("您尚未選擇目的地線別");
    document.grpfrg.Line_cd.focus();
    return ;
  }
  /*if (document.grpfrg.Country.value == "") {
    alert("您尚未選擇目的地國家");
    document.grpfrg.Country.focus();
    return ;
  }
  if (document.grpfrg.City.value == "") {
    alert("您尚未選擇目的地城市");
    document.grpfrg.City.focus();
    return ;
  }*/
  SetCookie("agent","grpfrg",new Date(today.getTime() +  24 * 60 * 60 * 1000));
  //if(document.grpfrg.item_type.selectedIndex== 0){
	//window.parent.location.href="/ezec/pkgfrn/grp_itemindexAdv.jsp?item_type="+document.grpfrg.item_type.value+"&LINE_CD="+document.grpfrg.Line_cd.value+"&city_from="+document.grpfrg.city_from.value+"&country="+document.grpfrg.Country.value+"&city_to="+document.grpfrg.City.value;
  //}else{
	window.parent.location.href="/ezec/pkgfrn/grp_itemindexAdv.jsp?travelType="+document.grpfrg.item_type.value+"&Line_cd="+document.grpfrg.Line_cd.value+"&city_from="+document.grpfrg.city_from.value+"&Country="+document.grpfrg.Country.value+"&City="+document.grpfrg.City.value;
	//}
}

document.write("                      <table width=\"330\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\"><form name='grpfrg' action='' method='post'>");
document.write("                        <tr> ");
document.write("                          <td  colspan=\"2\">出發地 ");
document.write("                            <select name=\"city_from\">");
document.write("                                <option value=TPE selected>台北</option>");
document.write("                                <option value=TNN>台南</option>");
document.write("                                <option value=TXG>台中</option>");
document.write("                                <option value=KHH>高雄</option>");
document.write("                                <option value=CYI>嘉義</option>");
document.write("                                <option value=HUN>花蓮</option>");
document.write("                              </select>");
document.write("                            　旅遊型態 ");
document.write("                            <select name=\"item_type\">");
document.write("                                <option value='' selected >不限</option>");
document.write("                                <option value=FRT>自由行</option>");
document.write("                                <option value=FRN>團體旅遊</option>");
document.write("                              </select>");
document.write("                          </td>");
document.write("                        </tr>");
document.write("                        <tr> ");
document.write("                            <td  >目的地 ");
document.write("                              <select  name=\"Line_cd\" onChange=\"LineCdChange();\">");
document.write("                              </select> ");
document.write("                              <select  name=\"Country\" onChange=\"CountryChange();\">");
document.write("                            </select>");
document.write("</td></tr><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select  name=\"City\" onChange=\"CityChange();\">");
document.write("                            </select>");
document.write("                              <input type=\"hidden\" name=\"LineData\">");
document.write("                              <input type=\"hidden\" name=\"CountryData\">");
document.write("                              <input type=\"hidden\" name=\"CityData\"></td>");
document.write("                          <td width=\"50\"> ");
document.write("                            <div align=\"center\"> ");
document.write("                              <input type=\"button\" name=\"S2\" value=\"搜尋>>\" onClick='grpFrgSend();' >");
document.write("                            </div>");
document.write("                          </td>");
document.write("                        </tr></form>");
document.write("                      </table>");
