
function a(c)
	{
	if (c<=25)	return String.fromCharCode(c+65);
	if (c<=51)	return String.fromCharCode(c+71);
	if (c<=61)	return String.fromCharCode(c- 4);
	if (c==62)	return '+';
	if( c==63)	return '/';
				return String.fromCharCode(0xFF);
	}


function encrypt(s)
	{
	var r="",i=t=l=o=0;

	for (i=0;i<s.length;i++)
		{
		o=s.charCodeAt(i);
		switch(i%3)
			{
			case 0:{t=(o&0xFC)>>2;			l=o&0x03; break;}
			case 1:{t=(l<<4)|((o&0xF0)>>4); l=o&0x0F; break;}
			case 2:{t=(l<<2)|((o&0xC0)>>6); l=o&0x3F; break;}
			}

		r+=a(t);
		if((i%3)==2)
			r+=a(l);
		}

	r="~"+a(((i%3)<<3)+1)+r;

	switch(s.length%3)
		{
		case 0:{return r;}
		case 1:{return r+a(l<<4)+"~~";}
		case 2:{return r+a(l<<2)+"~";}
		}
	}