function rawurldecode( to_translate )
{
	to_translate = escape( to_translate );
	to_translate = encodeURI( to_translate );

	window.open( "./rawurldecode.php?chaine=" + to_translate, "rawurldecode_output", "width=700px, height=200px" );
}


function utf8( to_translate )
{
	to_translate = escape( to_translate );
	to_translate = encodeURI( to_translate );

	//document.getElementById('test_output').innerHTML = to_translate;

	window.open( "./utf8.php?chaine=" + to_translate, "utf8_output", "width=350px, height=200px" );

	//window.open( link, "utf8_output", "width=350px, height=200px" );

}

function text2rot13( to_translate )
{
	var temp = '';
	var rot13_in = new Array(
		" ", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
		);
	var rot13_out = new Array(
		" ", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M"
		);

	for ( i = 0 ; i < to_translate.length ; i++ )
	{
		for ( j = 0 ; j < rot13_in.length ; j++ )
		{
			if ( to_translate.charAt(i) == rot13_in[j] )
			{
				temp += rot13_out[j]; break;
			}
			else if ( ( to_translate.charAt(i) != rot13_in[j] ) && ( j == rot13_in.length-1 ) )
			{
				temp += to_translate.charAt(i);
			}
		}

	}
	return temp;
}

function text2html( to_translate )
{
	/* je ne traduis pas ces 4 entités : 	
		" ", "&amp\;&nbsp;",
		"\"", "&amp\;quot;",
		"<", "&amp\;lt;",
		">", "&amp\;gt;",
	*/
	var entities = new Array(
			"&", "&amp;", "¡", "&iexcl;", "¢", "&cent;", "£", "&pound;", "¤", "&curren;", "¥", "&yen;", "€", "&euro;",
			"¦", "&brvbar;", "§", "&sect;", "¨", "&uml;", "©", "&copy;", "ª", "&ordf;", "«", "&laquo;",
			"¬", "&not;", "­", "&shy;", "®", "&reg;", "¯", "&macr;", "°", "&deg;", "±", "&plusmn;",
			"²", "&sup2;", "³", "&sup3;", "´", "&acute;", "µ", "&micro;", "¶", "&para;", "·", "&middot;",
			"¸", "&cedil;", "¹", "&sup1;", "º", "&ordm;", "»", "&raquo;", "¼", "&frac14;", "½", "&frac12;",
			"¾", "&frac34;", "¿", "&iquest;", "À", "&Agrave;", "Á", "&Aacute;", "Â", "&Acirc;", "Ã", "&Atilde;",
			"Ä", "&Auml;", "Å", "&Aring;", "Æ", "&AElig;", "Ç", "&Ccedil;", "È", "&Egrave;", "É", "&Eacute;",
			"Ê", "&Ecirc;", "Ë", "&Euml;", "Ì", "&Igrave;", "Í", "&Iacute;", "Î", "&Icirc;", "Ï", "&Iuml;",
			"Ð", "&ETH;", "Ñ", "&Ntilde;", "Ò", "&Ograve;", "Ó", "&Oacute;", "Ô", "&Ocirc;", "Õ", "&Otilde;",
			"Ö", "&Ouml;", "×", "&times;", "Ø", "&Oslash;", "Ù", "&Ugrave;", "Ú", "&Uacute;", "Û", "&Ucirc;",
			"Ü", "&Uuml;", "Ý", "&Yacute;", "Þ", "&THORN;", "ß", "&szlig;", "à", "&agrave;", "á", "&aacute;",
			"â", "&acirc;", "ã", "&atilde;", "ä", "&auml;", "å", "&aring;", "æ", "&aelig;", "ç", "&ccedil;",
			"è", "&egrave;", "é", "&eacute;", "ê", "&ecirc;", "ë", "&euml;", "ì", "&igrave;", "í", "&iacute;",
			"î", "&icirc;", "ï", "&iuml;", "ð", "&eth;", "ñ", "&ntilde;", "ò", "&ograve;", "ó", "&oacute;",
			"ô", "&ocirc;", "õ", "&otilde;", "ö", "&ouml;", "÷", "&divide;", "ø", "&oslash;", "ù", "&ugrave;",
			"ú", "&uacute;", "û", "&ucirc;", "ü", "&uuml;", "ý", "&yacute;", "þ", "&thorn;", "ÿ", "&yuml;"
			);

	for ( i = 0 ; i < entities.length ; i = i + 2 )
	{
		reg = new RegExp( entities[i], "g" )
		to_translate = to_translate.replace( reg, entities[i+1] ); 
	}
	return to_translate;
}