
// antiHOYGAN
// Script URI: http://www.nopuedocreer.com/quelohayaninventado/?page_id=203
// Description: "Filtro antiHOYGAN"
// Author: Dani "Troy" Gonzalez
// Version: 1.0
// Author URI: http://www.hevistocosas.com 

function filterHOYGAN (texto)
{
	swHOYGAN=false;
	msgError="";

	numLetras=texto.length;
	numMayusculas=0;
	for (i=0;i<numLetras;i++)
		if (texto.charAt(i)>='A' && texto.charAt(i)<='Z' && texto.charAt(i)!='F' && texto.charAt(i)!='B' && texto.charAt(i)!='L' && texto.charAt(i)!='R' && texto.charAt(i)!='U' && texto.charAt(i)!='D' && texto.charAt(i)!='A' && texto.charAt(i)!='T' && texto.charAt(i)!='I')
			numMayusculas++;
    if (numLetras>4 && numMayusculas>numLetras/4)			
    {
		swHOYGAN=true;
		msgError="Demasiadas mayusculas";
	}
	else
	{
		textoLower=texto.toLowerCase();
		textoLower=" "+textoLower;
		HOYGANseed = new Array("wenas ","wapo "," wapo","wapa "," wapa","weno "," weno","fabor "," fabor","kiero "," kiero"," plis","plis ","pliss "," pliss"," plisss","plisss "," grasias","grasias "," antebraso"," ke "," k "," q ","pq "," pq","xq ","aaaaaaaa","eeeeeeee","iiiiiiii","oooooooo","uuuuuuuu","kien "," kien"," aver "," haver "," aber ","toka "," toka","komo "," komo","tronko "," tronko","kaņa","kulo "," kulo","koņo"," dl "," kojon","kojon ","kmo "," kmo"," xa "," xo "," biba ","kaga "," kaga"," xulo","xulo ","asko "," asko"," xfa","xfa "," pa "," sto "," k ","vienvenido","vienbenido","bienbenido"," hai ");
		for (i=0;i<HOYGANseed.length;i++)
		{
			if (textoLower.indexOf(HOYGANseed[i])!=-1)
			{
				swHOYGAN=true;
				msgError=HOYGANseed[i];
				break;
			};
			if ( !swHOYGAN && (texto.indexOf(" i ")!=-1))
			{
				swHOYGAN=true;
				msgError=" i ";
			}
		}
	}
	if (swHOYGAN)
	{	
		alert ("ALERT: AntiHOYGAN Filter FAILED!\n\n>>Offending Command: \""+msgError+"\"\n\nRevise su mensaje y vuelva a intentarlo, por favor.\n\nSi el problema persiste, puede solucionarlo accediendo a:\nwww.RAE.es\nfrikipedia.es/friki/Hoygan");
		return false;
    }
    return true;
}
