var TITLEL_SEP = " &#62; ";
var catnames = ["コントロールリファレンス"];
var CAT_INDEX_CTRL = 0;

var DisplayCatSummary = 0;
var SearchMultiCats = 0;
var zoom_type = parseInt(getParam("zoom_type"));
if (isNaN(zoom_type)) zoom_type = -1;
var zoomcatEx = parseInt(getParam("zoom_catex"));
if (isNaN(zoomcatEx)) zoomcatEx = -1;

UseCats = 1;
NumCats = catnames.length;
DisplayScore = 0;

function ZoomSearch()
{
	var loadingmsg = document.getElementById("loadingmsg");
	if (loadingmsg) loadingmsg.style.display = "None";
	if(zoomcatEx == -1){
		ZoomInitSearch();
	}else{
		CtrolApiSearch(query, zoomcatEx, zoom_type);
		DisplayMetaDesc = 0;
	}
	ZoomShowSearchForm();
	ZoomShowHeading();
	ZoomShowSummary();
//	ZoomShowCatSummary();
	ZoomShowPagesCount();
	ZoomShowRecommended();
	ZoomShowSorting();
	ZoomShowResults();

	ZoomShowPageNumbersEx(zoomcatEx);

	ZoomShowSearchTime();
}

function ZoomShowCategories()
{
}

