PROBLEM: Have a simple Javascript search engine which works in Firefox 2.0.0.16 but not in Internet Explorer 7.0.5730.13

QUESTION: Of course, I want this baby to also work in IE - well, as many browser types & versions as possible really but at least FF2 & IE 7 onwards. Of course I've tried to poke around and hack this to do that but to no avail...
I have a sinking feeling that it is going to be something simple like some ";" I've missed somewhere - I am however looking forward to someone with a better eye for detail seeing this & pointing it out in record time
So thanks in advanced!

BACKGROUND: This script basically allows the user to type in a search term & get a ranked list of webpages which may be most relevant to their needs. Try it out in FF first then in IE and you'll see what I mean.

Code:
<head>
<SCRIPT LANGUAGE="JavaScript">
var item = new Array();
// "Page Name","path","Page Title","Many,Key,Words","Descriptive Comments"
c=0; item[c]=new Array("helpIndex.shtml","","Help Home","Help Overview. ","Overview of Help as well as how to use it.");
c++; item[c]=new Array("overviewAdmin.shtml","","Administrative Task Overview","Administrative tasks blah blah blah","Administrative tasks blah blah blah");
c++; item[c]=new Array("links.htm","","Links page","links,more,where,similar,friends","Links to my favourite sites which I find interesting. Other friends sites which have similar interests to my own.");
c++; item[c]=new Array("main.htm","main/","Main Page","content,main,focus","The main part of my site which contains what you have come to see. Lots of stuff like that and more great things. All in a sub directory.");
c++; item[c]=new Array("logo.jpg","main/images/","Link Logo","link,image,logo,graphic","The logo.jpg is just a small image which you can place on your site as a link to me. It's in a second level subdirectory. site which contains what you have come to see. Lots of stuff like that and more great things. All in site which contains what you have come to see. Lots of stuff like that and more great things. All in site which contains what you have come to see. Lots of stuff like that and more great things. All in site which contains what you have come to see. Lots of stuff like that and more great things. All in site which contains what you have come to see. Lots of stuff like that and more great things. All in site which contains what you have come to see. Lots of stuff like that and more great things. All in site which contains what you have come to see. Lots of stuff like that and more great things. All in site which contains what you have come to see. Lots of stuff like that and more great things. All in ");

page="<html><head><title>Search Results</title></head><body bgcolor='white'><center><table border=0>";

function search(frm) {
document.write(page);
txt = frm.srchval.value.split(" ");
fnd = new Array(); total=0;
for (i = 0; i < item.length; i++) {
fnd[i] = 0; order = new Array(0, 4, 2, 3);
for (j = 0; j < order.length; j++)
for (k = 0; k < txt.length; k++)
if (item[i][order[j]].toLowerCase().indexOf(txt[k]) > -1 && txt[k] != "")
fnd[i] += (j+1);
}
for (i = 0; i < fnd.length; i++) {
n = 0; w = -1;
for (j = 0;j < fnd.length; j++)
if (fnd[j] > n) { n = fnd[j]; w = j; };
if (w > -1) total += show(w, n);
fnd[w] = 0;
}
document.write("<tr><td><br/><font face=arial size=2 color=#999999>Total found: "+total+"</font></td></tr><tr><td bgcolor=#B3B5FF><a href=\"javascript:history.go(-1)\"><font face=arial>Search Again</font></a></td></tr><tr><td bgcolor=#696DFF><a href=\"helpIndex.shtml\"><font face=arial>Return to Help Home</font></a></td></tr></table></body></html>");
document.close();
}
function show(which,num) {
link = item[which][1] + item[which][0]; 
line = "<tr><td><font face=arial><a href='"+link+"'>"+item[which][2]+"</a> <font size=1 color=#999999>Relevance Score: "+num+"</font></font><br>";
//line += item[which][4] + "<br>"+link+"</td></tr>";
line += item[which][4] + "</td></tr>";
document.write(line);
return 1;
}
</script>
</HEAD>

<body>

<center>
<br/>
<form method=get action="javascript:void(0)" onsubmit="search(this); return false;">
<tr><td><input type=text name=srchval value=""><input type=submit value="Search"></td></tr>
</form>
</center>
</body>
Any suggestion(s) on how to get this working in IE??