<script language="JavaScript">
function wopen(url) {
	if (loadCookie("index_jump_targettype") == "_blank") {
		w01 = window.open(url,"","");				// 新しいウインドウで開く
	} else {
		top.location.href = url;
	}
}
function sp2han(str) {
	return(str.replace(/　/g, ' '));
}
function sp2plus(str) {
	return(str.replace(/ /g, '+').replace(/　/g, '+'));
}
function sp2comma(str) {
	return(str.replace(/ /g, ',').replace(/　/g, ','));
}
function MyIndexSch() {
	url = "list.php?key=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	top.location.href = url;
}
function MyMemoSch() {
	url = "../memo/list.php?key=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	top.location.href = url;
}
function MyCalendarSch() {
	url = "../calendar/list.php?key=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	top.location.href = url;
}
function GoogleSch() {
	url = "http://www.google.com/search?q=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function YahooSch() {
	url = "http://search.yahoo.co.jp/search?p=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function BaiduSch() {
	url = "http://www.baidu.jp/s?tn=baidujp&ie=utf-8&wd=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function NaverSch() {
	url = "http://search.naver.jp/search?q=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function BingSch() {
	url = "http://www.bing.com/search?q=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value)) + "&go=&form=QBLH&filt=all";
	wopen(url);
}
function FresheyeSch() {
	url = "http://kotochu.fresheye.com/search/?kw=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function MarsSch() {
	url = "http://www.marsflag.com/search.x?phrase=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function GoogleBooksSch() {
	url = "http://books.google.com/books?q=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value)) + "&btnG=%E6%9B%B8%E7%B1%8D%E3%81%AE%E6%A4%9C%E7%B4%A2&hl=ja";
	wopen(url);
}
function NewsSch() {
	url = "http://news.google.co.jp/news?q=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function TrainTimeSch() {
	url = "http://timetable.ekitan.com/train/TimeSearch?SFNAME=";
	str = document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value;
	if (str != "") {
		url = url + EscapeSJIS(str);
	} else {
		url = url + EscapeSJIS("<?= $_SESSION['login_friends_home_station_'.$_SESSION['login_id']] ?>");
	}
	wopen(url);
}
function TrainChangeSch() {
	url = "http://transit.ekitan.com/norikae/NorikaeSearch?SFNAME=";
	saddr = "<?= $_SESSION['login_friends_home_station_'.$_SESSION['login_id']] ?>";
	str = sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value);
	key = str.split(" ");
	if (key.length == 2) {
		url = url + EscapeSJIS(key[0]) + "&STNAME=" + EscapeSJIS(key[1]);
	} else if ((key.length == 1) && (saddr != "")) {
		url = url + EscapeSJIS(saddr) + "&STNAME=" + EscapeSJIS(key[0]);
	} else {
		window.alert('乗車駅と下車駅をスペースで区切って入れてください。');
		return false;
	}
	wopen(url);
}
function TrainChangeGoogle() {
	url = "http://maps.google.co.jp/maps?ie=UTF8&f=d&ttype=dep&dirflg=r";
	saddr = "<?= $_SESSION['login_friends_home_address_'.$_SESSION['login_id']] ?>";
	str = sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value);
	key = str.split(" ");
	if (key.length == 2) {
		url = url + "&saddr=" + encodeURL(key[0]) + "&daddr=" + encodeURL(key[1]);
	} else if ((key.length == 1) && (saddr != "")) {
		url = url + "&saddr=" + encodeURL(saddr) + "&daddr=" + encodeURL(key[0]);
	} else {
		window.alert('出発地と目的地をスペースで区切って入れてください。');
		return false;
	}
	wopen(url);
}
function DicAlcSch() {
	url = "http://eow.alc.co.jp/";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function DicYahooSch() {
	url = "http://dic.yahoo.co.jp/bin/dsearch?enc=UTF-8&p=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function WeblioSch() {
	url = "http://www.weblio.jp/content/";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function Yahoo100Sch() {
	url = "http://100.yahoo.co.jp/search?p=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function MapSch() {
	url = "http://maps.google.co.jp/maps?q=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function MyMapSch() {
<?php	if (GOOGLE_MAPS_API_VERSION == 'V3') { ?>
		url = "../tools/google-maps-earth-multi-v3.php?addr=";
<?php	} else { ?>
		url = "../tools/google-maps-earth.php?addr=";
<?php	} ?>
	url = url + encodeURL(sp2comma(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function ZipSch() {
	url = "http://postcode.goo.ne.jp/search.php?MT=";
	url = url + EscapeEUCJP(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function PhoneSch() {
	url = "http://phonebook.yahoo.co.jp/search/?query=";
	url = url + EscapeEUCJP(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function GoogleBlogSch() {
	url = "http://blogsearch.google.com/blogsearch?q=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value)) + "&um=1&ie=UTF-8&sa=N&hl=ja&tab=wb";
	wopen(url);
}
function TenkiSch() {
	url = "http://tenki.jp/search/?keyword=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function CookpadSch() {
	url = "http://cookpad.com/%E3%83%AC%E3%82%B7%E3%83%94/";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function KikkomanSch() {
	url = "http://www.kikkoman.co.jp/homecook/search/select_search.php?free_word=";
	url = url + EscapeSJIS(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function googleRecipeSch() {
	url = "http://www.google.com/search?q=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	url = url + "&tbs=lr:lang_1ja,rcp:1";
	wopen(url);
}
function KakakuSch() {
	url = "http://kakaku.com/search_results/";
	url = url + EscapeSJIS(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value)) + "/";
	wopen(url);
}
function ShoppingSch() {
	url = "http://www.google.co.jp/products/?q=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function RakutenSch() {
	url = "http://esearch.rakuten.co.jp/rms/sd/esearch/vc?sv=2&sitem=";
	url = url + EscapeEUCJP(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function AmazonSch() {
	url = "http://www.amazon.co.jp/s/ref=nb_ss_gw?__mk_ja_JP=%83J%83%5E%83J%83i&url=search-alias%3Daps&field-keywords=";
	url = url + EscapeSJIS(sp2han(document.search_form.<?=SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function YahooAuctions() {
	url = "http://search.auctions.yahoo.co.jp/jp/search/auc?p=";
	url = url + EscapeEUCJP(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value)) + "&auccat=0&submit=%B8%A1%BA%F7&alocale=0jp&acc=jp";
	wopen(url);
}
function YoutubeSch() {
	url = "http://www.youtube.com/results?search_query=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value)) + "&search_type=&aq=f";
	wopen(url);
}
function TwitterSch() {
	url = "http://search.twitter.com/search?q=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function TwitterGoogle() {
	url = "http://www.google.com/search?tbs=mbl:1&hl=ja&num=100&q=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value));
	wopen(url);
}
function winOpen(){
//	Chrome,Safariでも別ウンドウで何回でも開くため
	target = 't'+(new Date()).getTime();
	w = window.open("http://search.yahoo.co.jp/", target);
	document.search_form.target = target;
}
</script>
<?php
	if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
		$form_target = ' target="'.$target_type.'"';
	} else {
		if ($target_type == '_blank') {
			$form_target = ' onSubmit="winOpen()"';
		}
	}
?>
<form name="search_form" action="http://search.yahoo.co.jp/search"<?= $form_target ?>>
<table><tr><td nowrap>
	<div class="search_button_box">
		<a id="suggest_on" class="suggest_onoff" href="javascript:suggest('off');" style="color:#EACC8F;<?= $_SESSION['suggest_on'] ?>">●</a><a id="suggest_off" class="suggest_onoff" href="javascript:suggest('on');" style="color:#EACC8F;<?= $_SESSION['suggest_off'] ?>">○</a><input class="text" type="text" id="search_str" name="<?= SEARCH_FORM_INPUT_TEXT_NAME ?>" value="<?= $keystring ?>">
		<input type="submit" value="Yahoo" style="background-color:#FFFFAF;" name="">
		<input type="button" value="Google" style="background-color:#FFFFAF;" onClick="GoogleSch()">
		<input type="button" value="Naver" style="background-color:#FFFFAF;" onClick="NaverSch()">
		<input type="button" value="Bing" style="background-color:#FFFFAF;" onClick="BingSch()">
		<input type="button" value="Fresh" style="background-color:#FFFFAF;" onClick="FresheyeSch()">
		<input type="button" value="百度" style="background-color:#FFFFAF;" onClick="BaiduSch()">
		<input type="button" value="ブログ" style="background-color:#FFFFAF;" onClick="GoogleBlogSch()">
	</div>
	<div class="search_button_box">
		<input type="button" value="MyIndex" style="background-color:#FFFFFF;" onClick="MyIndexSch()">
		<input type="button" value="Myメモ" style="background-color:#FFFFFF;" onClick="MyMemoSch()"">
		<input type="button" value="Myカレンダー" style="background-color:#FFFFFF;" onClick="MyCalendarSch()">
		<input type="button" value="ニュース" style="background-color:#D3F4FF;" onClick="NewsSch()">
		<input type="button" value="天気" style="background-color:#D3F4FF;" onClick="TenkiSch()">
		<input type="button" value="時刻表" style="background-color:#FFE2B5;" onClick="TrainTimeSch()">
		<input type="button" value="乗換(駅探)" style="background-color:#FFE2B5;" onClick="TrainChangeSch()">
		<input type="button" value="経路(Google)" style="background-color:#FFE2B5;" onClick="TrainChangeGoogle()">
	</div>
	<div class="search_button_box">
		<input type="button" value="辞書Alc" style="background-color:#FFFFAF;" onClick="DicAlcSch()">
		<input type="button" value="辞書Yahoo" style="background-color:#FFFFAF;" onClick="DicYahooSch()">
		<input type="button" value="百科Weblio" style="background-color:#FFFFAF;" onClick="WeblioSch()">
		<input type="button" value="百科Yahoo" style="background-color:#FFFFAF;" onClick="Yahoo100Sch()">
		<input type="button" value="ブック" style="background-color:#FFFFAF;" onClick="GoogleBooksSch()">
		<input type="button" value="地図" style="background-color:#D3F4FF;" onClick="MapSch()">
		<input type="button" value="●" style="background-color:#D3F4FF;" onClick="MyMapSch()">
		<input type="button" value="〒番号" style="background-color:#FFFFAF;" onClick="ZipSch()">
		<input type="button" value="電話帳" style="background-color:#FFFFAF;" onClick="PhoneSch()">
	</div>
	<div class="search_button_box">
		<input type="button" value="料理(G)" style="background-color:#FFE2EC;" onClick="googleRecipeSch()">
		<input type="button" value="料理(ク)" style="background-color:#FFE2EC;" onClick="CookpadSch()">
		<input type="button" value="料理(キ)" style="background-color:#FFE2EC;" onClick="KikkomanSch()">
		<input type="button" value="価格" style="background-color:#FFE2B5;" onClick="KakakuSch()">
		<input type="button" value="価格(G)" style="background-color:#FFE2B5;" onClick="ShoppingSch()">
		<input type="button" value="楽天" style="background-color:#FFE2B5;" onClick="RakutenSch()">
		<input type="button" value="Amazon" style="background-color:#FFE2B5;" onClick="AmazonSch()">
		<input type="button" value="ヤフオク" style="background-color:#FFE2B5;" onClick="YahooAuctions()">
		<input type="button" value="YouTube" style="background-color:#D3F4FF;" onClick="YoutubeSch()">
		<input type="button" value="Twitter" style="background-color:#D3F4FF;" onClick="TwitterSch()">
	</div>
</td></tr></table>
</form>
