<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://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でも別ウンドウで何回でも開くため
	w = window.open("http://www.google.com/search", "search");
	document.search_form.target = "search";
}
</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://www.google.com/search"<?= $form_target ?>>
<table><tr><td nowrap>
<?php	if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) { ?>
	<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" style="width:4.0em; background-color:#FFFFAF;" name="btnG">
		<input type="button" value="Yahoo" style="width:3.6em; background-color:#FFFFAF;" onClick="YahooSch()">
		<input type="button" value="Naver" style="width:3.4em; background-color:#FFFFAF;" onClick="NaverSch()">
		<input type="button" value="Bing" style="width:2.8em; background-color:#FFFFAF;" onClick="BingSch()">
		<input type="button" value="Fresh" style="width:3.4em; background-color:#FFFFAF;" onClick="FresheyeSch()">
		<input type="button" value="ブログ" style="width:3.5em; background-color:#FFFFAF;" onClick="GoogleBlogSch()">
	</div>
	<div class="search_button_box">
		<input type="button" value="MyIndex" style="width:4.2em; background-color:#FFFFFF;" onClick="MyIndexSch()">
		<input type="button" value="Myメモ" style="width:3.7em; background-color:#FFFFFF;" onClick="MyMemoSch()"">
		<input type="button" value="Myカレンダー" style="width:6.0em; background-color:#FFFFFF;" onClick="MyCalendarSch()"">
		<input type="button" value="ニュース" style="width:4.3em; background-color:#D3F4FF;" onClick="NewsSch()">
		<input type="button" value="天気" style="width:2.9em; background-color:#D3F4FF;" onClick="TenkiSch()">
		<input type="button" value="時刻表" style="width:3.7em; background-color:#FFE2B5;" onClick="TrainTimeSch()">
		<input type="button" value="乗換(駅探)" style="width:5.2em; background-color:#FFE2B5;" onClick="TrainChangeSch()">
		<input type="button" value="経路(Google)" style="width:6.2em; background-color:#FFE2B5;" onClick="TrainChangeGoogle()">
	</div>
	<div class="search_button_box">
		<input type="button" value="辞書Alc" style="width:4.0em; background-color:#FFFFAF;" onClick="DicAlcSch()">
		<input type="button" value="辞書Yahoo" style="width:5.4em; background-color:#FFFFAF;" onClick="DicYahooSch()">
		<input type="button" value="百科Weblio" style="width:5.4em; background-color:#FFFFAF;" onClick="WeblioSch()">
		<input type="button" value="百科Yahoo" style="width:5.4em; background-color:#FFFFAF;" onClick="Yahoo100Sch()">
		<input type="button" value="ブック" style="width:3.3em; background-color:#FFFFAF;" onClick="GoogleBooksSch()">
		<input type="button" value="地図" style="width:2.9em; background-color:#D3F4FF;" onClick="MapSch()">
		<input type="button" value="●" style="width:1.8em; background-color:#D3F4FF;" onClick="MyMapSch()">
		<input type="button" value="〒番号" style="width:3.7em; background-color:#FFFFAF;" onClick="ZipSch()">
		<input type="button" value="電話帳" style="width:3.7em; background-color:#FFFFAF;" onClick="PhoneSch()">
	</div>
	<div class="search_button_box">
		<input type="button" value="料理(G)" style="width:4.0em; background-color:#FFE2EC;" onClick="googleRecipeSch()">
		<input type="button" value="料理(ク)" style="width:4.1em; background-color:#FFE2EC;" onClick="CookpadSch()">
		<input type="button" value="料理(キ)" style="width:4.1em; background-color:#FFE2EC;" onClick="KikkomanSch()">
		<input type="button" value="価格" style="width:2.9em; background-color:#FFE2B5;" onClick="KakakuSch()">
		<input type="button" value="価格(G)" style="width:4.0em; background-color:#FFE2B5;" onClick="ShoppingSch()">
		<input type="button" value="楽天" style="width:2.9em; background-color:#FFE2B5;" onClick="RakutenSch()">
		<input type="button" value="Amazon" style="width:4.0em; background-color:#FFE2B5;" onClick="AmazonSch()">
		<input type="button" value="ヤフオク" style="width:4.1em; background-color:#FFE2B5;" onClick="YahooAuctions()">
		<input type="button" value="YouTube" style="width:4.4em; background-color:#D3F4FF;" onClick="YoutubeSch()">
		<input type="button" value="Twitter" style="width:4.0em; background-color:#D3F4FF;" onClick="TwitterGoogle()">
	</div>
<?php	} else { ?>
	<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" style="background-color:#FFFFAF;" name="btnG">
		<input type="button" value="Yahoo" style="background-color:#FFFFAF;" onClick="YahooSch()">
		<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="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="TwitterGoogle()">
	</div>
<?php	} ?>
</td></tr></table>
</form>
