Edit in JSFiddle

// 1. making the word to be written starting with capital letter

function toCapitalLetter(string) {
    return (string === '') ? '' : string = string[0].toUpperCase() + string.slice(1).toLowerCase();
}

var word = toCapitalLetter('heMIdEMIseMiQUAvER');
alert(word);


// 2. cut if the string is too long

function checkLength(string, maxlength) {
    return (string.length <= maxlength) ? string : string.slice(0 , maxlength-3) + '...';
}

alert( checkLength(word, 15) );


// 3. checking for spam

function checkSpam(string) {
    return ( ~string.toLowerCase().indexOf('viagra') || ~string.toLowerCase().indexOf('xxx') ) ? true : false;
}

alert( checkSpam(word) );