function URIEncode(string)
  {
		if (string != "")
		{
			var preFormatedpreFormatedEncodedUrl = "";
			var encodedUrl = "";

			preFormatedEncodedUrl = string.replace(/%/gi,"%25");
			preFormatedEncodedUrl = preFormatedEncodedUrl.replace(/&/gi,"%26");
			preFormatedEncodedUrl = preFormatedEncodedUrl.replace(/=/gi,"%3D");
			preFormatedEncodedUrl = preFormatedEncodedUrl.replace(/\+/gi,"%2B");
			preFormatedEncodedUrl = preFormatedEncodedUrl.replace(/#/gi,"%23");
			preFormatedEncodedUrl = preFormatedEncodedUrl.replace(/ /gi,"%20");

			for (i=0; i<preFormatedEncodedUrl.length; i++)
			{
				var myChar = preFormatedEncodedUrl.substring(i,i+1);
				
				if (myChar.charCodeAt(0) > 126 && myChar.charCodeAt(0) < 256)
					encodedUrl += "%" + preFormatedEncodedUrl.substring(i,i+1).charCodeAt(0).toString(16);
				else
					encodedUrl += myChar;
			}
		}
		return encodedUrl;
  }
  
  function URIDecode(string)
  {
		var decodedString = "";

		if (string != "")
		{
			var parsedUrl = string.split(/%/gi);
			
			for (i=0; i<parsedUrl.length; i++)
			{
				if (parsedUrl[i].length >= 2)
				{
					potentialHex = parsedUrl[i].substring(0,2);
					myRegExp = new RegExp("[A-Fa-f0-9]{2}")

					if (myRegExp.test(potentialHex))
					{
						if (isStandardJavascriptCharCode(potentialHex))
							decodedString += String.fromCharCode(parseInt(potentialHex,16));
						else
							decodedString += String.fromCharCode(getUnstandardCharCode(potentialHex));
					}
					else
						decodedString += potentialHex;
					
					if (parsedUrl[i].length > 2)
						decodedString += parsedUrl[i].substring(2,parsedUrl[i].length);
						
				}
				else
					decodedString += parsedUrl[i];
			}
		}
		return decodedString;
  }

  //Fonction qui permet d'encoder la valeur de chaque paramètre contenu dans une QueryString
  function encodeQueryStringValues(strQueryString)
  {
    var retour            = "";
    var splitParamsValues = strQueryString.split("&");
    var splitValues;
    var i;
    
    for(i = 0; i < splitParamsValues.length; i++)
    {  
      splitValues = splitParamsValues[i].split("=");
      retour = retour + splitValues[0] + "=" + encodeURIComponent(splitValues[1]) + "&";
    }
    
    //Enlever le denier &
    retour = retour.substr(0, retour.length-1);
    return retour;
  }
  
  //Fonction qui permet de remplacer un caractère dans une chaine par un caractère de remplacement
  function ReplaceCaractere(strChaine, strCaractereARemplacer, strCaractereRemplacement)
  {
    var retour   = strChaine;
    var maRegExp = new RegExp(strCaractereARemplacer, "gi");
    
    retour = retour.replace(maRegExp, strCaractereRemplacement);
    
    return retour;
  }
	
	function isStandardJavascriptCharCode ( hexChrValue )
	{
		var unstandardHexCodes = new Array("80","82","83","84","85","86","87","88","89","8a","8b","8c","8e","91","92","93","94","95","96","97","98","99","9a","9b","9c","9e","9f")

		if (unstandardHexCodes.indexOf(hexChrValue) == -1)
			return true;
		else
			return false;
	}

	function EnleverParamQueryString(queryString, paramName) {
    
	    //Tous les paramètre vont être du format &paramName
	    var strRetour = "&" + queryString;
	    var posParser = 1;
	    var posBeginParam;
	    var posEndParam;
	    
	    while (posParser < strRetour.length) {
			posBeginParam = strRetour.indexOf("&" + paramName,posParser);
			if (posBeginParam == -1) {
				posBeginParam = strRetour.indexOf("?" + paramName,posParser);
			}

			if (posBeginParam > -1) {
				posEndParam = strRetour.indexOf("&",(posBeginParam + 1));
				if (posEndParam == -1) {
					posEndParam = strRetour.length;
				}
				strRetour = strRetour.substr(0,posBeginParam) + strRetour.substr(posEndParam, strRetour.length - posEndParam);
				posParser = posBeginParam;
			} else {
				posParser = strRetour.length;
			}
	    }
		//Enlever le premier & 
		strRetour = strRetour.substr(1,strRetour.length - 1);
		return strRetour;
   }
	
	function getUnstandardCharCode ( hexChrValue )
	{
		// Liste des caractères non-standards de javascript (par rapport aux query strings)
		//var unstandardChars = new Array("€","‚","ƒ","„","…","†","‡","ˆ","‰","Š","‹","Œ","Ž","‘","’","“","”","•","–","—","˜","™","š","›","œ","ž","Ÿ")
		var unstandardHexCodes = new Array("80","82","83","84","85","86","87","88","89","8a","8b","8c","8e","91","92","93","94","95","96","97","98","99","9a","9b","9c","9e","9f")
		var unstandardChars = new Array(8364,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,381,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,382,376)

		if (unstandardHexCodes.indexOf(hexChrValue) != -1)
			return unstandardChars[unstandardHexCodes.indexOf(hexChrValue)];
	}

	function encapsulateURL(st) {
	  st = st.replace(/\?/g,"!");
	  st = st.replace(/&/g,"*");
	  return st;
	}