//No part of this Document may be transmitted in any form or by any means 
//electronic or mechanical, including photocopying, recording or by any information 
//storage or retrieval  system without permission in writing from Omfax Ltd. © OMFAX LTD 2006
<!--
// ************ NO NEED TO MODIFY ANYTHING BELOW THIS POINT ************

function Page(url,title,keywords) {
 while ((url.length > 0) && (url.charAt(0) == " ")) {
  url = url.substring(1,url.length);
 }
 this.url = url;
 while ((title.length > 0) && (title.charAt(0) == " ")) {
  title = title.substring(1,title.length);
 }
 this.title = title;
 this.keywords = keywords;
 return this;
}
function Database() {
 var pos = 0;
 while ((pos1 = amorphous.indexOf("~",pos)) != -1) {
  pos2 = amorphous.indexOf("|",pos1+1);
  pos3 = amorphous.indexOf("*",pos2+1);
  if ((pos2 != -1)
  && (pos2 < pos3) && (pos3 <= amorphous.indexOf("*",pos))) {
   this[database_length++] = new Page(amorphous.substring(pos,pos1),
   amorphous.substring(pos1+1,pos2),
   amorphous.substring(pos2+1,pos3));
   pos = pos3+1;
  } else { // error reading amorphous database
   if (pos+30 <= amorphous.length)
    alert('Error reading in amorphous database around "'
     + amorphous.substring(pos,pos+30) + '"');
   pos = amorphous.indexOf("*",pos) + 1;
  }
 }
 return this;
}
function search(str) {
 menu_length = 0;
 temp = new Object();
 temp_length = 0;
 words_length = 0;
 words = new Object();
 pos = 0;
 while ((pos = str.indexOf(" ")) != -1
 && and_search != "exact") {
  words[words_length] = str.substring(0,pos);
  if (words[words_length].length > 0)
   words_length++;
  if (str.length == 1)
   str="";
  else
   str = str.substring(pos+1,str.length);
 }
 if (str.length > 0)
  words[words_length++] = str;
 for (q=0;q<words_length;q++) {
  temp_length = 0;
  str = words[q].toLowerCase();
  len = (and_search=="and"&&q>0?menu_length:database_length);
  for (n=0; n<len; n++) {
   if (and_search=="and"&&q>0) {
    combo = (menu[n].title + " " + menu[n].keywords).toLowerCase();
   } else {
    combo = (database[n].title + " " + database[n].keywords).toLowerCase();
   }
   if (combo.indexOf(str) != -1) // found
    temp[temp_length++] = (and_search=="and"&&q>0?menu[n]:database[n]);
  }
  if (and_search!="and" && q>0) {
   added = 0;
   for (i=0;i<temp_length;i++) {
    duplicate = false;
    for (j=0;j<menu_length&&!duplicate;j++) {
     if (menu[j] == temp[i]) {
      duplicate = true;
     }
    }
    if (!duplicate)
     menu[menu_length+(added++)] = temp[i];
   }
   menu_length += added;
  } else {
   for(h=0;h<temp_length;h++)
    menu[h] = temp[h];
   menu_length = temp_length;
  }
 }
}
function entry() {
 if ((document.entryform.keyword.value.length == 0)
 || (document.entryform.keyword.value == " ")) {
  ;
  return false;
 }
 and_search = (document.entryform.and_or.selectedIndex == 0?"and":"or");
 if (document.entryform.and_or.selectedIndex == 2)
  and_search = "exact";
 if (version >= 1.1) {
  search(document.entryform.keyword.value);
  if (menu_length == 0)
   menu[menu_length++] = new Page("","Sorry keyword was not found!","");
  document.display.found.options.length = menu_length;
  for (n=0; n<menu_length; n++) {
   if (menu[n].title.length <= 50)
    document.display.found.options[n].text = menu[n].title;
   else
    document.display.found.options[n].text = menu[n].title.substring(0,50);
   document.display.found.options[n].value = menu[n].url;
  }
 } else {
  location.href = location.pathname + "?"
   + escape(document.entryform.keyword.value)
   + (and_search != "or"?"&"+and_search:"");
 }
 return false;
}
function go_there() {
 sel = document.display.found.selectedIndex;
 if ((sel != -1) && (document.display.found.options[sel].value.length > 0))
  window.location.href = document.display.found.options[sel].value;
}

var amorphous = document.database.list.value;
temp_str = amorphous.substring(amorphous.length-2,amorphous.length);
if (temp_str.indexOf("*") == -1)
 amorphous += "* ";
else
 amorphous += " "; // amorphous database must have characters after last asterisk

database_length = 0; // Netscape 2 fix
var database = new Database(); // read in from amorphous database

menu_length = 0; // Netscape 2 fix
var menu = new Object();

string = "";
and_search = "and";
if (location.search.length > 1) {
 string = unescape(location.search.substring(1,location.search.length));
 pos = 0;
 while ((pos = string.indexOf('"',pos)) != -1) {
  string = string.substring(0,pos) + '\\"' + string.substring(pos+1,string.length);
  pos += 2;
 }
 if (string.substring(string.length-4,string.length) == "&and") {
  string = string.substring(0,string.length-4);
  and_search = "and";
 } else if (string.substring(string.length-6,string.length) == "&exact") {
  string = string.substring(0,string.length-6);
  and_search = "exact";
 } else  if (string.substring(string.length-3,string.length) == "&or") {
  string = string.substring(0,string.length-3);
  and_search = "or";
 }
 search(string);
}
document.write('<div id="formbox"><p class="subheading">Search repairs book</p><p>1. Type a keyword:</p><form name="entryform" onSubmit="return entry()">'
 +'<input type="text" size=15  name="keyword" value="'+string+'" onKeyup="entry()"><br /> '
 +'<select name="and_or"'
 +'size=1 style="display:none" >'
 +'<option'+(and_search=="and"?" selected":"")+'>find all words '
 +'<option'+(and_search=="or"?" selected":"")+'>find any word '
 +'<option'+(and_search=="exact"?" selected":"")+'>exact match</select></form>'
 +'<p>2. Select a topic:</p><form name="display"><select name="found" size="4" ondblClick="go_there()">\n');
for (n=0; n<menu_length; n++)
 document.write('<option value="'+menu[n].url+'">'+menu[n].title+'\n');
if ((menu_length == 0) && (location.search.length <1))
 document.write('<option value="">&nbsp;\n');
else if ((menu_length == 0) && (location.search.length > 1))
 document.write('<option value="">Keyword "'
  +location.search.substring(1,location.search.length)+'" not found!\n');
document.write('</select><p>3. Press:<input id="submit" type="button" onClick="go_there()"'
 +'value="Go there"></p></form></div>');
// -->
