search.js 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695
  1. // ----------------------------------------------------------------------------
  2. // Zoom Search Engine 6.0 (3/Jul/2009)
  3. //
  4. // This file (search.js) is the JavaScript search front-end for client side
  5. // searches using index files created by the Zoom Search Engine Indexer.
  6. //
  7. // email: zoom@wrensoft.com
  8. // www: http://www.wrensoft.com
  9. //
  10. // Copyright (C) Wrensoft 2000-2009
  11. //
  12. // This script performs client-side searching with the index data file
  13. // (zoom_index.js) generated by the Zoom Search Engine Indexer. It allows you
  14. // to run searches on mediums such as CD-ROMs, or other local data, where a
  15. // web server is not available.
  16. //
  17. // We recommend against using client-side searches for online websites because
  18. // it requires the entire index data file to be downloaded onto the user's
  19. // local machine. This can be very slow for large websites, and our server-side
  20. // search scripts (available for PHP, ASP and CGI) are far better suited for this.
  21. // However, JavaScript is still an option for smaller websites in a limited
  22. // hosting situation (eg: your web host does not support PHP, ASP or CGI).
  23. // ----------------------------------------------------------------------------
  24. // Include required files for index data, settings, etc.
  25. document.write("<script language=\"JavaScript\" src=\"zoom_index.js\" charset=\"" + Charset + "\"><\/script>");
  26. document.write("<script language=\"JavaScript\" src=\"zoom_pageinfo.js\" charset=\"" + Charset + "\"><\/script>");
  27. document.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=" + Charset + "\">");
  28. // ----------------------------------------------------------------------------
  29. // Settings (change if necessary)
  30. // ----------------------------------------------------------------------------
  31. // The options available in the dropdown menu for number of results
  32. // per page
  33. var PerPageOptions = new Array(10, 20, 50, 100);
  34. // Globals
  35. var SkippedWords = 0;
  36. var searchWords = new Array();
  37. var RegExpSearchWords = new Array();
  38. var SkippedOutputStr = "";
  39. var CatCounter = new Array();
  40. var CatCounterFilled = 0;
  41. var months = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
  42. // Index format
  43. var PAGEDATA_URL = 0;
  44. var PAGEDATA_TITLE = 1;
  45. var PAGEDATA_DESC = 2;
  46. var PAGEDATA_IMG = 3;
  47. var PAGEINFO_DATETIME = 0;
  48. var PAGEINFO_FILESIZE = 1;
  49. var PAGEINFO_BOOST = 2;
  50. var PAGEINFO_LINKACTION = 3;
  51. var PAGEINFO_CAT = 4;
  52. var PAGEINFO_METAFIRST = 5;
  53. var METAFIELD_TYPE = 0;
  54. var METAFIELD_NAME = 1;
  55. var METAFIELD_SHOW = 2;
  56. var METAFIELD_FORM = 3;
  57. var METAFIELD_METHOD = 4;
  58. var METAFIELD_DROPDOWN = 5;
  59. var METAFIELD_TYPE_NUMERIC = 0;
  60. var METAFIELD_TYPE_TEXT = 1;
  61. var METAFIELD_TYPE_DROPDOWN = 2;
  62. var METAFIELD_TYPE_MULTI = 3;
  63. var METAFIELD_TYPE_MONEY = 4;
  64. var METAFIELD_METHOD_EXACT = 0;
  65. var METAFIELD_METHOD_LESSTHAN = 1;
  66. var METAFIELD_METHOD_LESSTHANORE = 2;
  67. var METAFIELD_METHOD_GREATERTHAN = 3;
  68. var METAFIELD_METHOD_GREATERTHANORE = 4;
  69. var METAFIELD_METHOD_SUBSTRING = 5;
  70. // ----------------------------------------------------------------------------
  71. // Helper Functions
  72. // ----------------------------------------------------------------------------
  73. // This function will return the value of a GET parameter
  74. function getParam(paramName)
  75. {
  76. paramStr = document.location.search;
  77. if (paramStr == "")
  78. return "";
  79. // remove '?' in front of paramStr
  80. if (paramStr.charAt(0) == "?")
  81. paramStr = paramStr.substr(1);
  82. arg = (paramStr.split("&"));
  83. for (i=0; i < arg.length; i++) {
  84. arg_values = arg[i].split("=")
  85. if (unescape(arg_values[0]) == paramName)
  86. {
  87. if (paramName == "zoom_query")
  88. arg_values[1] = arg_values[1].replace(/[\+]/g, " "); // replace the '+' with spaces
  89. if (UseUTF8 == 1 && self.decodeURIComponent) // check if decodeURIComponent() is defined
  90. ret = decodeURIComponent(arg_values[1]);
  91. else
  92. ret = unescape(arg_values[1]); // IE 5.0 and older does not have decodeURI
  93. return ret;
  94. }
  95. }
  96. return "";
  97. }
  98. function getParamArrayInt(paramName)
  99. {
  100. paramStr = document.location.search;
  101. var retArray = new Array();
  102. var retCount = 0;
  103. if (paramStr == "")
  104. return retArray;
  105. // remove '?' in front of paramStr
  106. if (paramStr.charAt(0) == "?")
  107. paramStr = paramStr.substr(1);
  108. arg = (paramStr.split("&"));
  109. for (i=0; i < arg.length; i++)
  110. {
  111. arg_values = arg[i].split("=")
  112. if (unescape(arg_values[0]) == paramName)
  113. {
  114. if (UseUTF8 == 1 && self.decodeURIComponent) // check if decodeURIComponent() is defined
  115. ret = decodeURIComponent(arg_values[1]);
  116. else
  117. ret = unescape(arg_values[1]); // IE 5.0 and older does not have decodeURI
  118. if (isNaN(ret) == false)
  119. {
  120. retArray[retCount] = ret;
  121. retCount++;
  122. }
  123. }
  124. }
  125. return retArray;
  126. }
  127. // Compares the two values, used for sorting output results
  128. // Results that match all search terms are put first, highest score
  129. function SortCompare (a, b)
  130. {
  131. if (a[2] < b[2]) return 1;
  132. else if (a[2] > b[2]) return -1;
  133. else if (a[1] < b[1]) return 1;
  134. else if (a[1] > b[1]) return -1;
  135. else return 0;
  136. }
  137. function SortByDate(a, b)
  138. {
  139. if (pageinfo[a[0]][PAGEINFO_DATETIME] < pageinfo[b[0]][PAGEINFO_DATETIME]) return 1;
  140. else if (pageinfo[a[0]][PAGEINFO_DATETIME] > pageinfo[b[0]][PAGEINFO_DATETIME]) return -1;
  141. else return SortCompare(a, b);
  142. }
  143. function sw_compare(a, b)
  144. {
  145. if (a.charAt(0) == '-')
  146. return 1;
  147. if (b.charAt(0) == '-')
  148. return -1;
  149. return 0;
  150. }
  151. function pattern2regexp(pattern)
  152. {
  153. pattern = pattern.replace(/\#/g, "\\#");
  154. pattern = pattern.replace(/\$/g, "\\$");
  155. pattern = pattern.replace(/\./g, "\\.");
  156. pattern = pattern.replace(/\*/g, "[\\d\\S]*");
  157. pattern = pattern.replace(/\?/g, ".?");
  158. return pattern;
  159. }
  160. function PrintHighlightDescription(line)
  161. {
  162. if (Highlighting == 0)
  163. {
  164. document.writeln(line);
  165. return;
  166. }
  167. res = " " + line + " ";
  168. for (i = 0; i < NumSearchWords; i++) {
  169. if (RegExpSearchWords[i] == "")
  170. continue;
  171. if (SearchAsSubstring == 1)
  172. res = res.replace(new RegExp("("+RegExpSearchWords[i]+")", "gi"), "[;:]$1[:;]");
  173. else
  174. res = res.replace(new RegExp("(\\W|^|\\b)("+RegExpSearchWords[i]+")(\\W|$|\\b)", "gi"), "$1[;:]$2[:;]$3");
  175. }
  176. // replace the marker text with the html text
  177. // this is to avoid finding previous <span>'ed text.
  178. res = res.replace(/\[;:\]/g, "<span class=\"highlight\">");
  179. res = res.replace(/\[:;\]/g, "</span>");
  180. document.writeln(res);
  181. }
  182. function PrintNumResults(num)
  183. {
  184. if (num == 0)
  185. return STR_NO_RESULTS;
  186. else if (num == 1)
  187. return num + " " + STR_RESULT;
  188. else
  189. return num + " " + STR_RESULTS;
  190. }
  191. function AddParamToURL(url, paramStr)
  192. {
  193. // add GET parameters to URL depending on
  194. // whether there are any existing parameters
  195. if (url.indexOf("?") > -1)
  196. return url + "&amp;" + paramStr;
  197. else
  198. return url + "?" + paramStr;
  199. }
  200. function SkipSearchWord(sw) {
  201. if (searchWords[sw] != "") {
  202. if (SkippedWords > 0)
  203. SkippedOutputStr += ", ";
  204. SkippedOutputStr += "\"<b>" + searchWords[sw] + "</b>\"";
  205. searchWords[sw] = "";
  206. SkippedWords++;
  207. }
  208. }
  209. function wordcasecmp(word1, word2) {
  210. if (word1 == word2)
  211. return 0;
  212. else
  213. return -1;
  214. }
  215. function htmlspecialchars(query) {
  216. query = query.replace(/\&/g, "&#38;");
  217. query = query.replace(/\</g, "&#60;");
  218. query = query.replace(/\>/g, "&#62;");
  219. query = query.replace(/\"/g, "&#34;");
  220. query = query.replace(/\'/g, "&#39;");
  221. return query;
  222. }
  223. function QueryEntities(query) {
  224. query = query.replace(/\&/g, "&#38;");
  225. query = query.replace(/\</g, "&#60;");
  226. query = query.replace(/\>/g, "&#62;");
  227. query = query.replace(/\'/g, "&#39;");
  228. return query;
  229. }
  230. function FixQueryForAsianWords(query) {
  231. currCharType = 0;
  232. lastCharType = 0; // 0 is normal, 1 is hiragana, 2 is katakana, 3 is "han"
  233. // check for hiragana/katakana splitting required
  234. newquery = "";
  235. for (i = 0; i < query.length; i++)
  236. {
  237. ch = query.charAt(i);
  238. chVal = query.charCodeAt(i);
  239. if (chVal >= 12352 && chVal <= 12447)
  240. currCharType = 1;
  241. else if (chVal >= 12448 && chVal <= 12543)
  242. currCharType = 2;
  243. else if (chVal >= 13312 && chVal <= 44031)
  244. currCharType = 3;
  245. else
  246. currCharType = 0;
  247. if (lastCharType != currCharType && ch != " ")
  248. newquery += " ";
  249. lastCharType = currCharType;
  250. newquery += ch;
  251. }
  252. return newquery;
  253. }
  254. function GetMetaValues(pagenum, fieldnum)
  255. {
  256. return pageinfo[pagenum][PAGEINFO_METAFIRST+fieldnum];
  257. }
  258. // ----------------------------------------------------------------------------
  259. // Parameters initialisation (globals)
  260. // ----------------------------------------------------------------------------
  261. var query = getParam("zoom_query");
  262. query = query.replace(/[\"]/g, " ");
  263. var IsZoomQuery = 0;
  264. if (query.length == 0)
  265. {
  266. if (document.location.search.indexOf("zoom_query") != -1)
  267. IsZoomQuery = 1;
  268. }
  269. var per_page = parseInt(getParam("zoom_per_page"));
  270. if (isNaN(per_page)) per_page = 10;
  271. if (per_page < 1) per_page = 1;
  272. var page = parseInt(getParam("zoom_page"));
  273. if (isNaN(page)) page = 1;
  274. var andq = parseInt(getParam("zoom_and"));
  275. if (isNaN(andq))
  276. {
  277. if (typeof(DefaultToAnd) != "undefined" && DefaultToAnd == 1)
  278. andq = 1;
  279. else
  280. andq = 0;
  281. }
  282. var cat = getParamArrayInt("zoom_cat[]");
  283. if (cat.length == 0)
  284. {
  285. cat[0] = parseInt(getParam("zoom_cat"));
  286. if (isNaN(cat[0]))
  287. cat[0] = -1; // search all categories
  288. }
  289. var num_zoom_cats = cat.length;
  290. var meta_query = new Array();
  291. if (UseMetaFields == 1)
  292. {
  293. for (fieldnum = 0; fieldnum < NumMetaFields; fieldnum++)
  294. {
  295. if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_NUMERIC || metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_MONEY)
  296. {
  297. meta_query[fieldnum] = parseInt(getParam(metafields[fieldnum][METAFIELD_NAME]));
  298. if (isNaN(meta_query[fieldnum]))
  299. meta_query[fieldnum] = "";
  300. }
  301. else if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_TEXT)
  302. {
  303. meta_query[fieldnum] = getParam(metafields[fieldnum][METAFIELD_NAME]);
  304. meta_query[fieldnum] = meta_query[fieldnum].replace(/[\+]/g, " "); // replace the '+' with spaces
  305. }
  306. else if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_MULTI)
  307. {
  308. var mqarray = new Array();
  309. mqarray = getParamArrayInt(metafields[fieldnum][METAFIELD_NAME]+"[]");
  310. if (mqarray.length == 0)
  311. {
  312. mqarray[0] = parseInt(getParam(metafields[fieldnum][METAFIELD_NAME]));
  313. if (isNaN(mqarray[0]))
  314. mqarray[0] = -1;
  315. }
  316. meta_query[fieldnum] = mqarray;
  317. }
  318. else
  319. meta_query[fieldnum] = getParam(metafields[fieldnum][METAFIELD_NAME]);
  320. }
  321. }
  322. // for sorting options. zero is default (relevance)
  323. // 1 is sort by date (if date/time is available)
  324. var sort = parseInt(getParam("zoom_sort"));
  325. if (isNaN(sort)) sort = 0;
  326. var SelfURL = "";
  327. if (typeof(LinkBackURL) == "undefined")
  328. {
  329. SelfURL = document.location.href;
  330. // strip off parameters and anchors
  331. var paramIndex;
  332. paramIndex = SelfURL.indexOf("?");
  333. if (paramIndex > -1)
  334. SelfURL = SelfURL.substr(0, paramIndex);
  335. paramIndex = SelfURL.indexOf("#");
  336. if (paramIndex > -1)
  337. SelfURL = SelfURL.substr(0, paramIndex);
  338. }
  339. else
  340. SelfURL = LinkBackURL;
  341. // encode invalid URL characters
  342. SelfURL = SelfURL.replace(/\</g, "&lt;");
  343. SelfURL = SelfURL.replace(/\"/g, "&quot;");
  344. var data = new Array();
  345. var output = new Array();
  346. var zoom_target = "";
  347. if (UseLinkTarget == 1)
  348. zoom_target = " target=\"" + LinkTarget + "\" ";
  349. if (UseCats)
  350. NumCats = catnames.length;
  351. var query_zoom_cats = "";
  352. var queryForHTML, queryForURL, queryForSearch;
  353. var metaParams;
  354. var UseWildCards;
  355. var matches = 0;
  356. // ----------------------------------------------------------------------------
  357. // Main search function starts here
  358. // ----------------------------------------------------------------------------
  359. var InitSearchCalled = false;
  360. var IsWarningGiven = false;
  361. var IsEmptyMetaQuery = false;
  362. var IsNoSearch = false;
  363. function ZoomInitSearch()
  364. {
  365. // this prevents warnings given for calling this function when no results
  366. IsWarningGiven = true;
  367. if (Timing == 1)
  368. timeStart = new Date();
  369. InitSearchCalled = true;
  370. // Give up early if no search words provided
  371. IsEmptyMetaQuery = false;
  372. if (query.length == 0)
  373. {
  374. if (UseMetaFields == 1)
  375. {
  376. if (IsZoomQuery == 1)
  377. IsEmptyMetaQuery = true;
  378. else
  379. IsNoSearch = true;
  380. }
  381. else
  382. IsNoSearch = true;
  383. if (IsNoSearch)
  384. return;
  385. }
  386. if (MapAccents == 1)
  387. {
  388. for (i = 0; i < NormalChars.length; i++)
  389. query = query.replace(new RegExp(AccentChars[i], "g"), NormalChars[i]);
  390. }
  391. // Special query processing required when SearchAsSubstring is enabled
  392. if (SearchAsSubstring == 1 && UseUTF8 == 1)
  393. query = FixQueryForAsianWords(query);
  394. // prepare search query, strip quotes, trim whitespace
  395. if (WordJoinChars.indexOf(".") == -1)
  396. query = query.replace(/[\.]/g, " ");
  397. if (WordJoinChars.indexOf("-") == -1)
  398. query = query.replace(/(\S)\-/g, "$1 ");
  399. if (WordJoinChars.indexOf("#") == -1)
  400. query = query.replace(/\#(\S)/g, " $1");
  401. if (WordJoinChars.indexOf("+") == -1)
  402. {
  403. query = query.replace(/[\+]+([^\+\s])/g, " $1");
  404. query = query.replace(/([^\+\s])\+\s/g, "$1 ");
  405. }
  406. if (WordJoinChars.indexOf("_") == -1)
  407. query = query.replace(/[\_]/g, " ");
  408. if (WordJoinChars.indexOf("'") == -1)
  409. query = query.replace(/[\']/g, " ");
  410. if (WordJoinChars.indexOf("$") == -1)
  411. query = query.replace(/[\$]/g, " ");
  412. if (WordJoinChars.indexOf("&") == -1)
  413. query = query.replace(/[\&]/g, " ");
  414. if (WordJoinChars.indexOf(":") == -1)
  415. query = query.replace(/[\:]/g, " ");
  416. if (WordJoinChars.indexOf(",") == -1)
  417. query = query.replace(/[\,]/g, " ");
  418. if (WordJoinChars.indexOf("/") == -1)
  419. query = query.replace(/[\/]/g, " ");
  420. if (WordJoinChars.indexOf("\\") == -1)
  421. query = query.replace(/[\\]/g, " ");
  422. // substitute multiple whitespace chars to single character
  423. // also strip any of the wordjoinchars if followed immediately by a space
  424. query = query.replace(/[\s\(\)\^\[\]\|\{\}\%\£]+|[\-._',:&\/\\\\](\s|$)/g, " ");
  425. // trim trailing/leading whitespace
  426. query = query.replace(/^\s*|\s*$/g,"");
  427. queryForHTML = htmlspecialchars(query);
  428. if (ToLowerSearchWords == 1)
  429. queryForSearch = query.toLowerCase();
  430. else
  431. queryForSearch = query;
  432. queryForSearch = htmlspecialchars(queryForSearch);
  433. // split search phrase into words
  434. searchWords = queryForSearch.split(" "); // split by spaces.
  435. // Sort search words if there are negative signs
  436. if (queryForSearch.indexOf("-") != -1)
  437. searchWords.sort(sw_compare);
  438. NumSearchWords = searchWords.length;
  439. if (searchWords[0].length == 0)
  440. NumSearchWords = 0;
  441. kw_ptr = 0;
  442. outputline = 0;
  443. ipage = 0;
  444. matches = 0;
  445. pagesCount = NumPages;
  446. exclude_count = 0;
  447. ExcludeTerm = 0;
  448. // Initialise a result table the size of all pages
  449. res_table = new Array(pagesCount);
  450. for (i = 0; i < pagesCount; i++)
  451. {
  452. res_table[i] = new Array(4);
  453. res_table[i][0] = 0;
  454. res_table[i][1] = 0;
  455. res_table[i][2] = 0;
  456. res_table[i][3] = 0;
  457. }
  458. UseWildCards = new Array(NumSearchWords);
  459. for (sw = 0; sw < NumSearchWords; sw++) {
  460. UseWildCards[sw] = 0;
  461. if (typeof(window['skipwords']) != "undefined" ) {
  462. // check min length
  463. if (searchWords[sw].length < MinWordLen) {
  464. SkipSearchWord(sw);
  465. continue;
  466. }
  467. // check skip word list
  468. for (i = 0; i < skipwords.length; i++) {
  469. if (searchWords[sw] == skipwords[i])
  470. {
  471. SkipSearchWord(sw);
  472. break;
  473. }
  474. }
  475. }
  476. if (searchWords[sw].indexOf("*") == -1 && searchWords[sw].indexOf("?") == -1) {
  477. UseWildCards[sw] = 0;
  478. } else {
  479. UseWildCards[sw] = 1;
  480. RegExpSearchWords[sw] = pattern2regexp(searchWords[sw]);
  481. }
  482. if (Highlighting == 1 && UseWildCards[sw] == 0)
  483. RegExpSearchWords[sw] = searchWords[sw];
  484. }
  485. // Join splitted up arrays if necessary
  486. if (DictArrayCount > 0)
  487. {
  488. for (dci = 0; dci < DictArrayCount; dci++)
  489. eval("dictwords = dictwords.concat(dictwords"+dci+");");
  490. }
  491. if (PageInfoArrayCount > 0)
  492. {
  493. for (dci = 0; dci < PageInfoArrayCount; dci++)
  494. eval("pageinfo = pageinfo.concat(pageinfo"+dci+");");
  495. }
  496. if (PageDataArrayCount > 0)
  497. {
  498. for (dci = 0; dci < PageDataArrayCount; dci++)
  499. eval("pagedata = pagedata.concat(pagedata"+dci+");");
  500. }
  501. // Join splitted up arrays if necessary
  502. if (DictArrayCount > 0)
  503. {
  504. for (dci = 0; dci < DictArrayCount; dci++)
  505. dictwords = dictwords.concat(window["dictwords"+dci]);
  506. }
  507. if (PageInfoArrayCount > 0)
  508. {
  509. for (dci = 0; dci < PageInfoArrayCount; dci++)
  510. pageinfo = pageinfo.concat(window["pageinfo"+dci]);
  511. }
  512. if (PageDataArrayCount > 0)
  513. {
  514. for (dci = 0; dci < PageDataArrayCount; dci++)
  515. pagedata = pagedata.concat(window["pagedata"+dci]);
  516. }
  517. // Begin searching...
  518. for (sw = 0; sw < NumSearchWords; sw++) {
  519. if (searchWords[sw] == "") {
  520. continue;
  521. }
  522. if (searchWords[sw].charAt(0) == '-')
  523. {
  524. searchWords[sw] = searchWords[sw].substr(1);
  525. ExcludeTerm = 1;
  526. exclude_count++;
  527. }
  528. if (UseWildCards[sw] == 1) {
  529. if (SearchAsSubstring == 0)
  530. pattern = "^" + RegExpSearchWords[sw] + "$";
  531. else
  532. pattern = RegExpSearchWords[sw];
  533. re = new RegExp(pattern, "g");
  534. }
  535. for (kw_ptr = 0; kw_ptr < dictwords.length; kw_ptr++) {
  536. data = dictwords[kw_ptr].split(" ");
  537. if (UseWildCards[sw] == 0) {
  538. if (SearchAsSubstring == 0)
  539. match_result = wordcasecmp(data[0], searchWords[sw]);
  540. else
  541. match_result = data[0].indexOf(searchWords[sw]);
  542. } else
  543. match_result = data[0].search(re);
  544. if (match_result != -1) {
  545. // keyword found, include it in the output list
  546. for (kw = 1; kw < data.length; kw += 3) {
  547. // check if page is already in output list
  548. pageexists = 0;
  549. ipage = data[kw];
  550. score = parseInt(data[kw+1]);
  551. prox = parseInt(data[kw+2]);
  552. if (pageinfo[ipage][PAGEINFO_BOOST] != 0)
  553. {
  554. score *= (pageinfo[ipage][PAGEINFO_BOOST] / 10);
  555. score = Math.floor(score + 0.5);
  556. }
  557. if (ExcludeTerm == 1)
  558. {
  559. // we clear out the score entry so that it'll be excluded in the filter stage
  560. res_table[ipage][0] = 0;
  561. }
  562. else if (res_table[ipage][0] == 0)
  563. {
  564. matches++;
  565. res_table[ipage][0] = score;
  566. res_table[ipage][3] = prox;
  567. }
  568. else
  569. {
  570. if (res_table[ipage][0] > 10000) {
  571. // take it easy if its too big to prevent gigantic scores
  572. res_table[ipage][0] += 1;
  573. } else {
  574. res_table[ipage][0] += score; // add in score
  575. //res_table[ipage][0] *= 2; // double score as we have two words matching
  576. }
  577. res_table[ipage][3] &= prox;
  578. }
  579. res_table[ipage][1] += 1;
  580. // store the 'and' user search terms matched' value
  581. if (res_table[ipage][2] == sw || res_table[ipage][2] == sw-SkippedWords-exclude_count)
  582. res_table[ipage][2] += 1;
  583. }
  584. if (UseWildCards[sw] == 0 && SearchAsSubstring == 0)
  585. break; // this search word was found, so skip to next
  586. }
  587. }
  588. }
  589. // Count number of output lines that match ALL search terms
  590. oline = 0;
  591. fullmatches = 0;
  592. output = new Array();
  593. if (UseCats == 1 && DisplayCatSummary == 1)
  594. {
  595. if (cat[0] == -1 || num_zoom_cats > 1)
  596. {
  597. for (cati = 0; cati < NumCats; cati++)
  598. CatCounter[cati] = 0;
  599. }
  600. else
  601. DisplayCatSummary = 0;
  602. }
  603. var IsAnyDropdown = false;
  604. var full_numwords = NumSearchWords - SkippedWords - exclude_count;
  605. for (i = 0; i < pageinfo.length; i++)
  606. {
  607. IsFiltered = false;
  608. if (res_table[i][0] > 0 || IsEmptyMetaQuery)
  609. {
  610. if (UseMetaFields && IsFiltered == false)
  611. {
  612. for (fieldnum = 0; fieldnum < NumMetaFields && !IsFiltered; fieldnum++)
  613. {
  614. IsAnyDropdown = false;
  615. if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_DROPDOWN ||
  616. metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_MULTI)
  617. {
  618. if (meta_query[fieldnum] == -1)
  619. IsAnyDropdown = true;
  620. }
  621. if (meta_query[fieldnum] !== "" && IsAnyDropdown == false)
  622. {
  623. if (GetMetaValues(i, fieldnum) == null)
  624. IsFiltered = true;
  625. else if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_TEXT)
  626. {
  627. if (metafields[fieldnum][METAFIELD_METHOD] == METAFIELD_METHOD_SUBSTRING)
  628. {
  629. if (GetMetaValues(i, fieldnum).toLowerCase().indexOf(meta_query[fieldnum].toLowerCase()) == -1)
  630. IsFiltered = true;
  631. }
  632. else
  633. {
  634. if (wordcasecmp(GetMetaValues(i, fieldnum).toLowerCase(), meta_query[fieldnum].toLowerCase()) == -1)
  635. IsFiltered = true;
  636. }
  637. }
  638. else if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_DROPDOWN)
  639. {
  640. if (GetMetaValues(i, fieldnum) != meta_query[fieldnum])
  641. IsFiltered = true;
  642. }
  643. else if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_MULTI)
  644. {
  645. IsFiltered = true;
  646. var metaVal = GetMetaValues(i, fieldnum);
  647. if (metaVal.length > 0)
  648. {
  649. for (mqi = 0; mqi < meta_query[fieldnum].length && IsFiltered; mqi++)
  650. {
  651. for (mvi = 0; mvi < metaVal.length; mvi++)
  652. {
  653. if (metaVal[mvi] == meta_query[fieldnum][mqi])
  654. {
  655. IsFiltered = false;
  656. break;
  657. }
  658. }
  659. }
  660. }
  661. }
  662. else
  663. {
  664. var tmpQueryVal = meta_query[fieldnum];
  665. // we do this here to avoid changing meta_query for displaying
  666. if (UseMetaFields == 1 && MetaMoneyShowDec == 1 && metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_MONEY)
  667. tmpQueryVal = tmpQueryVal * 100;
  668. // numeric comparison here
  669. if (metafields[fieldnum][METAFIELD_METHOD] == METAFIELD_METHOD_LESSTHAN)
  670. {
  671. bRet = GetMetaValues(i, fieldnum) < tmpQueryVal;
  672. }
  673. else if (metafields[fieldnum][METAFIELD_METHOD] == METAFIELD_METHOD_LESSTHANORE)
  674. {
  675. bRet = GetMetaValues(i, fieldnum) <= tmpQueryVal;
  676. }
  677. else if (metafields[fieldnum][METAFIELD_METHOD] == METAFIELD_METHOD_GREATERTHAN)
  678. {
  679. bRet = GetMetaValues(i, fieldnum) > tmpQueryVal;
  680. }
  681. else if (metafields[fieldnum][METAFIELD_METHOD] == METAFIELD_METHOD_GREATERTHANORE)
  682. {
  683. bRet = GetMetaValues(i, fieldnum) >= tmpQueryVal;
  684. }
  685. else
  686. {
  687. // exact match
  688. bRet = GetMetaValues(i, fieldnum) == tmpQueryVal;
  689. }
  690. if (bRet == false)
  691. IsFiltered = true;
  692. }
  693. }
  694. }
  695. // only add to res_table if empty query!
  696. if (IsEmptyMetaQuery == true && IsFiltered == false)
  697. {
  698. res_table[i][0]++;
  699. res_table[i][1]++;
  700. }
  701. }
  702. if (IsFiltered == false) {
  703. if (res_table[i][2] < full_numwords && andq == 1)
  704. IsFiltered = true;
  705. }
  706. if (UseCats && cat[0] != -1 && IsFiltered == false) {
  707. // using cats and not doing an "all cats" search
  708. if (SearchMultiCats) {
  709. var bFoundCat = false;
  710. for (cati = 0; cati < num_zoom_cats; cati++) {
  711. if (pageinfo[i][PAGEINFO_CAT].charAt(cat[cati]) == "1")
  712. {
  713. if (DisplayCatSummary == 1)
  714. {
  715. CatCounter[cat[cati]]++;
  716. CatCounterFilled = 1;
  717. }
  718. bFoundCat = true;
  719. }
  720. }
  721. if (bFoundCat == false)
  722. IsFiltered = true;
  723. }
  724. else {
  725. if (pageinfo[i][PAGEINFO_CAT].charAt(cat[0]) == "0") {
  726. IsFiltered = true;
  727. }
  728. }
  729. }
  730. if (IsFiltered == false) {
  731. if (res_table[i][2] >= full_numwords)
  732. fullmatches++;
  733. // copy if not filtered out
  734. output[oline] = new Array(3);
  735. output[oline][0] = i;
  736. // determine final score
  737. baseScale = 1.3;
  738. finalScale = ((res_table[i][3] / 255) * 1.7) + baseScale;
  739. if (res_table[i][1] > 1)
  740. {
  741. if (res_table[i][1] <= 10)
  742. finalScale = Math.pow(finalScale, res_table[i][1]-1);
  743. else
  744. {
  745. finalScale = Math.pow(finalScale, 10);
  746. finalScale += res_table[i][1] - 10;
  747. }
  748. }
  749. if (UseCats == 1 && DisplayCatSummary == 1 && cat[0] == -1)
  750. {
  751. // if we are doing an All category search AND we're showing cat summary
  752. if (pageinfo[i][PAGEINFO_CAT] != null)
  753. {
  754. for (cati = 0; cati < NumCats; cati++)
  755. {
  756. if (pageinfo[i][PAGEINFO_CAT].charAt(cati) == "1")
  757. {
  758. CatCounter[cati]++;
  759. CatCounterFilled = 1;
  760. }
  761. }
  762. }
  763. }
  764. output[oline][1] = Math.floor(res_table[i][0] * finalScale + 0.5);
  765. output[oline][2] = res_table[i][1];
  766. oline++;
  767. }
  768. }
  769. }
  770. matches = oline;
  771. // Sort results in order of score, use "SortCompare" function
  772. if (matches > 1)
  773. {
  774. if (sort == 1 && UseDateTime == 1)
  775. output.sort(SortByDate); // sort by date
  776. else
  777. output.sort(SortCompare); // sort by relevance
  778. }
  779. // prepare queryForURL
  780. queryForURL = query.replace(/\s/g, "+");
  781. if (UseUTF8 == 1 && self.encodeURIComponent)
  782. queryForURL = encodeURIComponent(queryForURL);
  783. else
  784. queryForURL = escape(queryForURL);
  785. metaParams = "";
  786. if (UseMetaFields == 1)
  787. {
  788. for (fieldnum = 0; fieldnum < NumMetaFields; fieldnum++)
  789. {
  790. if (meta_query[fieldnum] != "")
  791. metaParams = metaParams+"&amp;"+metafields[fieldnum][METAFIELD_NAME]+"="+meta_query[fieldnum];
  792. }
  793. }
  794. if (Timing == 1)
  795. {
  796. timeEnd = new Date();
  797. timeDifference = timeEnd - timeStart;
  798. }
  799. // number of pages of results
  800. num_pages = Math.ceil(matches / per_page);
  801. }
  802. function ZoomShowFormStart()
  803. {
  804. document.writeln("<form method=\"get\" action=\"" + SelfURL + "\" class=\"zoom_searchform\">");
  805. }
  806. function ZoomShowSearchBox()
  807. {
  808. document.writeln("<table border='0' width='100%' cellpadding='4' cellspacing='0'><tr><td>&#160;</td></tr>");
  809. document.writeln("<tr><td width=\"15%\"><input type=\"text\" name=\"zoom_query\" size=\"20\" value=\"" + htmlspecialchars(query) + "\" id=\"zoom_searchbox\" class=\"zoom_searchbox\" /></td>");
  810. document.write('<td><table border="0"><TR><TD><input type="image" style="border:none;" src="../../common/search_bx.gif" value="search" name="search" alt="Search"></input></TD></TR>');
  811. // document.write('<td><TABLE BORDER=\"0\" cellpadding=\"0\" cellspacing=\"0\"><TR><TD colspan=\"3\" bgColor=\"#666699\"><IMG src=\"../../common/spacer.gif\" height=\"1\" width=\"1\" border=\"0\" alt=\"\"></TD></TR><TR><TD bgColor=\"#666699\" width=\"1\"><IMG src=\"../../common/spacer.gif\" height=\"16\" width=\"1\" border=\"0\" alt=\"\"></TD><TD valign=\"middle\" align=\"left\" bgColor=\"#DDDDFF\"><FONT face=\"Tahoma, Arial, Geneva, Helvetica, sans-serif\" color=\"#666699\" size=\"2\"><input type=\"image\" src=\"../../common/search.gif\" value=\"search\" name=\"search\" alt=\"Search\"></FONT></TD><TD bgColor=\"#666699\" width=\"1\"><IMG src=\"../../common/spacer.gif\" height=\"16\" width=\"1\" border=\"0\" alt=\"\"></TD></TR><TR><TD colspan=\"3\" bgColor=\"#666699\"><IMG src=\"../../common/spacer.gif\" height=\"1\" width=\"1\" border=\"0\" alt=\"\"></TD></TR>');
  812. document.write('</TABLE></td>');
  813. if (query.length == 0)
  814. document.write("<tr><td colspan='2' class=\"xresult\">Wildcards (* and ?) are supported.<br/>Exact-match phrases are not.</td></tr>");
  815. document.write("</tr></table>");
  816. }
  817. function ZoomShowSearchButton()
  818. {
  819. document.writeln("<input type=\"submit\" value=\"" + STR_FORM_SUBMIT_BUTTON + "\" class=\"zoom_button\" />");
  820. }
  821. function ZoomShowResultsPerPage()
  822. {
  823. document.writeln("<span class=\"zoom_results_per_page\">" + STR_FORM_RESULTS_PER_PAGE + "\n");
  824. document.writeln("<select name=\"zoom_per_page\">");
  825. for (i = 0; i < PerPageOptions.length; i++)
  826. {
  827. document.write("<option");
  828. if (PerPageOptions[i] == per_page)
  829. document.write(" selected=\"selected\"");
  830. document.writeln(">" + PerPageOptions[i] + "</option>");
  831. }
  832. document.writeln("</select><br /><br /></span>");
  833. }
  834. function ZoomShowCategories()
  835. {
  836. if (UseCats) {
  837. document.writeln("<span class=\"zoom_categories\">");
  838. document.write(STR_FORM_CATEGORY + " ");
  839. if (SearchMultiCats)
  840. {
  841. document.writeln("<ul>");
  842. document.write("<li><input type=\"checkbox\" name=\"zoom_cat[]\" value=\"-1\"");
  843. if (cat[0] == -1)
  844. document.write(" checked=\"checked\"");
  845. document.writeln(">" + STR_FORM_CATEGORY_ALL + "</input></li>");
  846. for (i = 0; i < NumCats; i++)
  847. {
  848. document.write("<li><input type=\"checkbox\" name=\"zoom_cat[]\" value=\"" +i+ "\"");
  849. if (cat[0] != -1)
  850. {
  851. for (catit = 0; catit < num_zoom_cats; catit++)
  852. {
  853. if (i == cat[catit])
  854. {
  855. document.write(" checked=\"checked\"");
  856. break;
  857. }
  858. }
  859. }
  860. document.writeln(">"+catnames[i]+"</input></li>");
  861. }
  862. document.writeln("</ul><br /><br />");
  863. }
  864. else
  865. {
  866. document.write("<select name='zoom_cat[]'>");
  867. // 'all cats option
  868. document.write("<option value=\"-1\">" + STR_FORM_CATEGORY_ALL + "</option>");
  869. for (i = 0; i < NumCats; i++) {
  870. document.write("<option value=\"" + i + "\"");
  871. if (i == cat[0])
  872. document.write(" selected=\"selected\"");
  873. document.writeln(">" + catnames[i] + "</option>");
  874. }
  875. document.writeln("</select>&nbsp;&nbsp;");
  876. }
  877. document.writeln("</span>");
  878. }
  879. }
  880. function ZoomShowMetaFields()
  881. {
  882. if (UseMetaFields)
  883. {
  884. document.writeln("<span class=\"zoom_metaform\">");
  885. for (fieldnum = 0; fieldnum < NumMetaFields; fieldnum++)
  886. {
  887. if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_NUMERIC)
  888. document.writeln(metafields[fieldnum][METAFIELD_FORM] + ": <input type=\"text\" name=\"" + metafields[fieldnum][METAFIELD_NAME] + "\" size=\"20\" value=\"" + meta_query[fieldnum] + "\" class=\"zoom_metaform_numeric\" />\n");
  889. else if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_DROPDOWN)
  890. {
  891. document.writeln(metafields[fieldnum][METAFIELD_FORM] + ": <select name=\"" + metafields[fieldnum][METAFIELD_NAME] +"\" class=\"zoom_metaform_dropdown\">\n");
  892. document.writeln("<option value=\"-1\">" + STR_FORM_CATEGORY_ALL + "</option>");
  893. for (ddi = 0; ddi < metafields[fieldnum][METAFIELD_DROPDOWN].length; ddi++)
  894. {
  895. document.writeln("<option value=\"" + ddi + "\"");
  896. if (meta_query[fieldnum] != "" && ddi == meta_query[fieldnum])
  897. document.writeln(" selected=\"selected\"");
  898. document.writeln(">" + metafields[fieldnum][METAFIELD_DROPDOWN][ddi] + "</option>\n");
  899. }
  900. document.writeln("</select>\n");
  901. }
  902. else if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_MULTI)
  903. {
  904. document.writeln(metafields[fieldnum][METAFIELD_FORM] + ": <select multiple name=\"" + metafields[fieldnum][METAFIELD_NAME] +"[]\" class=\"zoom_metaform_multi\">\n");
  905. document.writeln("<option value=\"-1\">" + STR_FORM_CATEGORY_ALL + "</option>");
  906. var num_multi_query, mqi;
  907. num_multi_query = meta_query[fieldnum].length
  908. for (ddi = 0; ddi < metafields[fieldnum][METAFIELD_DROPDOWN].length; ddi++)
  909. {
  910. document.writeln("<option value=\"" + ddi + "\"");
  911. for (mqi = 0; mqi < num_multi_query; mqi++)
  912. {
  913. if (ddi == meta_query[fieldnum][mqi])
  914. document.writeln(" selected=\"selected\"");
  915. }
  916. document.writeln(">" + metafields[fieldnum][METAFIELD_DROPDOWN][ddi] + "</option>\n");
  917. }
  918. document.writeln("</select>\n");
  919. }
  920. else if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_MONEY)
  921. {
  922. document.writeln(metafields[fieldnum][METAFIELD_FORM] + ": " + MetaMoneyCurrency + "<input type=\"text\" name=\"" + metafields[fieldnum][METAFIELD_NAME] + "\" size=\"7\" value=\""+meta_query[fieldnum]+"\" class=\"zoom_metaform_money\" />\n");
  923. }
  924. else
  925. document.writeln(metafields[fieldnum][METAFIELD_FORM] + ": <input type=\"text\" name=\"" + metafields[fieldnum][METAFIELD_NAME] + "\" size=\"20\" value=\""+meta_query[fieldnum]+"\" class=\"zoom_metaform_text\" />\n");
  926. }
  927. document.writeln("</span>\n");
  928. }
  929. }
  930. function ZoomShowMatchOptions()
  931. {
  932. document.writeln("<span class=\"zoom_match\">" + STR_FORM_MATCH + " ");
  933. if (andq == 0) {
  934. document.writeln("<input type=\"radio\" name=\"zoom_and\" value=\"0\" checked=\"checked\" />" + STR_FORM_ANY_SEARCH_WORDS);
  935. document.writeln("<input type=\"radio\" name=\"zoom_and\" value=\"1\" />" + STR_FORM_ALL_SEARCH_WORDS);
  936. } else {
  937. document.writeln("<input type=\"radio\" name=\"zoom_and\" value=\"0\" />" + STR_FORM_ANY_SEARCH_WORDS);
  938. document.writeln("<input type=\"radio\" name=\"zoom_and\" value=\"1\" checked=\"checked\" />" + STR_FORM_ALL_SEARCH_WORDS);
  939. }
  940. document.writeln("<br /><br /></span>");
  941. }
  942. function ZoomShowFormEnd()
  943. {
  944. document.writeln("<input type=\"hidden\" name=\"zoom_sort\" value=\"" + sort + "\" />");
  945. if (FormFormat != 2)
  946. {
  947. document.writeln("<input type=\"hidden\" name=\"zoom_per_page\" value=\"" + per_page + "\" />");
  948. document.writeln("<input type=\"hidden\" name=\"zoom_and\" value=\"" + andq + "\" />");
  949. }
  950. document.writeln("</form>");
  951. }
  952. function ZoomShowSearchForm()
  953. {
  954. if (InitSearchCalled == false)
  955. {
  956. if (IsWarningGiven == false)
  957. document.writeln("<div class=\"results\">This is an advanced template option. You must call ZoomInitSearch() before this. Please check documentation for more help.</div>");
  958. IsWarningGiven = true;
  959. return;
  960. }
  961. // Display the form
  962. if (FormFormat > 0)
  963. {
  964. ZoomShowFormStart();
  965. ZoomShowSearchBox();
  966. /* ZoomShowSearchButton();
  967. */
  968. if (FormFormat == 2)
  969. {
  970. /* ZoomShowResultsPerPage();
  971. // ZoomShowMatchOptions();
  972. // ZoomShowCategories();
  973. // ZoomShowMetaFields();
  974. */
  975. }
  976. ZoomShowFormEnd();
  977. }
  978. }
  979. function ZoomShowHeading()
  980. {
  981. if (InitSearchCalled == false)
  982. {
  983. if (IsWarningGiven == false)
  984. document.writeln("<div class=\"results\">This is an advanced template option. You must call ZoomInitSearch() before this. Please check documentation for more help.</div>");
  985. IsWarningGiven = true;
  986. return;
  987. }
  988. if (IsNoSearch)
  989. return;
  990. document.write("<div class=\"searchheading\">" + STR_RESULTS_FOR + " " + queryForHTML);
  991. if (UseCats) {
  992. if (cat[0] == -1)
  993. {
  994. document.writeln(" " + STR_RESULTS_IN_ALL_CATEGORIES);
  995. query_zoom_cats = "&amp;zoom_cat%5B%5D=-1";
  996. }
  997. else
  998. {
  999. document.writeln(" " + STR_RESULTS_IN_CATEGORY + " ");
  1000. for (catit = 0; catit < num_zoom_cats; catit++)
  1001. {
  1002. if (catit > 0)
  1003. document.write(", ");
  1004. document.write("\"" + catnames[cat[catit]] + "\"");
  1005. query_zoom_cats += "&amp;zoom_cat%5B%5D="+cat[catit];
  1006. }
  1007. }
  1008. }
  1009. document.writeln("<br /><br /></div>");
  1010. }
  1011. function ZoomShowResults()
  1012. {
  1013. if (InitSearchCalled == false)
  1014. {
  1015. if (IsWarningGiven == false)
  1016. document.writeln("<div class=\"results\">This is an advanced template option. You must call ZoomInitSearch() before this. Please check documentation for more help.</div>");
  1017. IsWarningGiven = true;
  1018. return;
  1019. }
  1020. if (IsNoSearch)
  1021. {
  1022. if (ZoomInfo == 1)
  1023. document.writeln("<center><p><small>" + STR_POWEREDBY + " <a href=\"http://www.wrensoft.com/zoom/\" zoom_target=\"_blank\"><b>Zoom Search Engine</b></a></small></p></center>");
  1024. return;
  1025. }
  1026. document.writeln("<div class=\"results\">");
  1027. // determine current line of result from the output array
  1028. if (page == 1) {
  1029. arrayline = 0;
  1030. } else {
  1031. arrayline = ((page - 1) * per_page);
  1032. }
  1033. // the last result to show on this page
  1034. result_limit = arrayline + per_page;
  1035. // display the results
  1036. while (arrayline < matches && arrayline < result_limit) {
  1037. ipage = output[arrayline][0];
  1038. score = output[arrayline][1];
  1039. pgurl = pagedata[ipage][PAGEDATA_URL];
  1040. pgtitle = pagedata[ipage][PAGEDATA_TITLE];
  1041. pgdesc = pagedata[ipage][PAGEDATA_DESC];
  1042. pgimage = pagedata[ipage][PAGEDATA_IMG];
  1043. urlLink = pgurl;
  1044. if (GotoHighlight == 1)
  1045. {
  1046. if (SearchAsSubstring == 1)
  1047. urlLink = AddParamToURL(urlLink, "zoom_highlightsub=" + queryForURL);
  1048. else
  1049. urlLink = AddParamToURL(urlLink, "zoom_highlight=" + queryForURL);
  1050. }
  1051. if (PdfHighlight == 1)
  1052. {
  1053. if (urlLink.toLowerCase().indexOf(".pdf") != -1)
  1054. urlLink = urlLink+"#search=&quot;"+query+"&quot;";
  1055. }
  1056. if (arrayline % 2 == 0)
  1057. document.writeln("<div class=\"result_block\">");
  1058. else
  1059. document.writeln("<div class=\"result_altblock\">");
  1060. if (pageinfo[ipage][PAGEINFO_LINKACTION] == 1)
  1061. target = " target=\"_blank\"";
  1062. else
  1063. target = zoom_target;
  1064. if (UseZoomImage == 1)
  1065. {
  1066. if (pgimage.length > 1)
  1067. {
  1068. document.writeln("<div class=\"result_image\">");
  1069. document.writeln("<a href=\"" + urlLink + "\"" + target + "><img src=\"" + pgimage + "\" alt=\"\" class=\"result_image\" /></a>");
  1070. document.writeln("</div>");
  1071. }
  1072. }
  1073. document.writeln("<div class=\"result_title\">");
  1074. if (DisplayNumber == 1)
  1075. document.writeln("<b>" + (arrayline+1) + ".</b>&nbsp;");
  1076. if (DisplayTitle == 1)
  1077. {
  1078. document.writeln("<a href=\"" + urlLink + "\"" + target + ">");
  1079. PrintHighlightDescription(pgtitle);
  1080. document.writeln("</a>");
  1081. }
  1082. else
  1083. document.writeln("<a href=\"" + urlLink + "\"" + target + ">" + pgurl + "</a>");
  1084. if (UseCats)
  1085. {
  1086. catpage = pageinfo[ipage][PAGEINFO_CAT];
  1087. document.write("<span class=\"category\">");
  1088. for (cati = 0; cati < NumCats; cati++)
  1089. {
  1090. if (catpage.charAt(cati) == "1")
  1091. document.write(" ["+catnames[cati]+"]");
  1092. }
  1093. document.writeln("</span>");
  1094. }
  1095. document.writeln("</div>");
  1096. if (UseMetaFields == 1 && DisplayMetaFields == 1)
  1097. {
  1098. var cssFieldName, cssValueName;
  1099. for (fieldnum = 0; fieldnum < NumMetaFields; fieldnum++)
  1100. {
  1101. cssFieldName = "result_metaname_" + metafields[fieldnum][METAFIELD_NAME];
  1102. cssValueName = "result_metavalue_" + metafields[fieldnum][METAFIELD_NAME];
  1103. if (GetMetaValues(ipage, fieldnum) != null)
  1104. {
  1105. if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_DROPDOWN)
  1106. {
  1107. document.writeln("<div class =\"result_custommeta\">");
  1108. document.writeln("<span class=\""+cssFieldName+"\">"+metafields[fieldnum][METAFIELD_SHOW]+": </span>");
  1109. document.write("<span class=\""+cssValueName+"\">");
  1110. var ddi = GetMetaValues(ipage, fieldnum);
  1111. document.writeln(metafields[fieldnum][METAFIELD_DROPDOWN][ddi]+"</span></div>");
  1112. }
  1113. else if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_MULTI)
  1114. {
  1115. var metaVal = GetMetaValues(ipage,fieldnum);
  1116. if (metaVal.length > 0)
  1117. {
  1118. document.writeln("<div class =\"result_custommeta\">");
  1119. document.writeln("<span class=\""+cssFieldName+"\">"+metafields[fieldnum][METAFIELD_SHOW]+": </span>");
  1120. document.write("<span class=\""+cssValueName+"\">");
  1121. var ddarray = metafields[fieldnum][METAFIELD_DROPDOWN];
  1122. for (mvi = 0; mvi < metaVal.length; mvi++)
  1123. {
  1124. if (mvi > 0)
  1125. document.write(", ");
  1126. document.write(ddarray[metaVal[mvi]]);
  1127. }
  1128. document.write("</span></div>");
  1129. }
  1130. }
  1131. else if (metafields[fieldnum][METAFIELD_TYPE] == METAFIELD_TYPE_MONEY)
  1132. {
  1133. document.writeln("<div class =\"result_custommeta\">");
  1134. document.writeln("<span class=\""+cssFieldName+"\">"+metafields[fieldnum][METAFIELD_SHOW]+": </span>");
  1135. var tmpMoneyStr = "";
  1136. if (MetaMoneyShowDec == 1)
  1137. tmpMoneyStr = (GetMetaValues(ipage, fieldnum)/100).toFixed(2);
  1138. else
  1139. tmpMoneyStr = GetMetaValues(ipage, fieldnum);
  1140. document.writeln("<span class=\""+cssValueName+"\">"+MetaMoneyCurrency+tmpMoneyStr+"</span></div>");
  1141. }
  1142. else
  1143. {
  1144. document.writeln("<div class =\"result_custommeta\">");
  1145. document.writeln("<span class=\""+cssFieldName+"\">"+metafields[fieldnum][METAFIELD_SHOW]+": </span>");
  1146. document.writeln("<span class=\""+cssValueName+"\">"+GetMetaValues(ipage, fieldnum)+"</span></div>");
  1147. }
  1148. }
  1149. }
  1150. }
  1151. if (DisplayMetaDesc == 1)
  1152. {
  1153. // print meta description
  1154. document.writeln("<div class=\"description\">");
  1155. PrintHighlightDescription(pgdesc);
  1156. document.writeln("</div>\n");
  1157. }
  1158. info_str = "";
  1159. if (DisplayTerms == 1)
  1160. info_str += STR_RESULT_TERMS_MATCHED + " " + output[arrayline][2];
  1161. if (DisplayScore == 1) {
  1162. if (info_str.length > 0)
  1163. info_str += "&nbsp; - &nbsp;";
  1164. info_str += STR_RESULT_SCORE + " " + score;
  1165. }
  1166. if (DisplayDate == 1)
  1167. {
  1168. pgdate = pageinfo[ipage][PAGEINFO_DATETIME];
  1169. if (pgdate > 0)
  1170. {
  1171. datetime = new Date(pgdate*1000);
  1172. if (info_str.length > 0)
  1173. info_str += "&nbsp; - &nbsp;";
  1174. info_str += datetime.getDate() + " " + months[datetime.getMonth()] + " " + datetime.getFullYear();
  1175. }
  1176. }
  1177. if (DisplayFilesize == 1)
  1178. {
  1179. filesize = pageinfo[ipage][PAGEINFO_FILESIZE];
  1180. filesize = Math.ceil(filesize / 1024);
  1181. if (filesize < 1)
  1182. filesize = 1;
  1183. if (info_str.length > 0)
  1184. info_str += "&nbsp; - &nbsp;";
  1185. info_str += filesize + "k";
  1186. }
  1187. if (DisplayURL == 1) {
  1188. if (info_str.length > 0)
  1189. info_str += "&nbsp; - &nbsp;";
  1190. if (TruncateShowURL > 0)
  1191. {
  1192. if (pgurl.length > TruncateShowURL)
  1193. pgurl = pgurl.substr(0, TruncateShowURL) + "...";
  1194. }
  1195. info_str += STR_RESULT_URL + " " + pgurl;
  1196. }
  1197. document.writeln("<div class=\"infoline\">");
  1198. document.writeln(info_str);
  1199. document.writeln("</div></div>\n");
  1200. arrayline++;
  1201. }
  1202. document.writeln("</div>"); // end results style tag
  1203. }
  1204. function ZoomShowSummary()
  1205. {
  1206. if (InitSearchCalled == false)
  1207. {
  1208. if (IsWarningGiven == false)
  1209. document.writeln("<div class=\"results\">This is an advanced template option. You must call ZoomInitSearch() before this. Please check documentation for more help.</div>");
  1210. IsWarningGiven = true;
  1211. return;
  1212. }
  1213. if (IsNoSearch)
  1214. return;
  1215. if (SkippedWords > 0)
  1216. document.writeln("<div class=\"summary\">" + STR_SKIPPED_FOLLOWING_WORDS + " " + SkippedOutputStr + ".<br /><br /></div>");
  1217. //Display search result information
  1218. document.writeln("<div class=\"summary\">");
  1219. if (matches == 0)
  1220. document.writeln(STR_SUMMARY_NO_RESULTS_FOUND + "<br />");
  1221. else if (NumSearchWords > 1 && andq == 0) {
  1222. //OR
  1223. SomeTermMatches = matches - fullmatches;
  1224. document.writeln(PrintNumResults(fullmatches) + " " + STR_SUMMARY_FOUND_CONTAINING_ALL_TERMS + " ");
  1225. if (SomeTermMatches > 0)
  1226. document.writeln(PrintNumResults(SomeTermMatches) + " " + STR_SUMMARY_FOUND_CONTAINING_SOME_TERMS);
  1227. document.writeln("<br />");
  1228. }
  1229. else if (NumSearchWords > 1 && andq == 1) //AND
  1230. document.writeln(PrintNumResults(fullmatches) + " " + STR_SUMMARY_FOUND_CONTAINING_ALL_TERMS + "<br />");
  1231. else
  1232. document.writeln(PrintNumResults(matches) + " " + STR_SUMMARY_FOUND + "<br />");
  1233. document.writeln("</div>\n");
  1234. }
  1235. function ZoomShowCatSummary()
  1236. {
  1237. if (UseCats == 0 || DisplayCatSummary == 0 || CatCounterFilled == 0)
  1238. return;
  1239. if (InitSearchCalled == false)
  1240. {
  1241. if (IsWarningGiven == false)
  1242. document.writeln("<div class=\"results\">This is an advanced template option. You must call ZoomInitSearch() before this. Please check documentation for more help.</div>");
  1243. IsWarningGiven = true;
  1244. return;
  1245. }
  1246. if (IsNoSearch)
  1247. return;
  1248. var ShowCatSummaryHeading = true;
  1249. for (catit = 0; catit < NumCats; catit++)
  1250. {
  1251. if (CatCounter[catit] > 0)
  1252. {
  1253. // if all the results found belonged to this one category, then we don't show a cat summary at all
  1254. if (CatCounter[catit] != matches)
  1255. {
  1256. if (ShowCatSummaryHeading == true)
  1257. {
  1258. document.writeln("<div class=\"cat_summary\"><br />" + STR_CAT_SUMMARY + "<ul>");
  1259. ShowCatSummaryHeading = false;
  1260. }
  1261. document.writeln("<li><a href=\"" + SelfURL + "?zoom_query=" + queryForURL + metaParams + "&amp;zoom_cat%5B%5D=" + catit + "&amp;zoom_per_page=" + per_page + "&amp;zoom_and=" + andq + "&amp;zoom_sort=" + sort + "\">" + catnames[catit]);
  1262. document.writeln("</a> (" + CatCounter[catit] + ")</li>");
  1263. }
  1264. }
  1265. }
  1266. if (DisplayCatSummary == 1)
  1267. document.writeln("</ul></div>");
  1268. }
  1269. function ZoomShowPagesCount()
  1270. {
  1271. if (InitSearchCalled == false)
  1272. {
  1273. if (IsWarningGiven == false)
  1274. document.writeln("<div class=\"results\">This is an advanced template option. You must call ZoomInitSearch() before this. Please check documentation for more help.</div>");
  1275. IsWarningGiven = true;
  1276. return;
  1277. }
  1278. if (IsNoSearch)
  1279. return;
  1280. /* if (num_pages > 1)
  1281. // document.writeln("<div class=\"result_pagescount\"><br />" + num_pages + " " + STR_PAGES_OF_RESULTS + "</div>\n");
  1282. */
  1283. }
  1284. function RecLinkWordMatch(rec_word, rec_idx)
  1285. {
  1286. var bRecLinkFound = false;
  1287. for (sw = 0; sw <= NumSearchWords; sw++)
  1288. {
  1289. if (sw == NumSearchWords)
  1290. {
  1291. match_result = wordcasecmp(rec_word, queryForSearch);
  1292. }
  1293. else
  1294. {
  1295. if (UseWildCards[sw] == 1)
  1296. {
  1297. if (SearchAsSubstring == 0)
  1298. pattern = "^" + RegExpSearchWords[sw] + "$";
  1299. else
  1300. pattern = RegExpSearchWords[sw];
  1301. re = new RegExp(pattern, "g");
  1302. match_result = rec_word.search(re);
  1303. }
  1304. else if (SearchAsSubstring == 0)
  1305. {
  1306. match_result = wordcasecmp(rec_word, searchWords[sw]);
  1307. }
  1308. else
  1309. match_result = rec_word.indexOf(searchWords[sw]);
  1310. if (match_result == -1)
  1311. {
  1312. if (rec_word.indexOf("*") != -1 || rec_word.indexOf("?") != -1)
  1313. {
  1314. var RecWordRegExp = "^" + pattern2regexp(rec_word) + "$";
  1315. re = new RegExp(RecWordRegExp, "g");
  1316. match_result = searchWords[sw].search(re);
  1317. }
  1318. }
  1319. }
  1320. if (match_result != -1)
  1321. {
  1322. bRecLinkFound = true;
  1323. if (num_recs_found == 0)
  1324. {
  1325. document.writeln("<div class=\"recommended\">");
  1326. document.writeln("<div class=\"recommended_heading\">" + STR_RECOMMENDED + "</div>");
  1327. }
  1328. pgurl = pagedata[rec_idx][PAGEDATA_URL];
  1329. pgtitle = pagedata[rec_idx][PAGEDATA_TITLE];
  1330. pgdesc = pagedata[rec_idx][PAGEDATA_DESC];
  1331. pgimage = pagedata[rec_idx][PAGEDATA_IMG];
  1332. urlLink = pgurl;
  1333. if (GotoHighlight == 1)
  1334. {
  1335. if (SearchAsSubstring == 1)
  1336. urlLink = AddParamToURL(urlLink, "zoom_highlightsub=" + queryForURL);
  1337. else
  1338. urlLink = AddParamToURL(urlLink, "zoom_highlight=" + queryForURL);
  1339. }
  1340. if (PdfHighlight == 1)
  1341. {
  1342. if (urlLink.toLowerCase().indexOf(".pdf") != -1)
  1343. urlLink = urlLink+"#search=&quot;"+query+"&quot;";
  1344. }
  1345. document.writeln("<div class=\"recommend_block\">");
  1346. if (UseZoomImage == 1)
  1347. {
  1348. if (pgimage.length > 1)
  1349. {
  1350. document.writeln("<div class=\"recommend_image\">");
  1351. document.writeln("<a href=\"" + urlLink + "\"" + zoom_target + "><img src=\"" + pgimage + "\" alt=\"\" class=\"recommend_image\"></a>");
  1352. document.writeln("</div>");
  1353. }
  1354. }
  1355. document.writeln("<div class=\"recommend_title\">");
  1356. document.writeln("<a href=\"" + urlLink + "\"" + zoom_target + ">");
  1357. if (pgtitle.length > 1)
  1358. PrintHighlightDescription(pgtitle);
  1359. else
  1360. PrintHighlightDescription(pgurl);
  1361. document.writeln("</a></div>");
  1362. document.writeln("<div class=\"recommend_description\">")
  1363. PrintHighlightDescription(pgdesc);
  1364. document.writeln("</div>");
  1365. document.writeln("<div class=\"recommend_infoline\">" + pgurl + "</div>");
  1366. document.writeln("</div>");
  1367. num_recs_found++;
  1368. break;
  1369. }
  1370. }
  1371. return bRecLinkFound;
  1372. }
  1373. function ZoomShowRecommended()
  1374. {
  1375. if (InitSearchCalled == false)
  1376. {
  1377. if (IsWarningGiven == false)
  1378. document.writeln("<div class=\"results\">This is an advanced template option. You must call ZoomInitSearch() before this. Please check documentation for more help.</div>");
  1379. IsWarningGiven = true;
  1380. return;
  1381. }
  1382. if (IsNoSearch)
  1383. return;
  1384. // Show recommended links if any
  1385. if (Recommended == 1)
  1386. {
  1387. num_recs_found = 0;
  1388. rec_count = recommended.length;
  1389. for (rl = 0; rl < rec_count && num_recs_found < RecommendedMax; rl++)
  1390. {
  1391. sep = recommended[rl].lastIndexOf(" ");
  1392. if (sep > -1)
  1393. {
  1394. rec_word = recommended[rl].slice(0, sep);
  1395. rec_idx = parseInt(recommended[rl].slice(sep));
  1396. if (rec_word.indexOf(",") != -1)
  1397. {
  1398. rec_multiwords = rec_word.split(",");
  1399. for (rlm = 0; rlm < rec_multiwords.length; rlm++)
  1400. {
  1401. if (RecLinkWordMatch(rec_multiwords[rlm], rec_idx))
  1402. break;
  1403. }
  1404. }
  1405. else
  1406. RecLinkWordMatch(rec_word, rec_idx);
  1407. }
  1408. }
  1409. if (num_recs_found > 0)
  1410. document.writeln("</div>");
  1411. }
  1412. }
  1413. function ZoomShowSorting()
  1414. {
  1415. if (InitSearchCalled == false)
  1416. {
  1417. if (IsWarningGiven == false)
  1418. document.writeln("<div class=\"results\">This is an advanced template option. You must call ZoomInitSearch() before this. Please check documentation for more help.</div>");
  1419. IsWarningGiven = true;
  1420. return;
  1421. }
  1422. if (IsNoSearch)
  1423. return;
  1424. // Show sorting options
  1425. if (matches > 1)
  1426. {
  1427. if (UseDateTime == 1)
  1428. {
  1429. document.writeln("<div class=\"sorting\">");
  1430. if (sort == 1)
  1431. document.writeln("<a href=\"" + SelfURL + "?zoom_query=" + queryForURL + metaParams + "&amp;zoom_page=" + page + "&amp;zoom_per_page=" + per_page + query_zoom_cats + "&amp;zoom_and=" + andq + "&amp;zoom_sort=0\">" + STR_SORTBY_RELEVANCE + "</a> / <b>" + STR_SORTEDBY_DATE + "</b>");
  1432. else
  1433. document.writeln("<b>" + STR_SORTEDBY_RELEVANCE + "</b> / <a href=\"" + SelfURL + "?zoom_query=" + queryForURL + metaParams + "&amp;zoom_page=" + page + "&amp;zoom_per_page=" + per_page + query_zoom_cats + "&amp;zoom_and=" + andq + "&amp;zoom_sort=1\">" + STR_SORTBY_DATE + "</a>");
  1434. document.writeln("</div>");
  1435. }
  1436. }
  1437. }
  1438. function ZoomShowPageNumbers()
  1439. {
  1440. var buttonPrevious = '<img src="../../common/bb_bx.gif" alt="Previous Topic" border="0">';
  1441. var buttonNext = '<img src="../../common/ff_bx.gif" alt="Next Topic" border="0">';
  1442. if (InitSearchCalled == false)
  1443. {
  1444. if (IsWarningGiven == false)
  1445. document.writeln("<div class=\"results\">This is an advanced template option. You must call ZoomInitSearch() before this. Please check documentation for more help.</div>");
  1446. IsWarningGiven = true;
  1447. return;
  1448. }
  1449. if (IsNoSearch)
  1450. return;
  1451. // Show links to other result pages
  1452. if (num_pages > 1)
  1453. {
  1454. // 10 results to the left of the current page
  1455. start_range = page - 10;
  1456. if (start_range < 1)
  1457. start_range = 1;
  1458. // 10 to the right
  1459. end_range = page + 10;
  1460. if (end_range > num_pages)
  1461. end_range = num_pages;
  1462. document.writeln("<div class=\"result_pages\">" + STR_RESULT_PAGES + " ");
  1463. if (page > 1)
  1464. document.writeln("<a href=\"" + SelfURL + "?zoom_query=" + queryForURL + metaParams + "&amp;zoom_page=" + (page-1) + "&amp;zoom_per_page=" + per_page + query_zoom_cats + "&amp;zoom_and=" + andq + "&amp;zoom_sort=" + sort + "\"> " + buttonPrevious + "</a> ");
  1465. for (i = start_range; i <= end_range; i++)
  1466. {
  1467. if (i == page)
  1468. document.writeln(page + " ");
  1469. else
  1470. document.writeln("<a href=\"" + SelfURL + "?zoom_query=" + queryForURL + metaParams + "&amp;zoom_page=" + i + "&amp;zoom_per_page=" + per_page + query_zoom_cats + "&amp;zoom_and=" + andq + "&amp;zoom_sort=" + sort + "\">" + i + "</a> ");
  1471. }
  1472. if (page != num_pages)
  1473. document.writeln("<a href=\"" + SelfURL + "?zoom_query=" + queryForURL + metaParams + "&amp;zoom_page=" + (page+1) + "&amp;zoom_per_page=" + per_page + query_zoom_cats + "&amp;zoom_and=" + andq + "&amp;zoom_sort=" + sort + "\">" + buttonNext + " </a> ");
  1474. document.writeln("</div>");
  1475. }
  1476. if (ZoomInfo == 1)
  1477. 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>");
  1478. }
  1479. function ZoomShowSearchTime()
  1480. {
  1481. if (InitSearchCalled == false)
  1482. {
  1483. if (IsWarningGiven == false)
  1484. document.writeln("<div class=\"results\">This is an advanced template option. You must call ZoomInitSearch() before this. Please check documentation for more help.</div>");
  1485. IsWarningGiven = true;
  1486. return;
  1487. }
  1488. if (IsNoSearch)
  1489. return;
  1490. if (Timing == 1)
  1491. document.writeln("<div class=\"searchtime\"><br /><br />" + STR_SEARCH_TOOK + " " + (timeDifference/1000) + " " + STR_SECONDS + ".</div>\n");
  1492. }
  1493. // This is the default function and it's all you need to call for the normal result format
  1494. function ZoomSearch()
  1495. {
  1496. ZoomInitSearch();
  1497. ZoomShowSearchForm();
  1498. ZoomShowHeading();
  1499. ZoomShowSummary();
  1500. ZoomShowCatSummary();
  1501. ZoomShowPagesCount();
  1502. ZoomShowRecommended();
  1503. ZoomShowSorting();
  1504. ZoomShowResults();
  1505. ZoomShowPageNumbers();
  1506. ZoomShowSearchTime();
  1507. }