<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?cl=3&ie=utf-8&tn=baidujp&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://www8.ekitan.com/norikae/Time2Servlet?AN=0&ST=&SJ=0&CHAR=UTF8&SF=";
	url = url + encodeURL(sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value)) + "&SFList=%89w%88%EA%97%97&SFDF=&SFCODE=null&STDF=&STCODE=null";
	wopen(url);
}
function TrainChangeSch() {
	url = "http://search.ekitan.com/norikae/Norikae2Servlet?AN=0&FN=0&ETYPE=0&CHAR=UTF8&SF=";
	str = sp2han(document.search_form.<?= SEARCH_FORM_INPUT_TEXT_NAME ?>.value);
	key = str.split(" ");
	if (key.length != 2) {
		window.alert('乗車駅と下車駅をスペースで区切って入れてください。');
		return false;
	}
	url = url + encodeURL(key[0]) + "&ST=" + encodeURL(key[1]) + "&submit=%8C%9F%8D%F5";
	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['current_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() {
	url = "../tools/google-maps-earth.php?addr=";
	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 KakakuSch() {
	url = "http://kakaku.com/search_results/";
	url = url + EscapeSJIS(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 winOpen(){
//	Chrome,Safariでも別ウンドウで何回でも開くため
	w = window.open("http://www.google.com/search", "search");
	document.search_form.target = "search";
}
-->
</script>
<?php
	if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {		// IE
		$form_target = ' target="'.$target_type.'"';
	} else {
		if ($target_type == '_blank') {
			$form_target = ' onSubmit="winOpen()"';
		}
	}
?>
<form name="search_form" action="http://www.google.com/search"<?= $form_target ?>>
<table><tr><td nowrap>
	<div class="search_button_box">
		<input class="text" type="text" name="<?= SEARCH_FORM_INPUT_TEXT_NAME ?>" value="<?= $keystring ?>" style="width:260px">
		<input type="submit" value="Google" name="btnG">
		<input type="button" value="Yahoo" onClick="YahooSch()">
		<input type="button" value="Naver" onClick="NaverSch()">
		<input type="button" value="Bing" onClick="BingSch()">
		<input type="button" value="Fresh" onClick="FresheyeSch()">
		<input type="button" value="ブログ" onClick="GoogleBlogSch()">
	</div>
	<div class="search_button_box">
		<input type="button" value="MyIndex" onClick="MyIndexSch()" class="myhome_contents">
		<input type="button" value="Myメモ" onClick="MyMemoSch()"" class="myhome_contents">
		<input type="button" value="Myカレンダー" onClick="MyCalendarSch()"" class="myhome_contents">
		<input type="button" value="ニュース" onClick="NewsSch()">
		<input type="button" value="時刻表" onClick="TrainTimeSch()">
		<input type="button" value="乗換(駅探)" onClick="TrainChangeSch()">
		<input type="button" value="経路(Google)" onClick="TrainChangeGoogle()">
	</div>
	<div class="search_button_box">
		<input type="button" value="辞書Alc" onClick="DicAlcSch()">
		<input type="button" value="辞書Yahoo" onClick="DicYahooSch()">
		<input type="button" value="百科Weblio" onClick="WeblioSch()">
		<input type="button" value="百科Yahoo" onClick="Yahoo100Sch()">
		<input type="button" value="ブック" onClick="GoogleBooksSch()">
		<input type="button" value="地図" onClick="MapSch()">
		<input type="button" value="●" onClick="MyMapSch()">
		<input type="button" value="〒番号" onClick="ZipSch()">
		<input type="button" value="電話帳" onClick="PhoneSch()">
	</div>
	<div class="search_button_box">
		<input type="button" value="天気" onClick="TenkiSch()">
		<input type="button" value="料理(ク)" onClick="CookpadSch()">
		<input type="button" value="料理(キ)" onClick="KikkomanSch()">
		<input type="button" value="価格" onClick="KakakuSch()">
		<input type="button" value="楽天" onClick="RakutenSch()">
		<input type="button" value="Amazon" onClick="AmazonSch()">
		<input type="button" value="Yahooオク" onClick="YahooAuctions()">
		<input type="button" value="YouTube" onClick="YoutubeSch()">
		<input type="button" value="Twitter" onClick="TwitterSch()">
	</div>
</td></tr></table>
</form>
