//alert ('stringScripts.js');
/*
function substituiSpecialChars(texto) {
	var chrEspeciais = new Array("�", "�", "�", "�", "�", "�", "�", "�", "�",
				     "�", "�", "�", "�", "�", "�", "�", "�", "�",
				     "�", "�", "�", "�", "�",
				     "�", "�", "�", "�", "�", "�", "�", "�", "�",
				     "�", "�", "�", "�", "�", "�", "�", "�", "�",
				     "�", "�", "�", "�", "�");
	var chrNormais = new Array("a", "a", "a", "a", "a", "e", "e", "e", "e",
				   "i", "i", "i", "i", "o", "o", "o", "o", "o",
				   "u", "u", "u", "u", "c",
				   "A", "A", "A", "A", "A", "E", "E", "E", "E",
				   "I", "I", "I", "I", "O", "O", "O", "O", "O",
				   "U", "U", "U", "U", "C");
	for (index in chrEspeciais) {
		texto = texto.replace(chrEspeciais[index], chrNormais[index]);
	}

	return texto;
}

function verificaSpecialChars(texto) {
	// Procura por caracteres especiais, se encontrar retorna ele, se n�o, retorna falso
  var chrEspeciais = new Array(
             "�", "�", "�", "�", "�", "�", "�", "�", "�",
				     "�", "�", "�", "�", "�", "�", "�", "�", "�",
				     "�", "�", "�", "�", "�",
				     "�", "�", "�", "�", "�", "�", "�", "�", "�",
				     "�", "�", "�", "�", "�", "�", "�", "�", "�",
				     "�", "�", "�", "�", "�");

  for (index in chrEspeciais) {
    //alert (texto.value.indexOf(chrEspeciais[index]));
		if (texto.value.indexOf(chrEspeciais[index]) != -1){
      return chrEspeciais[index];
    }
	}

	return false;

}
*/

function switchHTMLChars(myString){

	myString = replaceAll(myString, '&lt;','<');
	myString = replaceAll(myString, '&gt;','>');

	return myString;

}

function replaceAll(string, token, newtoken) {

	//alert ('replaceAll('+string+', '+token+','+newtoken+')');

	while (string.indexOf(token) != -1) {
 		string = string.replace(token, newtoken);
	}
	return string;
}

function showString(str){

	//alert ('showString(str)');

	var key = new Array('a', 'e', 'i', 'o', 'u', ' ', 'b', 'm', '&', 'c');
	var switchKeys = new Array("!9", "-7", "-6", "5-", "-8-", "*", "-2", "-3", "-4", "-0-");
	for(i=0; i<key.length; i++){
		str = replaceAll(str, switchKeys[i], key[i]);
	}

	return str;

}
