function Page(url,title,keywords,description) { 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; this.description = description; return this; } function Database() { var pos = 0; while ((pos1 = amorphous.indexOf("~",pos)) != -1) { pos2 = amorphous.indexOf("|",pos1+1); pos3 = amorphous.indexOf("^",pos2+1); pos4 = amorphous.indexOf("*",pos3+1); if ((pos2 != -1) && (pos2 < pos3) && (pos3 < pos4) && (pos4 <= amorphous.indexOf("*",pos))) { this[database_length++] = new Page(amorphous.substring(pos,pos1), amorphous.substring(pos1+1,pos2), amorphous.substring(pos2+1,pos3), amorphous.substring(pos3+1,pos4)); pos = pos4+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;q0?menu_length:database_length); for (n=0; n0) { combo = (menu[n].title + " " + menu[n].description + " " + menu[n].keywords).toLowerCase(); } else { combo = (database[n].title + " " + database[n].description + " " + 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" + str.substring(pos+1,str.length); pos = -7; while ((pos = str.toLowerCase().indexOf("|",pos+7)) != -1) str = str.substring(0,pos) + "" + str.substring(pos+1,str.length); return str; }