<?
include_once("./_common.php");
?>

<style type="text/css">
#popular_box{float:right}
#popular_box
{
	width:190px;
	height:18px;
	background-color:
	text-align:left;
}
#popular_list, #KeywordView{float:left}
#popular_list{width:40px;height:18px;margin-top:0px;}
#KeywordView{width:150px;height:18px;margin-top:0px;}

#OverKeyword, #OverListLayer1, #OverListLayer2, #OverListLayer3, #OverList{float:left}
#OverKeyword
{
	width:150px;
	height:210px;
	margin-top:-5px;
	background-color:#46810f;
	text-align:left;
}
#OverListLayer1
{
	width:150px;
	height:210px;
	padding:2 2 2 2px;
	text-align:left;
}
#OverListLayer2
{
	width:146px;
	height:206px;
	background-color:#ffffff;
	text-align:left;
}
#OverListLayer3
{
	width:146px;
	height:206px;
	padding:3 5 3 5px;
	text-align:left;
}
#OverList
{
	width:136px;
	height:20px;
	text-align:left;
}

#OverListText, #OverListCnt{float:left}
#OverListText
{
	width:106px;
	height:16px;
	margin-top:3px;
	text-align:left;
}
#OverListCnt
{
	width:30px;
	height:16px;
	margin-top:3px;
	text-align:right;
}

#KeywordScroll, #KeywordScrollCnt{float:left}
#KeywordScroll
{
	width:115px;
	height:16px;
	text-align:left;
}
#KeywordScrollCnt
{
	width:35px;
	height:16px;
	text-align:right;
}

.KeywordScrollCnt{font-size:11px;color:#898989;}
.OverKeywordCnt{font-size:11px;color:#898989;}
</style>
<script language="JavaScript" src="<?=$g4[path]?>/js/scroll.js"></script>
<script language="JavaScript">
function KeywordView(keyword) {

    if(keyword) {

        KeywordList.style.display = "none";
        OverKeyword.style.display = "block";

    } else {

        KeywordList.style.display = "block";
        OverKeyword.style.display = "none";

    }

}
</script>

<div id="popular_box">
	<div id="popular_list"><font color="#46810f">&nbsp;<strong>검색</strong> :</font></div>
	<div id="KeywordView" onmouseover="KeywordView(true)" onmouseout="KeywordView(false)" style="text-decoration:none">
<!-- 실시간 리스트 START -->
<div id="KeywordList">
<div id="newPop" onMouseOver="quicknewstop.stop=true;" onMouseOut="quicknewstop.stop=false;"></div>
<script language="JavaScript">
quicknewstop = new NvScroll();
quicknewstop.name = 'quicknewstop';
quicknewstop.divId = 'newPop';
quicknewstop.height = 16;
quicknewstop.width = 150;
quicknewstop.scrollspeed  = 10;
quicknewstop.pausedelay   = 3000;
quicknewstop.pausemouseover = true;
<?
    $date_cnt = "1"; // 시간
    $pop_cnt = "10"; // 갯수

    $date_gap = date("Y-m-d", $g4[server_time] - ($date_cnt * 86400));
    $sql = " select pp_word, count(*) as cnt from $g4[popular_table]
              where pp_date between '$date_gap' and '$g4[time_ymd]'
              group by pp_word
              order by cnt desc, pp_word
              limit 0, $pop_cnt ";

    $result = sql_query($sql);
    for ($i=0; $row=sql_fetch_array($result); $i++) 
    {	$list[$i] = $row;
        // 스크립트등의 실행금지
        $list[$i][pp_word] = strip_tags($list[$i][pp_word]);
	// 출력
	echo "\nquicknewstop.add(\"<div id='KeywordScroll'><img src='{$g4[path]}/img/keyword_rank/rank_{$i}.gif' style='position:relative; overflow:hidden; left:0; top:1;'> <a href='$g4[bbs_path]/search.php?sfl=".urlencode($list[$i][pp_word])."'><font color=#15470a>".conv_subject(strip_tags(htmlspecialchars($list[$i][pp_word])),12,'')."</font></a></div><div id='KeywordScrollCnt'><span class='KeywordScrollCnt'>{$list[$i][cnt]}</span>&nbsp;<img src='$g4[path]/img/rank/up.gif'></div>\");";
    }
?>
quicknewstop.start();
</script>
</div>
<!-- 실시간 리스트 END -->

<!-- 실시간 오버 START -->
<div id="OverKeyword" style="position:absolute;z-index:1;display:none;">
	<div id="OverListLayer1">
	<div id="OverListLayer2">
	<div id="OverListLayer3">
		<div id="OverList">
<?
$date_gap = date("Y-m-d", $g4[server_time] - ($date_cnt * 86400));
$sql = " select pp_word, count(*) as cnt from $g4[popular_table]
              where pp_date between '$date_gap' and '$g4[time_ymd]'
              group by pp_word
              order by cnt desc, pp_word
              limit 0, $pop_cnt ";
$result = sql_query($sql);

// 실시간 인기검색어 오버
for ($i=0; $row=sql_fetch_array($result); $i++) {
    $list[$i] = $row;
    // 스크립트등의 실행금지
    $list[$i][pp_word] = strip_tags($list[$i][pp_word]);
    // 출력
    echo "<div id='OverList' onMouseOver='this.style.backgroundColor=\"#f9fae8\"' onMouseOut='this.style.backgroundColor=\"#ffffff\"'><div id='OverListText'><img src='{$g4[path]}/img/keyword_rank/rank_{$i}.gif' style='position:relative; overflow:hidden; left:0; top:1;'> <a href='$g4[bbs_path]/search.php?sfl=wr_subject%7C%7Cwr_content&sop=and&gr_id=&stx=".urlencode($list[$i][pp_word])."'><font color=#15470a>".conv_subject(strip_tags(htmlspecialchars($list[$i][pp_word])),12,'')."</font></a></div><div id='OverListCnt'><span class='OverKeywordCnt'>{$list[$i][cnt]}</span>&nbsp;<img src='$g4[path]/img/rank/up.gif'></div></div>";
}
?>
		</div>
	</div>
	</div>
	</div>
</div>
<!-- 실시간 오버 END -->
	</div>
</div>