function strReplace(theString, theMatch, theSub) { var retValue = theString; while( theString.indexOf(theMatch) >= 0 ) { retValue = theString.replace(theMatch, theSub); } return retValue; }