#*
 * Aipo is a groupware program developed by Aimluck,Inc.
 * Copyright (C) 2004-2008 Aimluck,Inc.
 * http://aipostyle.com/
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *#
## ---------------------------------------------------------------------------
<script language="JavaScript" type="text/JavaScript">
//<![CDATA[

function select_yahoo(form) {
  form.radio_type.value = "yahoo";
  form.action = "http://search.yahoo.co.jp/search";
}

function select_google(form) {
  form.radio_type.value = "google";
  form.action = "http://www.google.co.jp/search";
}

function select_tabi(form) {
  form.radio_type.value = "tabi";
  form.action = "http://www.tabi.tv/search/free_search.php?client=aipo";
}

function setSearchEngineValue(button) {
  if(button.form.radio_type.value == "tabi") {
    var d_Now = new Date();
    var d_To = new Date(d_Now.getYear() + 1900, d_Now.getMonth(), d_Now.getDate() + 7);
    var d_Year = d_To.getYear() + 1900;
    var d_Mon = d_To.getMonth()+1;
    var d_Day = d_To.getDate();
    button.form.hotel_name.value = button.form.p.value;
    button.form.year.value = d_Year;
    button.form.month.value = d_Mon;
    button.form.day.value = d_Day;
  } else if(button.form.radio_type.value == "google") {
    button.form.q.value = button.form.p.value;
    button.form.method = "get";
  } else {
  }
}

//]]>
</script>
<form name="exSearch$!{portlet.ID}" id="exSearch$!{portlet.ID}" action="http://search.yahoo.co.jp/search" method="post" target="_blank">
<input name="mode" type="hidden" value="search"/>
## for Yahoo
<input type="hidden" name="radio_type" value="yahoo"/>
## for Google
<input type="hidden" name="q" value=""/>
<input type="hidden" name="hl" value="ja"/>
## for TabiSamurai
<input type="hidden" name="hotel_name" value=""/>
<input type="hidden" name="radio_search" value="hotel"/>
<input type="hidden" name="year" value="2007"/>
<input type="hidden" name="month" value=""/>
<input type="hidden" name="day" value=""/>

<table border="0">
<tr>
<td scope="col"><input name="p" type="text" size="20" maxlength="100" value=""/></td>
<td scope="col">
<div class="middle">
#ALsubmitJS('submit' '検索' 'setSearchEngineValue(this);')
</div>
</td>
</tr>
<tr>
<td colspan="2">
<input name="tab" type="radio" value="yahoo" id="$!{portlet.ID}yahoo" onClick="select_yahoo(this.form)" #if($def_searchengine && $def_searchengine=="yahoo") checked="checked" #end/>
<label for="$!{portlet.ID}yahoo">Yahoo!</label>
<input name="tab" type="radio" value="google" id="$!{portlet.ID}google" onClick="select_google(this.form)" #if($def_searchengine && $def_searchengine=="google") checked="checked" #end/>
<label for="$!{portlet.ID}google">Google</label>
<input name="tab" type="radio" value="tabi" id="$!{portlet.ID}tabi" onClick="select_tabi(this.form)" #if($def_searchengine && $def_searchengine=="tabi") checked="checked" #end/>
<label for="$!{portlet.ID}tabi">旅侍</label>
</td>
</tr>
</table>
</form>
<script language="JavaScript" type="text/JavaScript">
//<![CDATA[

#if($def_searchengine)
#if($def_searchengine=="yahoo")
select_yahoo(document.forms["exSearch$!{portlet.ID}"]);
#elseif($def_searchengine=="google")
select_google(document.forms["exSearch$!{portlet.ID}"]);
#elseif($def_searchengine=="tabi")
select_tabi(document.forms["exSearch$!{portlet.ID}"]);
#end
#end

//]]>
</script>
