Google
// PHP Function str_replace für JavaScript
function str_replace(search, replace, subject) {
    return subject.split(search).join(replace);
}