function ZoomInitSearch()
{
	// this prevents warnings given for calling this function when no results
	IsWarningGiven = true;

	if (Timing == 1)
		timeStart = new Date();

	InitSearchCalled = true;

	// Give up early if no search words provided
	IsNoKeywordQuery = false;
	if (query.length == 0)
	{
		if (UseMetaFields == 1)
		{
			if (IsZoomQuery == 1)
				IsNoKeywordQuery = true;
			else
				IsNoSearch = true;
		}
		else
			IsNoSearch = true;

		if (IsNoSearch)
			return;
	}

	if (MapAccents == 1)
	{
		for (i = 0; i < NormalChars.length; i++)
			query = query.replace(new RegExp(AccentChars[i], "g"), NormalChars[i]);
	}

	// Special query processing required when SearchAsSubstring is enabled
	if (SearchAsSubstring == 1 && UseUTF8 == 1)
		query = FixQueryForAsianWords(query);

	// prepare search query, strip quotes, trim whitespace
	if (WordJoinChars.indexOf(".") == -1)
		query = query.replace(/[\.]/g, " ");

	if (WordJoinChars.indexOf("-") == -1)
		query = query.replace(/(\S)\-/g, "$1 ");

	if (WordJoinChars.indexOf("#") == -1)
		query = query.replace(/\#(\S)/g, " $1");

	if (WordJoinChars.indexOf("+") == -1)
	{
		query = query.replace(/[\+]+([^\+\s])/g, " $1");
		query = query.replace(/([^\+\s])\+\s/g, "$1 ");
	}

	if (WordJoinChars.indexOf("_") == -1)
		query = query.replace(/[\_]/g, " ");

	if (WordJoinChars.indexOf("'") == -1)
		query = query.replace(/[\']/g, " ");

	if (WordJoinChars.indexOf("$") == -1)
		query = query.replace(/[\$]/g, " ");

	if (WordJoinChars.indexOf("&") == -1)
		query = query.replace(/[\&]/g, " ");

	if (WordJoinChars.indexOf(":") == -1)
	{		
		// We temporarily replace the search syntax for "site:" and "url:"
		// to avoid stripping it out when colon is disabled for word join
		query = query.replace(/site\:/g, "[#@!]");
		query = query.replace(/url\:/g, "[#@!]");
		query = query.replace(/[\:]/g, " ");
	
		// We then restore it
		query = query.replace(/\[\#\@\!\]/g, "site:");
		query = query.replace(/\[\#\@\!\]/g, "url:");		
	}

	if (WordJoinChars.indexOf(",") == -1)
		query = query.replace(/[\,]/g, " ");

	if (WordJoinChars.indexOf("/") == -1)
		query = query.replace(/[\/]/g, " ");

	if (WordJoinChars.indexOf("\\") == -1)
		query = query.replace(/[\\]/g, " ");
	
	if (WordJoinChars.indexOf("@") == -1)
		query = query.replace(/[@]/g, " ");		

	// substitute multiple whitespace chars to single character
	// also strip any of the wordjoinchars if followed immediately by a space
	query = query.replace(/[\s\(\)\^\[\]\|\{\}\%\!]+|[\-._',:&\/\\\\](\s|$)/g, " ");

	// trim trailing/leading whitespace
	query = query.replace(/^\s*|\s*$/g,"");

	queryForHTML = htmlspecialchars(query);
	if (ToLowerSearchWords == 1)
		queryForSearch = query.toLowerCase();
	else
		queryForSearch = query;
	queryForSearch = htmlspecialchars(queryForSearch);

	// split search phrase into words
	searchWords = queryForSearch.split(" "); // split by spaces.

	// Sort search words if there are negative signs
	if (queryForSearch.indexOf("-") != -1)
		searchWords.sort(sw_compare);

	NumSearchWords = searchWords.length;
	
	if (searchWords[0].length == 0)
		NumSearchWords = 0;		
		
	kw_ptr = 0;
	outputline = 0;
	ipage = 0;
	matches = 0;
	pagesCount = NumPages;

	exclude_count = 0;
	ExcludeTerm = 0;

	// Initialise a result table the size of all pages
	res_table = new Array(pagesCount);
	for (i = 0; i < pagesCount; i++)
	{
		res_table[i] = new Array(4);
		res_table[i][0] = 0;
		res_table[i][1] = 0;
		res_table[i][2] = 0;
		res_table[i][3] = 0;
	}

	UseWildCards = new Array(NumSearchWords);

	for (sw = 0; sw < NumSearchWords; sw++) {

		UseWildCards[sw] = 0;

		if (typeof(window['skipwords']) != "undefined" ) {
			// check min length
			if (searchWords[sw].length < MinWordLen) {
				SkipSearchWord(sw);
				continue;
			}
			// check skip word list
			for (i = 0; i < skipwords.length; i++) {
				if (searchWords[sw] == skipwords[i])
				{
					SkipSearchWord(sw);
					break;
				}
			}
		}

		if (searchWords[sw].indexOf("*") == -1 && searchWords[sw].indexOf("?") == -1) {
			UseWildCards[sw] = 0;
		} else {
			UseWildCards[sw] = 1;
			RegExpSearchWords[sw] = pattern2regexp(searchWords[sw]);
		}

		if (Highlighting == 1 && UseWildCards[sw] == 0)
			RegExpSearchWords[sw] = searchWords[sw];
	}
	
	// Join splitted up arrays if necessary
	if (DictArrayCount > 0)
	{
		for (dci = 0; dci < DictArrayCount; dci++)
			eval("dictwords = dictwords.concat(dictwords"+dci+");");
	}
	if (PageInfoArrayCount > 0)
	{
		for (dci = 0; dci < PageInfoArrayCount; dci++)
			eval("pageinfo = pageinfo.concat(pageinfo"+dci+");");
	}
	if (PageDataArrayCount > 0)
	{
		for (dci = 0; dci < PageDataArrayCount; dci++)
			eval("pagedata = pagedata.concat(pagedata"+dci+");");
	}

	// Join splitted up arrays if necessary
	if (DictArrayCount > 0)
	{
		for (dci = 0; dci < DictArrayCount; dci++)
			dictwords = dictwords.concat(window["dictwords"+dci]);
	}
	if (PageInfoArrayCount > 0)
	{
		for (dci = 0; dci < PageInfoArrayCount; dci++)
			pageinfo = pageinfo.concat(window["pageinfo"+dci]);
	}
	if (PageDataArrayCount > 0)
	{
		for (dci = 0; dci < PageDataArrayCount; dci++)
			pagedata = pagedata.concat(window["pagedata"+dci]);
	}
	
	searchUrlBuffer = "";

	// Begin searching...
	for (sw = 0; sw < NumSearchWords; sw++) {

		if (searchWords[sw] == "") {
			continue;
		}

		if (searchWords[sw].charAt(0) == '-')
		{
			searchWords[sw] = searchWords[sw].substr(1);
			ExcludeTerm = 1;
			exclude_count++;
		}
		
		colonPos = 0;
		if ((colonPos = searchWords[sw].indexOf(":")) > -1)
		{
			if (searchWords[sw].toLowerCase().indexOf("site:") != -1 || searchWords[sw].toLowerCase().indexOf("url:") != -1)
			{
				searchUrlBuffer = searchWords[sw].substring(colonPos+1);
				exclude_count++;
				if (NumSearchWords == 1)
				{
					IsNoKeywordQuery = true;
					continue;
				}
			}			
		}
		
		if (UseWildCards[sw] == 1) {
			if (SearchAsSubstring == 0)
				pattern = "^" + RegExpSearchWords[sw] + "$";
			else
				pattern = RegExpSearchWords[sw];
			re = new RegExp(pattern, "g");
		}

		for (kw_ptr = 0; kw_ptr < dictwords.length; kw_ptr++) {

			data = dictwords[kw_ptr].split(" ");

			if (UseWildCards[sw] == 0) {
				if (SearchAsSubstring == 0)
					match_result = wordcasecmp(data[0], searchWords[sw]);
				else
					match_result = data[0].indexOf(searchWords[sw]);
			} else
				match_result = data[0].search(re);


			if (match_result != -1) {
				// keyword found, include it in the output list
				for (kw = 1; kw < data.length; kw += 3) {
					// check if page is already in output list
					pageexists = 0;
					ipage = data[kw];
					score = parseInt(data[kw+1]);
					prox = parseInt(data[kw+2]);

					if (pageinfo[ipage][PAGEINFO_BOOST] != 0)
					{
						score *= (pageinfo[ipage][PAGEINFO_BOOST] / 10);
						score = Math.floor(score + 0.5);
					}

					if (ExcludeTerm == 1)
					{
						// we clear out the score entry so that it'll be excluded in the filter stage
						res_table[ipage][0] = 0;
					}
					else if (res_table[ipage][0] == 0)
					{
						matches++;
						res_table[ipage][0] = score;
						res_table[ipage][3] = prox;
					}
					else
					{
						if (res_table[ipage][0] > 10000) {
							// take it easy if its too big to prevent gigantic scores
							res_table[ipage][0] += 1;
						} else {
							res_table[ipage][0] += score; // add in score
							//res_table[ipage][0] *= 2;           // double score as we have two words matching
						}
						res_table[ipage][3] &= prox;
					}
					res_table[ipage][1] += 1;
					// store the 'and' user search terms matched' value
					if (res_table[ipage][2] == sw || res_table[ipage][2] == sw-SkippedWords-exclude_count)
						res_table[ipage][2] += 1;

				}
				if (UseWildCards[sw] == 0 && SearchAsSubstring == 0)
					break;    // this search word was found, so skip to next
			}
		}
	}

	// Count number of output lines that match ALL search terms
	oline = 0;
	fullmatches = 0;
	output = new Array();
	if (UseCats == 1 && DisplayCatSummary == 1)
	{
		if (cat[0] == -1 || num_zoom_cats > 1)
		{
			for (cati = 0; cati < NumCats; cati++)
				CatCounter[cati] = 0;
		}
		else
			DisplayCatSummary = 0;
	}
		
	var UseDateRange = false;
	if (DateRangeSearch == 1)
	{				
		if (date_from.length > 0 && date_to.length > 0)
		{			
			var fromArray = date_from.split("/");
			var toArray = date_to.split("/");
			if (fromArray.length == 3 && toArray.length == 3)
			{
				var tmpFromDate, tmpToDate;
				if (DateRangeFormat == 1)
				{
					tmpFromDate = new Date(fromArray[2], fromArray[0]-1, fromArray[1], 0, 0, 0, 0);
					tmpToDate = new Date(toArray[2], toArray[0]-1, toArray[1], 23, 59, 59, 59);
				}
				else
				{
					tmpFromDate = new Date(fromArray[2], fromArray[1]-1, fromArray[0], 0 , 0, 0, 0);
					tmpToDate = new Date(toArray[2], toArray[1]-1, toArray[0], 23, 59, 59, 999);
				}								
				var from_datetime = tmpFromDate.getTime()/1000;
				var to_datetime = tmpToDate.getTime()/1000;
				if (from_datetime >= 0 && to_datetime > 0)
				{
					UseDateRange = true;
					dateRangeParams = "&amp;zoom_datefrom=" + htmlspecialchars(date_from) + "&amp;zoom_dateto=" + htmlspecialchars(date_to);
				}
			}
		}	
	}

	var IsAnyDropdown = false;
	var full_numwords = NumSearchWords - SkippedWords - exclude_count;
	for (i = 0; i < pageinfo.length; i++)
	{
		IsFiltered = false;
		if (res_table[i][0] > 0 || IsNoKeywordQuery)
		{
			if (IsFiltered == false && searchUrlBuffer != "")
			{
				pgurl = pagedata[i][PAGEDATA_URL];
				if (pgurl.toLowerCase().indexOf(searchUrlBuffer) == -1)
					IsFiltered = true;
				else
				{
					// the site/URL matched with the site: parameter
					if (IsNoKeywordQuery)
					{
						// increment score/terms if we're allowing this through on site: match alone
						res_table[i][0]++;
						res_table[i][1]++;						
					}
				}					
			}			
			
			if (UseMetaFields && IsFiltered == false)
			{
				for (fieldnum = 0; fieldnum < NumMetaFields && !IsFiltered; fieldnum++)
				{
					IsAnyDropdown = false;
					if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_DROPDOWN ||
						metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_MULTI)
					{
						if (meta_query[fieldnum] == -1)
							IsAnyDropdown = true;
					}

					if (meta_query[fieldnum] !== "" && IsAnyDropdown == false)
					{
						if (GetMetaValues(i, fieldnum) == null)
							IsFiltered = true;
						else if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_TEXT)
						{
							if (metafields[fieldnum][METAFIELD_METHOD] == METAFIELD_METHOD_SUBSTRING)
							{															
								if (GetMetaValues(i, fieldnum).toLowerCase().indexOf(meta_query[fieldnum].toLowerCase()) == -1)
									IsFiltered = true;
							}
							else
							{
								if (wordcasecmp(GetMetaValues(i, fieldnum).toLowerCase(), meta_query[fieldnum].toLowerCase()) == -1)
									IsFiltered = true;
							}
						}						
						else if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_DROPDOWN)
						{
							if (GetMetaValues(i, fieldnum) != meta_query[fieldnum])
								IsFiltered = true;
						}
						else if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_MULTI)
						{
							IsFiltered = true;
							var metaVal = GetMetaValues(i, fieldnum);
							if (metaVal.length > 0)
							{
								for (mqi = 0; mqi < meta_query[fieldnum].length && IsFiltered; mqi++)
								{
									for (mvi = 0; mvi < metaVal.length; mvi++)
									{
										if (metaVal[mvi] == meta_query[fieldnum][mqi])
										{
											IsFiltered = false;
											break;
										}
									}
								}
							}
						}
						else
						{
							var tmpQueryVal = meta_query[fieldnum];

							// we do this here to avoid changing meta_query for displaying
							if (UseMetaFields == 1 && MetaMoneyShowDec == 1 && metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_MONEY)
								tmpQueryVal = tmpQueryVal * 100;

							// numeric comparison here
							if (metafields[fieldnum][METAFIELD_METHOD] == METAFIELD_METHOD_LESSTHAN)
							{
								bRet = GetMetaValues(i, fieldnum) < tmpQueryVal;
							}
							else if (metafields[fieldnum][METAFIELD_METHOD] == METAFIELD_METHOD_LESSTHANORE)
							{
								bRet = GetMetaValues(i, fieldnum) <= tmpQueryVal;
							}
							else if (metafields[fieldnum][METAFIELD_METHOD] == METAFIELD_METHOD_GREATERTHAN)
							{
								bRet = GetMetaValues(i, fieldnum) > tmpQueryVal;
							}
							else if (metafields[fieldnum][METAFIELD_METHOD] == METAFIELD_METHOD_GREATERTHANORE)
							{
								bRet = GetMetaValues(i, fieldnum) >= tmpQueryVal;
							}
							else
							{
								// exact match
								bRet = GetMetaValues(i, fieldnum) == tmpQueryVal;
							}

							if (bRet == false)
								IsFiltered = true;
						}
					}
				}
				// only add to res_table if empty query!
				if (IsNoKeywordQuery == true && IsFiltered == false)
				{
					res_table[i][0]++;
					res_table[i][1]++;
				}
			}
			if (IsFiltered == false) {
				if (res_table[i][2] < full_numwords && andq == 1)
					IsFiltered = true;
			}
			
			if (UseCats && cat[0] != -1 && IsFiltered == false) {
				// using cats and not doing an "all cats" search
				if (SearchMultiCats) {
					var bFoundCat = false;
					for (cati = 0; cati < num_zoom_cats; cati++) {
						if (pageinfo[i][PAGEINFO_CAT].charAt(cat[cati]) == "1")
						{
							if (DisplayCatSummary == 1)
							{
								CatCounter[cat[cati]]++;
								CatCounterFilled = 1;
							}
							bFoundCat = true;
						}
					}
					if (bFoundCat == false)
						IsFiltered = true;
				}
				else {
					var catname = new String(catnames[cat[0]]);
					var pagecat = pagedata[i][PAGEDATA_TITLE];
					
//					if (pageinfo[i][PAGEINFO_CAT] != null && pageinfo[i][PAGEINFO_CAT].charAt(cat[0]) == "0") {
//						IsFiltered = true;
//					}
					if(pagecat.indexOf(catname) != 0){
						IsFiltered = true;
					}
				}
			}
						
			if (IsFiltered == false && DateRangeSearch == 1 && UseDateRange == true)
			{
				if (pageinfo[i][PAGEINFO_DATETIME] < from_datetime)
					IsFiltered = true;
				else if (pageinfo[i][PAGEINFO_DATETIME] > to_datetime)
					IsFiltered = true;				
			}
			
			if (IsFiltered == false) {
				
				if (res_table[i][2] >= full_numwords)
					fullmatches++;
					
				// copy if not filtered out
				output[oline] = new Array(3);
				output[oline][0] = i;

				// determine final score
				baseScale = 1.3;
				finalScale = ((res_table[i][3] / 255) * 1.7) + baseScale;
				if (res_table[i][1] > 1)
				{
					if (res_table[i][1] <= 10)
						finalScale = Math.pow(finalScale, res_table[i][1]-1);
					else
					{
						finalScale = Math.pow(finalScale, 10);
						finalScale += res_table[i][1] - 10;
					}
				}

				if (UseCats == 1 && DisplayCatSummary == 1 && cat[0] == -1)
				{
					// if we are doing an All category search AND we're showing cat summary
					if (pageinfo[i][PAGEINFO_CAT] != null)
					{
						for (cati = 0; cati < NumCats; cati++)
						{
							if (pageinfo[i][PAGEINFO_CAT].charAt(cati) == "1")
							{
								CatCounter[cati]++;
								CatCounterFilled = 1;
							}
						}
					}
				}

				output[oline][1] = Math.floor(res_table[i][0] * finalScale + 0.5);
				output[oline][2] = res_table[i][1];
				oline++;
			}
		}
	}
	matches = oline;

	// Sort results in order of score, use "SortCompare" function
	if (matches > 1)
	{
		if (UseDateTime == 1 && sort == 1)
			output.sort(SortByDate);    // sort by date
		else if (UseDateTime == 1 && sort == 2)
			output.sort(SortByDateAsc);    // sort by date ascending
		else
			output.sort(SortCompare);   // sort by relevance
	}

	// prepare queryForURL
	if (UseUTF8 == 1 && self.encodeURIComponent)
	{
		queryForURL = encodeURIComponent(query);		
		queryForURL = queryForURL.replace(/%20/g, "+");
	}
	else
	{	
		queryForURL = query.replace(/\s/g, "+");	
		queryForURL = escape(queryForURL);
	}

	metaParams = "";
	if (UseMetaFields == 1)
	{
		for (fieldnum = 0; fieldnum < NumMetaFields; fieldnum++)
		{
			if (meta_query[fieldnum] != "")
				metaParams = metaParams+"&amp;"+metafields[fieldnum][METAFIELD_NAME]+"="+meta_query[fieldnum];
		}
	}

	if (Timing == 1)
	{
		timeEnd = new Date();
		timeDifference = timeEnd - timeStart;
	}

	// number of pages of results
	num_pages = Math.ceil(matches / per_page);
}


function ZoomShowHeading()
{
	if (InitSearchCalled == false)
	{
		if (IsWarningGiven == false)
			document.writeln("<div class=\"results\">This is an advanced template option. You must call ZoomInitSearch() before this. Please check documentation for more help.</div>");
		IsWarningGiven = true;
		return;
	}
	if (IsNoSearch)
		return;


	document.write("<div class=\"searchheading\">" + STR_RESULTS_FOR + " " + queryForHTML);

	document.writeln("<br /><br /></div>");
}

function ZoomShowResults()
{
	if (InitSearchCalled == false)
	{
		if (IsWarningGiven == false)
			document.writeln("<div class=\"results\">This is an advanced template option. You must call ZoomInitSearch() before this. Please check documentation for more help.</div>");
		IsWarningGiven = true;
		return;
	}
	if (IsNoSearch)
	{
		return;
	}

	document.writeln("<div class=\"results\">");
	// determine current line of result from the output array
	if (page == 1) {
		arrayline = 0;
	} else {
		arrayline = ((page - 1) * per_page);
	}

	// the last result to show on this page
	result_limit = arrayline + per_page;

	// display the results
	while (arrayline < matches && arrayline < result_limit) {
		ipage = output[arrayline][0];
		score = output[arrayline][1];

		pgurl = pagedata[ipage][PAGEDATA_URL];
		pgtitle = pagedata[ipage][PAGEDATA_TITLE];
		pgdesc = pagedata[ipage][PAGEDATA_DESC];
		pgimage = pagedata[ipage][PAGEDATA_IMG];

		urlLink = pgurl;
		if (GotoHighlight == 1)
		{
			if (SearchAsSubstring == 1)
				urlLink = AddParamToURL(urlLink, "zoom_highlightsub=" + queryForURL);
			else
				urlLink = AddParamToURL(urlLink, "zoom_highlight=" + queryForURL);
		}
		if (PdfHighlight == 1)
		{
			if (urlLink.toLowerCase().indexOf(".pdf") != -1)
				urlLink = urlLink+"#search=%22"+query+"%22";
		}

		if (arrayline % 2 == 0)
			document.writeln("<div class=\"result_block\">");
		else
			document.writeln("<div class=\"result_altblock\">");

		if (PluginOpenNewWindow == 1 && pageinfo[ipage][PAGEINFO_FILETYPE] >= FileTypePluginStart)
			target = " target=\"_blank\"";
		else
			target = zoom_target;

		if (UseZoomImage == 1)
		{
			if (pgimage.length > 1)
			{
				document.writeln("<div class=\"result_image\">");
				document.writeln("<a href=\"" + urlLink + "\"" + target + "><img src=\"" + pgimage + "\" alt=\"\" class=\"result_image\" /></a>");
				document.writeln("</div>");
			}
		}

		document.writeln("<div class=\"result_title\">");
		if (DisplayNumber == 1)
			document.writeln("<b>" + (arrayline+1) + ".</b>&nbsp;");

		if (DisplayTitle == 1)
		{
			document.writeln("<a href=\"" + urlLink + "\"" + target + ">");
			PrintHighlightDescription(pgtitle);
			document.writeln("</a>");
		}
		else
			document.writeln("<a href=\"" + urlLink + "\"" + target + ">" + pgurl + "</a>");


		document.writeln("</div>");

		if (UseMetaFields == 1 && DisplayMetaFields == 1)
		{
			var cssFieldName, cssValueName;
			for (fieldnum = 0; fieldnum < NumMetaFields; fieldnum++)
			{
				cssFieldName = "result_metaname_" + metafields[fieldnum][METAFIELD_NAME];
				cssValueName = "result_metavalue_" + metafields[fieldnum][METAFIELD_NAME];
				if (GetMetaValues(ipage, fieldnum) != null)
				{
					if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_DROPDOWN)
					{
						document.writeln("<div class =\"result_custommeta\">");
						document.writeln("<span class=\""+cssFieldName+"\">"+metafields[fieldnum][METAFIELD_SHOW]+": </span>");
						document.write("<span class=\""+cssValueName+"\">");
						var ddi = GetMetaValues(ipage, fieldnum);
						document.writeln(metafields[fieldnum][METAFIELD_DROPDOWN][ddi]+"</span></div>");
					}
					else if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_MULTI)
					{
						var metaVal = GetMetaValues(ipage,fieldnum);
						if (metaVal.length > 0)
						{
							document.writeln("<div class =\"result_custommeta\">");
							document.writeln("<span class=\""+cssFieldName+"\">"+metafields[fieldnum][METAFIELD_SHOW]+": </span>");
							document.write("<span class=\""+cssValueName+"\">");
							var ddarray = metafields[fieldnum][METAFIELD_DROPDOWN];
							for (mvi = 0; mvi < metaVal.length; mvi++)
							{
								if (mvi > 0)
									document.write(", ");
								document.write(ddarray[metaVal[mvi]]);
							}
							document.write("</span></div>");
						}
					}
					else if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_MONEY)
					{
						document.writeln("<div class =\"result_custommeta\">");
						document.writeln("<span class=\""+cssFieldName+"\">"+metafields[fieldnum][METAFIELD_SHOW]+": </span>");
						var tmpMoneyStr = "";
						if (MetaMoneyShowDec == 1)
							tmpMoneyStr = (GetMetaValues(ipage, fieldnum)/100).toFixed(2);
						else
							tmpMoneyStr = GetMetaValues(ipage, fieldnum);
						document.writeln("<span class=\""+cssValueName+"\">"+MetaMoneyCurrency+tmpMoneyStr+"</span></div>");
					}
					else
					{
						document.writeln("<div class =\"result_custommeta\">");
						document.writeln("<span class=\""+cssFieldName+"\">"+metafields[fieldnum][METAFIELD_SHOW]+": </span>");
						document.writeln("<span class=\""+cssValueName+"\">"+GetMetaValues(ipage, fieldnum)+"</span></div>");
					}
				}
			}
		}

		if (DisplayMetaDesc == 1)
		{
			// print meta description
			document.writeln("<div class=\"description\">");
			PrintHighlightDescription(pgdesc);
			document.writeln("</div>\n");
		}

		info_str = "";

		if (DisplayTerms == 1)
			info_str += STR_RESULT_TERMS_MATCHED + " " + output[arrayline][2];

		if (DisplayScore == 1) {
			if (info_str.length > 0)
				info_str += "&nbsp; - &nbsp;";
			info_str += STR_RESULT_SCORE + " " + score;
		}

		if (DisplayDate == 1)
		{
			pgdate = pageinfo[ipage][PAGEINFO_DATETIME];
			if (pgdate > 0)
			{
				datetime = new Date(pgdate*1000);
				if (info_str.length > 0)
					info_str += "&nbsp; - &nbsp;";
				info_str += datetime.getDate() + " " + months[datetime.getMonth()] + " " + datetime.getFullYear();
			}
		}

		if (DisplayFilesize == 1)
		{
			filesize = pageinfo[ipage][PAGEINFO_FILESIZE];
			filesize = Math.ceil(filesize / 1024);
			if (filesize < 1)
				filesize = 1;

			if (info_str.length > 0)
				info_str += "&nbsp; - &nbsp;";
			info_str += filesize + "k";
		}

		if (DisplayURL == 1) {
			if (info_str.length > 0)
				info_str += "&nbsp; - &nbsp;";
			if (TruncateShowURL > 0)
			{
				if (pgurl.length > TruncateShowURL)
					pgurl = pgurl.substr(0, TruncateShowURL) + "...";
			}
			info_str += STR_RESULT_URL + " " + pgurl;
		}

		document.writeln("<div class=\"infoline\">");
		document.writeln(info_str);
		document.writeln("</div></div>\n");
		arrayline++;
	}
	document.writeln("</div>"); // end results style tag
}



//-------------------------------------------------------------------------------------------------------------------------------------------------
// control api のみの検索 タイトルマッチ
function CtrolApiSearch(key, cat, type)
{
	num_zoom_cats = 1;
	IsWarningGiven = true;
	InitSearchCalled = true;

	// Give up early if no search words provided
	IsNoKeywordQuery = false;

	if (MapAccents == 1)
	{
		for (i = 0; i < NormalChars.length; i++)
			query = key.replace(new RegExp(AccentChars[i], "g"), NormalChars[i]);
	}

	// Special query processing required when SearchAsSubstring is enabled
	if (SearchAsSubstring == 1 && UseUTF8 == 1)
		query = FixQueryForAsianWords(query);

	// prepare search query, strip quotes, trim whitespace
	if (WordJoinChars.indexOf(".") == -1)
		query = query.replace(/[\.]/g, " ");

	if (WordJoinChars.indexOf("-") == -1)
		query = query.replace(/(\S)\-/g, "$1 ");

	if (WordJoinChars.indexOf("#") == -1)
		query = query.replace(/\#(\S)/g, " $1");

	if (WordJoinChars.indexOf("+") == -1)
	{
		query = query.replace(/[\+]+([^\+\s])/g, " $1");
		query = query.replace(/([^\+\s])\+\s/g, "$1 ");
	}

	if (WordJoinChars.indexOf("_") == -1)
		query = query.replace(/[\_]/g, " ");

	if (WordJoinChars.indexOf("'") == -1)
		query = query.replace(/[\']/g, " ");

	if (WordJoinChars.indexOf("$") == -1)
		query = query.replace(/[\$]/g, " ");

	if (WordJoinChars.indexOf("&") == -1)
		query = query.replace(/[\&]/g, " ");

	if (WordJoinChars.indexOf(":") == -1)
	{		
		// We temporarily replace the search syntax for "site:" and "url:"
		// to avoid stripping it out when colon is disabled for word join
		query = query.replace(/site\:/g, "[#@!]");
		query = query.replace(/url\:/g, "[#@!]");
		query = query.replace(/[\:]/g, " ");
	
		// We then restore it
		query = query.replace(/\[\#\@\!\]/g, "site:");
		query = query.replace(/\[\#\@\!\]/g, "url:");		
	}

	if (WordJoinChars.indexOf(",") == -1)
		query = query.replace(/[\,]/g, " ");

	if (WordJoinChars.indexOf("/") == -1)
		query = query.replace(/[\/]/g, " ");

	if (WordJoinChars.indexOf("\\") == -1)
		query = query.replace(/[\\]/g, " ");
	
	if (WordJoinChars.indexOf("@") == -1)
		query = query.replace(/[@]/g, " ");		

	// substitute multiple whitespace chars to single character
	// also strip any of the wordjoinchars if followed immediately by a space
	query = query.replace(/[\s\(\)\^\[\]\|\{\}\%\!]+|[\-._',:&\/\\\\](\s|$)/g, " ");

	// trim trailing/leading whitespace
	query = query.replace(/^\s*|\s*$/g,"");

	queryForHTML = htmlspecialchars(query);
	if (ToLowerSearchWords == 1)
		queryForSearch = query.toLowerCase();
	else
		queryForSearch = query;
	queryForSearch = htmlspecialchars(queryForSearch);

	// split search phrase into words
	searchWords = queryForSearch.split(" "); // split by spaces.

	// Sort search words if there are negative signs
	if (queryForSearch.indexOf("-") != -1)
		searchWords.sort(sw_compare);

	NumSearchWords = searchWords.length;
	
	if (searchWords[0].length == 0)
		NumSearchWords = 0;		
		
	kw_ptr = 0;
	outputline = 0;
	ipage = 0;
	matches = 0;
	pagesCount = NumPages;

	exclude_count = 0;
	ExcludeTerm = 0;

	// Initialise a result table the size of all pages
	res_table = new Array(pagesCount);
	for (i = 0; i < pagesCount; i++)
	{
		res_table[i] = new Array(4);
		res_table[i][0] = 0;
		res_table[i][1] = 0;
		res_table[i][2] = 0;
		res_table[i][3] = 0;
	}

	UseWildCards = new Array(NumSearchWords);

	for (sw = 0; sw < NumSearchWords; sw++) {

		UseWildCards[sw] = 0;

		if (typeof(window['skipwords']) != "undefined" ) {
			// check min length
			if (searchWords[sw].length < MinWordLen) {
				SkipSearchWord(sw);
				continue;
			}
			// check skip word list
			for (i = 0; i < skipwords.length; i++) {
				if (searchWords[sw] == skipwords[i])
				{
					SkipSearchWord(sw);
					break;
				}
			}
		}

		if (searchWords[sw].indexOf("*") == -1 && searchWords[sw].indexOf("?") == -1) {
			UseWildCards[sw] = 0;
		} else {
			UseWildCards[sw] = 1;
			RegExpSearchWords[sw] = pattern2regexp(searchWords[sw]);
		}

		if (Highlighting == 1 && UseWildCards[sw] == 0)
			RegExpSearchWords[sw] = searchWords[sw];
	}
	
	// Join splitted up arrays if necessary
	if (DictArrayCount > 0)
	{
		for (dci = 0; dci < DictArrayCount; dci++)
			eval("dictwords = dictwords.concat(dictwords"+dci+");");
	}
	if (PageInfoArrayCount > 0)
	{
		for (dci = 0; dci < PageInfoArrayCount; dci++)
			eval("pageinfo = pageinfo.concat(pageinfo"+dci+");");
	}
	if (PageDataArrayCount > 0)
	{
		for (dci = 0; dci < PageDataArrayCount; dci++)
			eval("pagedata = pagedata.concat(pagedata"+dci+");");
	}

	// Join splitted up arrays if necessary
	if (DictArrayCount > 0)
	{
		for (dci = 0; dci < DictArrayCount; dci++)
			dictwords = dictwords.concat(window["dictwords"+dci]);
	}
	if (PageInfoArrayCount > 0)
	{
		for (dci = 0; dci < PageInfoArrayCount; dci++)
			pageinfo = pageinfo.concat(window["pageinfo"+dci]);
	}
	if (PageDataArrayCount > 0)
	{
		for (dci = 0; dci < PageDataArrayCount; dci++)
			pagedata = pagedata.concat(window["pagedata"+dci]);
	}
	
	searchUrlBuffer = "";
	// Begin searching...

	for (sw = 0; sw < NumSearchWords; sw++) {

		if (searchWords[sw] == "") {
			continue;
		}

		if (searchWords[sw].charAt(0) == '-')
		{
			searchWords[sw] = searchWords[sw].substr(1);
			ExcludeTerm = 1;
			exclude_count++;
		}
		
		colonPos = 0;
		if ((colonPos = searchWords[sw].indexOf(":")) > -1)
		{
			if (searchWords[sw].toLowerCase().indexOf("site:") != -1 || searchWords[sw].toLowerCase().indexOf("url:") != -1)
			{
				searchUrlBuffer = searchWords[sw].substring(colonPos+1);
				exclude_count++;
				if (NumSearchWords == 1)
				{
					IsNoKeywordQuery = true;
					continue;
				}
			}			
		}
		if (UseWildCards[sw] == 1) {
			if (SearchAsSubstring == 0)
				pattern = "^" + RegExpSearchWords[sw] + "$";
			else
				pattern = RegExpSearchWords[sw];
			re = new RegExp(pattern, "g");
		}

		for (kw_ptr = 0; kw_ptr < dictwords.length; kw_ptr++) {

			data = dictwords[kw_ptr].split(" ");

			if (UseWildCards[sw] == 0) {
				if (SearchAsSubstring == 0)
					match_result = wordcasecmp(data[0], searchWords[sw]);
				else
					match_result = data[0].indexOf(searchWords[sw]);
			} else
				match_result = data[0].search(re);

			if (match_result != -1) {
				// keyword found, include it in the output list
				for (kw = 1; kw < data.length; kw += 3) {
					// check if page is already in output list
					pageexists = 0;
					ipage = data[kw];
					score = parseInt(data[kw+1]);
					prox = parseInt(data[kw+2]);

					if (pageinfo[ipage][PAGEINFO_BOOST] != 0)
					{
						score *= (pageinfo[ipage][PAGEINFO_BOOST] / 10);
						score = Math.floor(score + 0.5);
					}

					if (ExcludeTerm == 1)
					{
						// we clear out the score entry so that it'll be excluded in the filter stage
						res_table[ipage][0] = 0;
					}
					else if (res_table[ipage][0] == 0)
					{
						matches++;
						res_table[ipage][0] = score;
						res_table[ipage][3] = prox;
					}
					else
					{
						if (res_table[ipage][0] > 10000) {
							// take it easy if its too big to prevent gigantic scores
							res_table[ipage][0] += 1;
						} else {
							res_table[ipage][0] += score; // add in score
							//res_table[ipage][0] *= 2;           // double score as we have two words matching
						}
						res_table[ipage][3] &= prox;
					}
					res_table[ipage][1] += 1;
					// store the 'and' user search terms matched' value
					if (res_table[ipage][2] == sw || res_table[ipage][2] == sw-SkippedWords-exclude_count)
						res_table[ipage][2] += 1;

				}
				if (UseWildCards[sw] == 0 && SearchAsSubstring == 0)
					break;    // this search word was found, so skip to next
			}
		}
	}

	// Count number of output lines that match ALL search terms
	oline = 0;
	fullmatches = 0;
	output = new Array();
	if (UseCats == 1 && DisplayCatSummary == 1)
	{
		DisplayCatSummary = 0;
	}
		
	var UseDateRange = false;
	if (DateRangeSearch == 1)
	{				
		if (date_from.length > 0 && date_to.length > 0)
		{			
			var fromArray = date_from.split("/");
			var toArray = date_to.split("/");
			if (fromArray.length == 3 && toArray.length == 3)
			{
				var tmpFromDate, tmpToDate;
				if (DateRangeFormat == 1)
				{
					tmpFromDate = new Date(fromArray[2], fromArray[0]-1, fromArray[1], 0, 0, 0, 0);
					tmpToDate = new Date(toArray[2], toArray[0]-1, toArray[1], 23, 59, 59, 59);
				}
				else
				{
					tmpFromDate = new Date(fromArray[2], fromArray[1]-1, fromArray[0], 0 , 0, 0, 0);
					tmpToDate = new Date(toArray[2], toArray[1]-1, toArray[0], 23, 59, 59, 999);
				}								
				var from_datetime = tmpFromDate.getTime()/1000;
				var to_datetime = tmpToDate.getTime()/1000;
				if (from_datetime >= 0 && to_datetime > 0)
				{
					UseDateRange = true;
					dateRangeParams = "&amp;zoom_datefrom=" + htmlspecialchars(date_from) + "&amp;zoom_dateto=" + htmlspecialchars(date_to);
				}
			}
		}	
	}

	var IsAnyDropdown = false;
	var full_numwords = NumSearchWords - SkippedWords - exclude_count;
	for (i = 0; i < pageinfo.length; i++)
	{
		IsFiltered = false;
		if (res_table[i][0] > 0 || IsNoKeywordQuery)
		{
			if (IsFiltered == false && searchUrlBuffer != "")
			{
				pgurl = pagedata[i][PAGEDATA_URL];
				if (pgurl.toLowerCase().indexOf(searchUrlBuffer) == -1)
					IsFiltered = true;
				else
				{
					// the site/URL matched with the site: parameter
					if (IsNoKeywordQuery)
					{
						// increment score/terms if we're allowing this through on site: match alone
						res_table[i][0]++;
						res_table[i][1]++;
					}
				}					
			}			
			
			if (UseMetaFields && IsFiltered == false)
			{
				for (fieldnum = 0; fieldnum < NumMetaFields && !IsFiltered; fieldnum++)
				{
					IsAnyDropdown = false;
					if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_DROPDOWN ||
						metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_MULTI)
					{
						if (meta_query[fieldnum] == -1)
							IsAnyDropdown = true;
					}

					if (meta_query[fieldnum] !== "" && IsAnyDropdown == false)
					{
						if (GetMetaValues(i, fieldnum) == null)
							IsFiltered = true;
						else if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_TEXT)
						{
							if (metafields[fieldnum][METAFIELD_METHOD] == METAFIELD_METHOD_SUBSTRING)
							{															
								if (GetMetaValues(i, fieldnum).toLowerCase().indexOf(meta_query[fieldnum].toLowerCase()) == -1)
									IsFiltered = true;
							}
							else
							{
								if (wordcasecmp(GetMetaValues(i, fieldnum).toLowerCase(), meta_query[fieldnum].toLowerCase()) == -1)
									IsFiltered = true;
							}
						}						
						else if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_DROPDOWN)
						{
							if (GetMetaValues(i, fieldnum) != meta_query[fieldnum])
								IsFiltered = true;
						}
						else if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_MULTI)
						{
							IsFiltered = true;
							var metaVal = GetMetaValues(i, fieldnum);
							if (metaVal.length > 0)
							{
								for (mqi = 0; mqi < meta_query[fieldnum].length && IsFiltered; mqi++)
								{
									for (mvi = 0; mvi < metaVal.length; mvi++)
									{
										if (metaVal[mvi] == meta_query[fieldnum][mqi])
										{
											IsFiltered = false;
											break;
										}
									}
								}
							}
						}
						else
						{
							var tmpQueryVal = meta_query[fieldnum];

							// we do this here to avoid changing meta_query for displaying
							if (UseMetaFields == 1 && MetaMoneyShowDec == 1 && metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_MONEY)
								tmpQueryVal = tmpQueryVal * 100;

							// numeric comparison here
							if (metafields[fieldnum][METAFIELD_METHOD] == METAFIELD_METHOD_LESSTHAN)
							{
								bRet = GetMetaValues(i, fieldnum) < tmpQueryVal;
							}
							else if (metafields[fieldnum][METAFIELD_METHOD] == METAFIELD_METHOD_LESSTHANORE)
							{
								bRet = GetMetaValues(i, fieldnum) <= tmpQueryVal;
							}
							else if (metafields[fieldnum][METAFIELD_METHOD] == METAFIELD_METHOD_GREATERTHAN)
							{
								bRet = GetMetaValues(i, fieldnum) > tmpQueryVal;
							}
							else if (metafields[fieldnum][METAFIELD_METHOD] == METAFIELD_METHOD_GREATERTHANORE)
							{
								bRet = GetMetaValues(i, fieldnum) >= tmpQueryVal;
							}
							else
							{
								// exact match
								bRet = GetMetaValues(i, fieldnum) == tmpQueryVal;
							}

							if (bRet == false)
								IsFiltered = true;
						}
					}
				}
				// only add to res_table if empty query!
				if (IsNoKeywordQuery == true && IsFiltered == false)
				{
					res_table[i][0]++;
					res_table[i][1]++;
				}
			}
			if (IsFiltered == false) {
				if (res_table[i][2] < full_numwords && andq == 1)
					IsFiltered = true;
			}
			
//			if (UseCats && cat != -1 && IsFiltered == false) {
				var catname = new String(catnames[cat]);
				var pagecat = pagedata[i][PAGEDATA_TITLE];
				if(type == 1){
					var pagecats = pagecat.split(TITLEL_SEP);
					var pageTitle = pagecats[pagecats.length - 1];
					if(pagecat.indexOf(catname) == -1 || pageTitle.toLowerCase() != query.toLowerCase()){
						IsFiltered = true;
					}
				}else{
					if(cat != -1 && pagecat.indexOf(catname) == -1){
						IsFiltered = true;
					}
				}
//			}
			if (IsFiltered == false && DateRangeSearch == 1 && UseDateRange == true)
			{
				if (pageinfo[i][PAGEINFO_DATETIME] < from_datetime)
					IsFiltered = true;
				else if (pageinfo[i][PAGEINFO_DATETIME] > to_datetime)
					IsFiltered = true;				
			}
			
			if (IsFiltered == false) {
				
				if (res_table[i][2] >= full_numwords)
					fullmatches++;
					
				// copy if not filtered out
				output[oline] = new Array(3);
				output[oline][0] = i;

				// determine final score
				baseScale = 1.3;
				finalScale = ((res_table[i][3] / 255) * 1.7) + baseScale;
				if (res_table[i][1] > 1)
				{
					if (res_table[i][1] <= 10)
						finalScale = Math.pow(finalScale, res_table[i][1]-1);
					else
					{
						finalScale = Math.pow(finalScale, 10);
						finalScale += res_table[i][1] - 10;
					}
				}

				if (UseCats == 1 && DisplayCatSummary == 1 && cat == -1)
				{
					// if we are doing an All category search AND we're showing cat summary
					if (pageinfo[i][PAGEINFO_CAT] != null)
					{
						for (cati = 0; cati < NumCats; cati++)
						{
							if (pageinfo[i][PAGEINFO_CAT].charAt(cati) == "1")
							{
								CatCounter[cati]++;
								CatCounterFilled = 1;
							}
						}
					}
				}

				output[oline][1] = Math.floor(res_table[i][0] * finalScale + 0.5);
				output[oline][2] = res_table[i][1];
				oline++;
			}
		}
	}
	matches = oline;
	// Sort results in order of score, use "SortCompare" function
	if (matches > 1)
	{
		if (UseDateTime == 1 && sort == 1)
			output.sort(SortByDate);    // sort by date
		else if (UseDateTime == 1 && sort == 2)
			output.sort(SortByDateAsc);    // sort by date ascending
		else
			output.sort(SortCompare);   // sort by relevance
	}

	// prepare queryForURL
	if (UseUTF8 == 1 && self.encodeURIComponent)
	{
		queryForURL = encodeURIComponent(query);		
		queryForURL = queryForURL.replace(/%20/g, "+");
	}
	else
	{	
		queryForURL = query.replace(/\s/g, "+");	
		queryForURL = escape(queryForURL);
	}

	metaParams = "";
	if (UseMetaFields == 1)
	{
		for (fieldnum = 0; fieldnum < NumMetaFields; fieldnum++)
		{
			if (meta_query[fieldnum] != "")
				metaParams = metaParams+"&amp;"+metafields[fieldnum][METAFIELD_NAME]+"="+meta_query[fieldnum];
		}
	}

	// number of pages of results
	num_pages = Math.ceil(matches / per_page);
	return matches;
}


function ZoomShowPageNumbersEx(cat)
{
	if (InitSearchCalled == false)
	{
		if (IsWarningGiven == false)
			document.writeln("<div class=\"results\">This is an advanced template option. You must call ZoomInitSearch() before this. Please check documentation for more help.</div>");
		IsWarningGiven = true;
		return;
	}
	if (IsNoSearch)
		return;

	// Show links to other result pages
	if (num_pages > 1)
	{
		// 10 results to the left of the current page
		start_range = page - 10;
		if (start_range < 1)
			start_range = 1;

		// 10 to the right
		end_range = page + 10;
		if (end_range > num_pages)
			end_range = num_pages;

		document.writeln("<div class=\"result_pages\">" + STR_RESULT_PAGES + " ");
		if (page > 1)
			document.writeln("<a href=\"" + SelfURL + LinkBackJoinChar + "zoom_query=" + queryForURL + metaParams + "&amp;zoom_catex=" + cat + "&amp;zoom_page=" + (page-1) + "&amp;zoom_per_page=" + per_page + query_zoom_cats + dateRangeParams + "&amp;zoom_and=" + andq + "&amp;zoom_sort=" + sort + "\">&lt;&lt; " + STR_RESULT_PAGES_PREVIOUS + "</a> ");
		for (i = start_range; i <= end_range; i++)
		{
			if (i == page)
				document.writeln(page + " ");
			else
				document.writeln("<a href=\"" + SelfURL + LinkBackJoinChar + "zoom_query=" + queryForURL + metaParams + "&amp;zoom_catex=" + cat + "&amp;zoom_page=" + i + "&amp;zoom_per_page=" + per_page + query_zoom_cats + dateRangeParams + "&amp;zoom_and=" + andq + "&amp;zoom_sort=" + sort + "\">" + i + "</a> ");
		}
		if (page != num_pages)
			document.writeln("<a href=\"" + SelfURL + LinkBackJoinChar + "zoom_query=" + queryForURL + metaParams + "&amp;zoom_catex=" + cat + "&amp;zoom_page=" + (page+1) + "&amp;zoom_per_page=" + per_page + query_zoom_cats + dateRangeParams + "&amp;zoom_and=" + andq + "&amp;zoom_sort=" + sort + "\">" + STR_RESULT_PAGES_NEXT + " &gt;&gt;</a> ");
		document.writeln("</div>");
	}
	if (ZoomInfo == 1)
		document.writeln("<center><p><small>" + STR_POWEREDBY + " <a href=\"http://www.wrensoft.com/zoom/\" target=\"_blank\"><b>Zoom Search Engine</b></a></small></p></center>");
}
