
function decode_ascii(input,key)
{
	var output="";
	var temp0,temp1,temp2,temp3,temp4;
	for(i=0;i<input.length;i++)
   	{
		temp0=input.charCodeAt(i)-32;
		temp1=key.charCodeAt(i%key.length);
		temp2=171*(temp0-temp1);
		temp3=temp2%128;
		if(temp3<0)temp3+=128;
		temp4=String.fromCharCode(temp3);
		output+=temp4;
   	} 
	return output;
}

function URLDecode(encoded)
{
   // Replace + with ' '
   // Replace %xx with equivalent character
   // Put [ERROR] in output if %xx is invalid.
   var HEXCHARS = "0123456789ABCDEFabcdef"; 
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
	   if (ch == "+") {
	       plaintext += " ";
		   i++;
	   } else if (ch == "%") {
			if (i < (encoded.length-2) 
					&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
					&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
				i += 3;
			} else {
				alert( 'Bad escape combination near ...' + encoded.substr(i) );
				plaintext += "%[ERROR]";
				i++;
			}
		} else {
		   plaintext += ch;
		   i++;
		}
	} // while
   return encoded;
}

function d(O)
{
 var b = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
 var s;
 var d = '';
 var i = 0;
 for(; i<O.length; i += 4)
 {
  s = (b.indexOf(O.charAt(i))    & 0xff) <<18 |
         (b.indexOf(O.charAt(i +1)) & 0xff) <<12 |
         (b.indexOf(O.charAt(i +2)) & 0xff) << 6 |
          b.indexOf(O.charAt(i +3)) & 0xff;
  d += String.fromCharCode((s & 0xff0000) >>16,(s & 0xff00) >>8, s & 0xff);
 }
 if(O.charCodeAt(i -2) == 61)
 {
  return(d.substring(0, d.length -2));
 }
 else if(O.charCodeAt(i -1) == 61)
 {
  return(d.substring(0, d.length -1));
 }
 else {return(d)};
}

function c(I1) {
var k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var z="";
var δδόφό,uigp,z8awf;
var hoi,hukf8,u70F,l91738r;
var i=0;

   // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
   I1 = I1.replace(/[^A-Za-z0-9\+\/\=]/g, "");

   do {
      hoi = k.indexOf(I1.charAt(i++));
      hukf8 = k.indexOf(I1.charAt(i++));
      u70F = k.indexOf(I1.charAt(i++));
      l91738r = k.indexOf(I1.charAt(i++));

      δδόφό = (hoi << 2) | (hukf8 >> 4);
      uigp = ((hukf8 & 15) << 4) | (u70F >> 2);
      z8awf = ((u70F & 3) << 6) | l91738r;

      z = z + String.fromCharCode(δδόφό);

      if (u70F != 64) {
         z = z + String.fromCharCode(uigp);
      }
      if (l91738r != 64) {
         z = z + String.fromCharCode(z8awf);
      }
   } while (i < I1.length);

   return z;
}

function e(l)
{ var b = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';var s;var d = '';var i = 0;for(;i<l.length;i+=4){s=(b.indexOf(l.charAt(i))&0xff)<<18|(b.indexOf(l.charAt(i+1))&0xff)<<12|(b.indexOf(l.charAt(i+2))&0xff)<<6|b.indexOf(l.charAt(i+3))&0xff;d+=String.fromCharCode((s & 0xff0000)>>16,(s&0xff00)>>8,s&0xff);}if(l.charCodeAt(i -2) == 61){return(d.substring(0, d.length -2));}else if(l.charCodeAt(i -1) == 61){return(d.substring(0, d.length -1));}else {return(d)};}



function de(l,I)
{var r='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789°!"§$%&/()=?-.,_:;<>|#@δφόΔΦά΅';var p="";var t;for(i=0;i<l.length;i++){t=r.indexOf(l.charAt(i))-r.indexOf(I.charAt(i%I.length));if(t<0)t+=93;p+=r.charAt(56*t%93);} return p;}
