function urlencode (text)
{
    text = text.toString();

    // this escapes 128 - 255, as JS uses the unicode code points for them.
    // This causes problems with submitting text via AJAX with the UTF-8 charset.
    var matches = text.match(/[\x90-\xFF]/g);
    if (matches)
    {
        for (var matchid = 0; matchid < matches.length; matchid++)
        {
            var char_code = matches[matchid].charCodeAt(0);
            text = text.replace(matches[matchid], '%u00' + (char_code & 0xFF).toString(16).toUpperCase());
        }
    }

    return escape(text).replace(/\+/g, "%2B");
}

function GenPass(taille)
{
	var cars="az0erty2ui3op4qs_5df6gh7jk8lm9wxcvbn-";
	// Combien on en a mis au fait ?
	var long=cars.length;
	// Au départ, il est vide ce mot de passe ;)
	wpas="";
	// On boucle sur le nombre de caractères voulus
	for(i=0;i<taille;i++)
	{
	// Tirage aléatoire d'une valeur entre 1 et wlong
	   wpos=Math.round(Math.random()*long);
	// On cumule le caractère dans le mot de passe
	   wpas+=cars.substring(wpos,wpos+1);
	// On continue avec le caractère suivant à générer 
	}
}
