var topSearchAreaStr=""+
"		<div align=\"right\" id=\"topNowEntry\"><!-- topNowEntry --></div>\n"+
"		<div id=\"topSearchBox\">\n"+
"			<div id=\"topSearchSBox\" align=\"left\">\n"+
"				<form action=\"#\" id=\"topSearch\" name=\"topSearch\" style=\"margin:0; \" onSubmit=\"doWorkSearch(); return false;\" >\n"+
"				<div id=\"topSearchTxtArea\"><input type=\"text\" name=\"topSearch\" value=\"\" size=\"8\" id=\"searchField1\" style=\"font-size:10px; line-height:12px; width:140px; \" /></div>\n"+
"				<div id=\"topSearchBtn\"><input type=\"image\" src=\"img/top_img/top_searchBtn.jpg\" name=\"topSearch\" alt=\"検索\" align=\"left\" id=\"topSearch\" /></div>\n"+
"				</form>\n"+
"			</div>\n"+
"		</div>\n";
var worksAllCountStr = "現在&rArr;workCount作品";
var noWorksAllCountStr = "現在&rArr;11000作品越え!!";

function topAllWorksCount(){
	//データの取得
	httpRequest("data/getTopWorksAllCount.php", function( indata ){
			if( typeof(indata) == "object" || typeof(indata) != "string" ){
				indata = "";
			}
			if ( typeof(result) != "object" ){
				result = new Object();
			}
			var csv = indata.split( "\n" );
			var AreaStr = topSearchAreaStr;
			if ( csv[0] !== "Error" ){
					var worksCountStr = worksAllCountStr;
					worksCountStr = worksCountStr.replace(/workCount/,csv[0]);
			}else{
					worksCountStr = noWorksAllCountStr;
			}
			AreaStr = AreaStr.replace( /<!-- topNowEntry -->/, worksCountStr);
			if ( document.getElementById('topSearchBg') ){
					document.getElementById('topSearchBg').innerHTML = AreaStr;
			}
		}
	);
}

function doWorkSearch(){
	var searchText = "";
	if ( document.getElementById('searchField1')){
		searchText = document.getElementById('searchField1').value;
		if ( searchText != "" ) {
			jump( "a2.php?option=0&keyword="+encodeURIComponent(searchText) );
			
		}
		else{
			alert( "検索するテキストを入力してください。" );
		}
	}
}