<!--

function crypt(k)
{
	this.encode = crypt_encode;
	this.decode = crypt_decode;
	this.getMap = crypt_get_map;
	this.s1 = "abcdefghijklmnopqrstuwvxyzABCDEFGHIJKLMNOPQRSTUWVXYZ1234567890";
	this.s2 = " 󹜳ӥ~!@#$%^&*()_+-={}|[]:;<,>.?";
	this.key = k;
}

function crypt_encode(txt)
{
	var out, i, j, r, to, w, k1, k2, txt;
	
	out = "";
	j = 0;
	to = this.key.length;
	w = txt.length;
	for(i=0; i<w; i++)
	{
		r = Math.round(Math.random()*100000);
		k1 = this.getMap("i", txt.substr(i, 1))+i+w;
		k2 = this.getMap("i", this.key.substr(j, 1))+r+to;
		out += this.getMap("c", r)+""+this.getMap("c", (k1+k2));
		j = (j<to-1)? j+1 : 0;
	}
	
	out =this.getMap("p", out);
	return out;
}

function crypt_decode(txt)
{
	var out, i, j, z, to, w, txt, x, r, txt;
	
	out = "";
	txt = this.getMap("u", txt);
	
	j = 0;
	to = this.key.length;
	w = txt.length/2;
	for(i=0; i<w; i++)
	{
		x = i*2+1;
		r = this.getMap("i", txt.substr(x-1, 1));
		z = (this.getMap("i", txt.substr(x, 1))-i-w) - this.getMap("i", this.key.substr(j, 1))-r-to;

		out += this.getMap("c", z);
		j = (j<to-1)? j+1 : 0;
	}
	
	return out;
}

function crypt_get_map(t, c)
{
	var str = this.s1+""+this.s2;
	var to = str.length;
	var i, m;

	if(t == "i")
		return str.indexOf(c);
	else if(t == "c")
	{
		m = Math.floor(c%to);

		if(m < 0)
			m = to+m;

		return str.substr(m, 1);
	}
	else if(t == "p")
	{
		for(i=0; i<this.s2.length; i++)
		{
			m = this.s2.substr(i, 1);
			while(c.indexOf(m) != -1)
				c = c.replace(m, this.s1.substr(i, 1)+""+i);
		}
		return c;
	}
	else if(t == "u")
	{
		for(i=0; i<this.s2.length; i++)
		{
			m = this.s1.substr(i, 1)+""+i;
			
			while(c.indexOf(m) != -1)
				c = c.replace(m, this.s2.substr(i, 1));
		}	
		return c;
	}
}

//-->
