function sCase(strval) 
{	
	//alert(strval.value);
    var pattern = /(\w)(\w*)/; // a letter, and then one, none or more letters 
    var a = strval.value.split(/\s+/g); // split the sentence into an array of words

    for (i = 0 ; i < a.length ; i ++ ) {
        var parts = a[i].match(pattern); // just a temp variable to store the fragments in.

        var firstLetter = parts[1].toUpperCase();
        var restOfWord = parts[2].toLowerCase();

        a[i] = firstLetter + restOfWord; // re-assign it back to the array and move on
    }
    
    strval.value = a.join(' '); // join it back together
}

