<?php
	while ($rec = mysql_fetch_array($rs)) {
		$keywords = preg_replace('/\s\s+/', ' ', $rec['c_keyword']);
		$keywords = my_htmlspecialchars($keywords);
		if ($rec['id_andor'] == 50) {
			$keywords = str_replace(' ', ' OR ', $keywords);
		}
?>
	<p>ニュース検索：<input type="button" value="<?= $keywords ?>" onClick="NewsSch('<?= $keywords ?>')" style="background-color:<?= $rec['c_button_color'] ?>">
	<input type="button" value="記事見出しのみ" onClick="NewsSch('<?= $keywords ?>','title')" style="background-color:<?= $rec['c_button_color'] ?>">
	<input type="button" value="Google:24時間" onClick="GoogleSch('<?= $keywords ?>','d')" style="background-color:#d0d0c0">
	<input type="button" value="Google:1週間" onClick="GoogleSch('<?= $keywords ?>','w')" style="background-color:#d0d0c0">
	<input type="button" value="ブログ:24時間" onClick="GoogleBlogSch('<?= $keywords ?>','d')" style="background-color:#e0e0d8">
	<input type="button" value="ブログ:1週間" onClick="GoogleBlogSch('<?= $keywords ?>','w')" style="background-color:#e0e0d8">
	</p>
<?php
	}
?>
<script language="javascript" src="../scripts/encodeURL.js" type="text/javascript"></script>
<script>
function NewsSch(keywords, where) {
	var url = "http://news.google.co.jp/news?q=";
	if (where == 'title') {
		url += "allintitle: ";
	}
	url += encodeURL(keywords);
	window.open(url,"","");
}
function GoogleSch(keywords, span) {
	var url = "http://www.google.com/search?q=";
	url += encodeURL(keywords);
	url += "&tbs=qdr:" + span;
	window.open(url,"","");
}
function GoogleBlogSch(keywords, span) {
	var url = "http://www.google.com/search?q=";
	url += encodeURL(keywords);
	url += "&tbm=blg&tbs=qdr:" + span;
	window.open(url,"","");
}
</script>
