document.writeln("<div class=\"top\"><h1 class=\"l\"><a href=\"http://box.4399.com\" title=\"4399游戏盒，box.4399.com,最大最全的单机游戏基地！\"  target=\"_self\">4399游戏盒</a></h1>");
document.writeln("<div class=\"top_search r\">");
document.writeln("<form method='get' action=\"/search.php\" name='searchform' target=\"_blank\" onsubmit='return checksearchform()'>");
document.writeln("<input name=\"keyword\" type=\"text\" class=\"s3\" id=\"search_key\" value=\"搜索您想要的单机游戏...\" maxlength=\"20\"/><input type=\"submit\" class=\"s2\" value=\"游戏搜索\"/>");
document.writeln("<input type=\"hidden\" name=\"page\" value=0>");
document.writeln("</form>");
document.writeln("<div class=\"hot_search\"><strong>热门搜索：</strong><span id=\"hot_search\"></span></div>");
document.writeln("</div></div>");
var search_key = document.getElementById('search_key');
function setSearchInput(str)
{
	search_key.onfocus = function(){
	if( this.value == str )
	this.value = '';
}
search_key.onblur = function(){
	if( this.value == '' )
	this.value = str;
}
}
setSearchInput(search_key.value);
function checksearchform()
{
	var s_search_key = search_key.value;
	if(s_search_key =='' || s_search_key == ' ' || s_search_key =='搜索您想要的单机游戏...'){
		return false;
	}else{
		//window.open('./search.php?keyword='+encodeURI(s_search_key)+'&page=0','','');
		return true;
	}
}
function request_hot_search()
{
$.ajax({
type: "GET",
url: "http://"+window.location.host+"/api/ghome_api.php",
data: "do=gethotsearch",
dataType: "json",
cache:true,
success: function(data){
var s = '';
for(var i=0;i<data.length;i++)
{
s += '<a href="'+data[i].linkurl+'" title="'+data[i].linktitle+'" target="_blank">'+data[i].linktitle+'</a>';
}
$("#hot_search").html(s);
}
});
}
