<!--//
function BadLanguage(TextToCheck, Replace){		
	/******************************************************************************************
	'	function BadLanguage(TextToCheck, Replace)
	'		Parameter: TextToCheck - This is the text that is to be checked
	'								 for bad language.
	'
	'		Parameter: Replace - This tells the function whether to 
	'					         replace the bad words or not.
	'
	'		Replace = 1 (Replace Bad Language)
	'			Function returns true, signifying the replacement of bad words.
	'
	'		Replace = 0 (Check Bad Language)
	'			Function returns true if bad words are found, false if not.
	'
	'	If you want to filter just the root word put a space before and after the word.
	'   However this will not pick up fucking, fucked or sfuck
	'		Example:
	'			var arWords = new Array(" fuck ");
	'
	'	To catch words that could have a prefix or suffix include a space either in front of
	'   behind or both.
	'		Example:
	'			var arWords = new Array(" fuck");
	'			var arWords = new Array("fuck ");
	'			var arWords = new Array(" fuck ");
	'
	'	You get the point
	******************************************************************************************/
	//Bad Word Array
	if(TextToCheck != undefined){
		var arWords = new Array(" fuck ", " shit ", " damn ", " bitch ", " ass ", " pussy ", " cock ", " penis ", " dick ", " suck ", " blowjob ", " dildo ", " asshole ", " cum ", " cunt ", " bastard ", " pissing ");
		var s = TextToCheck;
		var i, k, j, m;
		var sReplaceWith, sToBeReplaced;
		var allTheWords = s.split(' ');
		for(i = 0; i < allTheWords.length; i = i + 1){
			for(k = 0; k < arWords.length; k = k + 1){			
				if(Replace == 0){
					sToBeSearched = arWords[k];
					if(allTheWords[i].search(sToBeSearched) >= 0) {		return true;	}
					sToBeSearched = arWords[k].toLowerCase();
					if(allTheWords[i].search(sToBeSearched) >= 0) {		return true;	}
					sToBeSearched = arWords[k].toUpperCase();
					if(allTheWords[i].search(sToBeSearched) >= 0) {		return true;	}
					sToBeSearched = arWords[k].substring(0,1).toUpperCase() + arWords[k].substring(1,arWords[k].length).toLowerCase();
					if(allTheWords[i].search(sToBeSearched) >= 0) {		return true;	}
				}
				else{
					sReplaceWith = '';
					for(m = 0; m < arWords[k].length; m = m + 1){
						sReplaceWith = sReplaceWith + 'x';
					}				
					sToBeReplaced = arWords[k];
					allTheWords[i] = allTheWords[i].replace(sToBeReplaced,sReplaceWith);
					sToBeReplaced = arWords[k].toLowerCase();
					allTheWords[i] = allTheWords[i].replace(sToBeReplaced,sReplaceWith);
					sToBeReplaced = arWords[k].toUpperCase();
					allTheWords[i] = allTheWords[i].replace(sToBeReplaced,sReplaceWith);
					sToBeReplaced = arWords[k].substring(0,1).toUpperCase() + arWords[k].substring(1,arWords[k].length).toLowerCase();
					allTheWords[i] = allTheWords[i].replace(sToBeReplaced,sReplaceWith);
				}
			}		
		}
		s = '';
		for(i = 0; i < allTheWords.length; i = i + 1){
			s = s + allTheWords[i] + ' ';				
		}
				
		if(Replace == 0){
			return false;
		}
		else{
			return s;
		}
	}
	else {
		if(Replace == 0){
			return false;
		}
		else{
			return '';
		}
	}
}
//-->