// a special thanks to <lunitikmzk@aol.com> for this script.

var numberOfWords = 8;
var message = "Please do not use profanity .:?:. it won't get you anywhere.";
var isProfane = new makeArray(numberOfWords);
var word = new makeArray(numberOfWords);

function checkForProfanity(usersInput) {

var temp = usersInput;
temp = temp.toLowerCase();

word[1] = "shit";
word[2] = "fuck";
word[3] = "penis";
word[4] = "dick";
word[5] = "bitch";
word[6] = "lesbian";
word[7] = "brown stuff";
word[8] = "browner";

for (var j = 1; j <= numberOfWords; j++) {
isProfane[j] = temp.indexOf(word[j]);
}


for (var j = 1; j <= numberOfWords; j++) {
   if (isProfane[j] != -1) {
      alert("Please refrain from using the word \'"+word[j]+"\' in this form.");
      usersInput = message;
      j = numberOfWords + 1;}

   else {}
}
      return usersInput;
}

function makeArray(n) {
   this.length = n
   for (var i = 1; i<=n; i++) {
       this[i] = new String();
   }
   return this;
}
