Here is a function based on excellent code from Philip M at http://www.codingforums.com/showthread.php?t=168661 that capitalizes the first letter of each word:

function caps(str){
    return str.toLowerCase().replace(/\b[a-z]/g,function(w){return w.toUpperCase()});
}