﻿function replaceall_STRING(thestring, thekeyword, thenewvalue) {
    //var strReplaceAll = thestring.toString();
    //var intIndexOfMatch = strReplaceAll.indexOf(thekeyword);
    //alert(strReplaceAll);
    //alert(intIndexOfMatch);
    //while (intIndexOfMatch != -1) {
        // Relace out the current instance.
        //strReplaceAll = strReplaceAll.replace(thekeyword, thenewvalue)
        // Get the index of any next matching substring.
        //intIndexOfMatch = strReplaceAll.indexOf(thekeyword);
    //}
    var re = /thekeyword/g;
    return thestring.toString().replace(re, thenewvalue);
}

function dbFriendly(thestring) {
    var re = /'/g;
    return thestring.toString().replace(re, "`");
}