function StrReplc(strText, strTarget, strSubString)
{
    var strText = strText;
    var intIndexOfMatch = strText.indexOf( strTarget );
     
   // Keep looping while an instance of the target string
    // still exists in the string.
    while (intIndexOfMatch != -1){
    // Relace out the current instance.
    strText = strText.replace(strTarget, strSubString )
     
    // Get the index of any next matching substring.
    intIndexOfMatch = strText.indexOf( strTarget );
    }
     
   // Return the updated string with ALL the target strings
    // replaced out with the new substring.
    return( strText );
}
