dbData = new MakeArray(3);

function MM_preloadImages()
{
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore()
{
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d)
{
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage()
{
	var i,j = 0, x, a = MM_swapImage.arguments;
	document.MM_sr = new Array;
	for (i = 0; i < (a.length - 2); i += 3)
	if ((x = MM_findObj(a[i])) != null)
	{
		document.MM_sr[j++] = x;
		if(!x.oSrc) x.oSrc = x.src;
		x.src = a[i + 2];
	}
}

function openSitemap()
{
	sitemap_window = window.open('sitemap.html', 'sitemap_window', 'width=800,directories=0,location=0,menubar=0,scrollbars=1,status=0,toolbar=0,resizable=1');
	sitemap_window.focus();
}

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;
						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="img/search_line.gif" width="100%" height="9"></div>\n';
						break;
					}
				}
			}
		}
		if (found != 0)
		{
			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 url = docname + "/index.html?page=" + pagename + ".html";if (navigator.userAgent.indexOf("Win") > -1) url = url + "&search=" + search + "&mySearch=" + mySearch;if (navigator.userAgent.indexOf("Mac") > -1){window.opener.location = url;}else{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="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="img/bg04.gif">&nbsp;</td>\n<td width="196" height="30" background="img/bg04.gif"><img src="img/search_top.gif" width="212" height="30" alt="' + strSearchResult +'"></td>\n<td height="30" align="left" valign="middle" background="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);
}

