function removeApostrophes()
{
	for(i=0; i < document.forms[0].elements.length; i++)
	{
	    if(document.forms[0].elements[i].type == "text" || document.forms[0].elements[i].type == "textarea")
	    {
	    	document.forms[0].elements[i].value = replaceChars(document.forms[0].elements[i].value)
	    }
    	}
}

function replaceChars(entry)
{
    
    out = "'"; // replace this
    add = "&#039;"; // with this
    temp = "" + entry; // temporary holder

    while (temp.indexOf(out)>-1)
    {
      pos= temp.indexOf(out);
      temp = "" + (temp.substring(0, pos) + add +
      temp.substring((pos + out.length), temp.length));
    }
    return temp;
}
