Hi,

I am trying to build a script, well actually I've completed it but one thing I've problem with is that its not compeletely doing what I want it to do.

Basically I want it to copy and convert the text from one text box to another text box.

When I say convert I mean:
1) all the convert everything to lowercase [i've done it]
2) locate i and replace it with 'I'
3) place comma (,) after every space [i've done it]
4) place comma (,) before period/fullstop (.)

[Sample]
Input:

This is a sample Input, I want to convert to Prolog List based text.

Output:
[this,is,a,sample,input,'I',want,to,convert,to,prolog,list,based,text,.]

As you can see from the input and output it sound simple but I am having trouble locating I and not changing it to 'I' and also adding the (,) before the period.

any help is appriciated.

Here is the Entire Code so Far you can copy, paste and test it.:
Code:
<html>
<head>
<meta name=VI60_defaultClientScript content=JavaScript>
<title>Eliza Prolog Rule Creator</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="gs.css" type="text/css">

<SCRIPT LANGUAGE=javascript>
<!--

function e2p_onclick() {
if (frmMain.English.value == "")
	{
		alert("Please enter some text in English to convert to Eliza based text.");
	}
	else
	{
		//alert("We are ready to convert");
		var str = frmMain.English.value;
		var str2 = str.toLowerCase();
		frmMain.Prolog.value = str2.split(" ");
	}
}

//-->
</SCRIPT>
<SCRIPT LANGUAGE=javascript>
<!--

function p2e_onclick() {
if (frmMain.Prolog.value =="")
	{
		alert("Please enter some Eliza based text to convert to English text.");
	}
	else
	{
		//alert("We are ready to convert");
		var str =new Array(frmMain.Prolog.value);
		
		frmMain.English.value = str.join(" ");
	}
}

//-->
</SCRIPT>
</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="frmMain" action="">
  <table width="200" border="0" cellspacing="0" cellpadding="8">
	<tr> 
	  <td class="header3">English:</td>
	</tr>
	<tr> 
	  <td> 
		<textarea wrap="VIRTUAL" cols="60" rows="4" name="English"></textarea>
	  </td>
	</tr>
	<tr> 
	  <td> 
		<input type="button" name="e2p" value="English -&gt; Prolog" LANGUAGE=javascript onclick="return e2p_onclick()">
		<input type="hidden" name="p2e" value="Prolog -&gt; English" LANGUAGE=javascript onclick="return p2e_onclick()">
		<input type="reset" name="Reset" value="Reset">
	  </td>
	</tr>
	<tr> 
	  <td class="header3">Prolog:</td>
	</tr>
	<tr> 
	  <td> 
		<textarea name="Prolog" wrap="VIRTUAL" cols="60" rows="4"></textarea>
	  </td>
	</tr>
  </table>
  </form>
</body>
</html>
Thanks in Advance

Azizur