dbData  = new MakeArray(3);
docName = new MakeArray(3);
for (var doc = 0; doc < docName.length; doc++) docName[doc] = new MakeArray(2);

function MakeArray(n)
{
	this.length = n;
	for (var i = 1; i <= n; i++) this[i] = 0;
	return this;
}

function dbName(title, tail, keywords)
{
	this.title    = title;
	this.tail     = tail;
	this.keywords = keywords;
}

function check(){
	if (event.keyCode == 13) keyword_searchall();
}

function clearAll(entry) {
	document.searchform.keyword.value = entry;
	document.searchform.keyword.focus();
}

function keyword_searchall() {
	var entry_org = document.searchform.keyword.value;
	var entry     = document.searchform.keyword.value.toLowerCase();
	var found     = 0;
	var result    = "";
	if (entry == "") {
		alert(strKeywordEmpty);
		clearAll(entry_org);
		document.searchform.keyword.focus();
	}
	else
	{
		for (var file = 0; file < 3; ++file)
		{
			if (dbData[file] != "") result = result + '<h1>' + docName[file][1] + '</h1>';
			for (var i = 0; i < dbData[file].length; i++)
			{
				var lengthA  = dbData[file][i].keywords.length;
				var lengthB  = entry.length;
				var thisData = dbData[file][i].keywords;
				for (var j = 0; j <= lengthA; j++) {
					if (entry == thisData.substring(j, j + lengthB))
					{
						++found;
						encoded = entry;

						var rgexp2 = new RegExp("\"", "g");
						encoded = encoded.replace(rgexp2, "&quot;");

//080528修正 検索入力枠にバックスラッシュが入力された時に備え、バックスラッシュをエスケープする処理を追加

						rgexp2 = new RegExp("\\\\", "g");
						encoded = encoded.replace(rgexp2, "\\\\");

						rgexp2 = new RegExp("'", "g");
						encoded = encoded.replace(rgexp2, "\\'");


						result += '<ol start="' + found + '">\n<li class="found"><a href="javascript:openDocsa(\'';
						result += docName[file][0] + "', '" + dbData[file][i].title + "', '" + encoded + "', '" + encoded;
						result += '\');">' + dbData[file][i].tail;
						result += '</li>\n</ol>\n<div><img src="' + extraPath + 'img/search_line.gif" width="100%" height="9"></div>\n';
						break;
					}
				}
			}
		}
		if (found != 0)

//080528修正 検索入力枠に入力された用語で、URLとして使えない文字は置換を行っていたが、
//バックスラッシュなどもまとめてURLにするため、encodeURIComponentを新たに採用

		{
			resultMsg = '<html>\n<head>\n<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n<meta http-equiv="Content-Style-Type" content="text/css">\n<meta http-equiv="Content-Script-Type" content="text/javascript">\n<script language="javascript" type="text/javascript">function openDocsa(docname, pagename, search, mySearch){var mySearch = encodeURIComponent(mySearch);var search = encodeURIComponent(search);var url =\'' + extraPath + '\' + docname + "/index.html?";if (pagename != "") url = url + "page=" + pagename + ".html&";url = url + "search=" + search + "&mySearch=" + mySearch;var iwidth = screen.availWidth;var iheight = screen.availHeight;var X = 0;var Y = 0;var W = 800;var H = iheight - 88;if (H >760 ) H=760;var style = "top="+Y+",left="+X+",screenX="+X+",screenY="+Y+",toolbar=1,scrollbars=1,menubar=1,resizable=1,width="+W+",height="+H;w = window.open(url,"star",style);}</script>\n<link rel="stylesheet" type="text/css" href="' + extraPath + 'css/search.css">\n<title>' + strSearchResult + '</title>\n</head>\n<body>\n<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">\n<tr>\n<td height="30" background="' + extraPath + 'img/bg04.gif">&nbsp;</td>\n<td width="196" height="30" background="' + extraPath + 'img/bg04.gif"><img src="' + extraPath + 'img/search_top.gif" width="212" height="30" alt="' + strSearchResult +'"></td>\n<td height="30" align="left" valign="middle" background="' + extraPath + 'img/bg04.gif">&nbsp;</td>\n</tr>\n</table>\n<div class="results">\n';
			resultMsg += result + "</div>\n</body>\n</html>";
			result_window = window.open('', 'result_window', 'width=450,height=500,directories=0,location=0,menubar=0,scrollbars=1,status=1,toolbar=0,resizable=1');
			result_window.document.open();
			result_window.document.write(resultMsg);
			result_window.document.close();
			result_window.focus();
		}
		else
		{
			alert(strNotFound)
			clearAll(entry);
			document.searchform.keyword.focus();
		}
	}
	return(0);
}
