Hi all,

i need some help with the following javascript, as it is not my expertise.
This script works, but I need to build on it and make it better and more professional and efficient.

<html>
<body>

<script type=text/javascript>
<!--

var q = "build some links 2 answers.com; and don't make the unwanted characters and numbers (77) . into links,";

q = q.toLowerCase(); // if possible i would like the case converted back to original state before writing the result

// q = q.replace(/[^a-zA-Z 0-9]+/g,'');
q = q.replace(/[^a-zA-Z 0-9&%#;.]+/g,'');

var temp = new Array();

var ch1 = "&#39;";
var ch2 = "&quot;";
var ch3 = ";";
var ch4 = "0";
var ch5 = "1";
var ch6 = "2";
var ch7 = "3";
var ch8 = "4";
var ch9 = "5";
var ch10 = "6";
var ch11 = "7";
var ch12 = "8";
var ch13 = "9";
var ch14 = "and";
var ch15 = "what";
var ch16 = "where";
var ch17 = "the";
var ch18 = "this";
var ch19 = "that";
var ch20 = "them";
var ch21 = "that";
var ch22 = "why";
var ch23 = "who";
var ch24 = "are";

temp = q.split(' ');

for (q=0; q<temp.length; q++){

if(temp[q].match(ch1)||temp[q].match(ch2)||temp[q].match(ch3)||temp[q].match(ch4)||temp[q].match(ch5)||temp[q].match(ch6)||te

mp[q].match(ch7)||temp[q].match(ch8)||temp[q].match(ch9)||temp[q].match(ch10)||temp[q].match(ch11)||temp[q].match(ch12)||temp

[q].match(ch13)||temp[q].match(ch14)||temp[q].match(ch15)||temp[q].match(ch16)||temp[q].match(ch17)||temp[q].match(ch18)||tem

p[q].match(ch19)||temp[q].match(ch20)||temp[q].match(ch21)||temp[q].match(ch22)||temp[q].match(ch23)||temp[q].match(ch24)){

document.write(temp[q] + "&nbsp;");}

else{
document.write("<a title='Look up definition of " + temp[q] + "' style='font-size:12pt' href='http://www.answers.com/" +

temp[q] + "'>" + temp[q] + "</a>&nbsp;");}

}

//-->
</script>

</body>
</html>

Any code and tips would be greatly appreciated.

Thanks.