var uc = ''

function makeArray() 
{
   for (i = 0; i<makeArray.arguments.length; i++)
        this[i] = makeArray.arguments[i];
}

var convert = new makeArray('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');

function hex(number) 
{
    var MSD = '' + Math.floor(number / 16), LSD = number - MSD*16;
    if (MSD > 16) return hex(MSD) + convert[LSD]; else return convert[MSD] + convert[LSD];
}

function pHex(number) { if (number < 16) return '%0' + hex(number); else return '%' + hex(number); }

function hex(number) { return number.toString(16); }

var lookupTable = new Object();
var charCodeTable = new Object();

function buildLookupTable() 
{
    for (var index = 0; index < 256; index++) 
	{
        lookupTable[unescape(pHex(index))] = index;
        charCodeTable[unescape(pHex(index))] = index;
    }

    if (document.all || document.layers)
        charCodeTable[unescape(pHex(0))] = NaN;
    else
        charCodeTable[unescape(pHex(0))] = 1/0;
    charCodeTable[unescape(pHex(128))] = 8364;
    charCodeTable[unescape(pHex(129))] = 65533;
    charCodeTable[unescape(pHex(130))] = 8218;
    charCodeTable[unescape(pHex(131))] = 402;
    charCodeTable[unescape(pHex(132))] = 8222;
    charCodeTable[unescape(pHex(133))] = 8230;
    charCodeTable[unescape(pHex(134))] = 8224;
    charCodeTable[unescape(pHex(135))] = 8225;
    charCodeTable[unescape(pHex(136))] = 710;
    charCodeTable[unescape(pHex(137))] = 8240;
    charCodeTable[unescape(pHex(138))] = 352;
    charCodeTable[unescape(pHex(139))] = 8249;
    charCodeTable[unescape(pHex(140))] = 338;
    charCodeTable[unescape(pHex(141))] = 65533;
    charCodeTable[unescape(pHex(142))] = 381;
    charCodeTable[unescape(pHex(143))] = 65533;
    charCodeTable[unescape(pHex(144))] = 65533;
    charCodeTable[unescape(pHex(145))] = 8216;
    charCodeTable[unescape(pHex(146))] = 8217;
    charCodeTable[unescape(pHex(147))] = 8220;
    charCodeTable[unescape(pHex(148))] = 8221;
    charCodeTable[unescape(pHex(149))] = 8226;
    charCodeTable[unescape(pHex(150))] = 8211;
    charCodeTable[unescape(pHex(151))] = 8212;
    charCodeTable[unescape(pHex(152))] = 732;
    charCodeTable[unescape(pHex(153))] = 8482;
    charCodeTable[unescape(pHex(154))] = 353;
    charCodeTable[unescape(pHex(155))] = 8250;
    charCodeTable[unescape(pHex(156))] = 339;
    charCodeTable[unescape(pHex(157))] = 65533;
    charCodeTable[unescape(pHex(158))] = 382;
    charCodeTable[unescape(pHex(159))] = 376;
}

buildLookupTable();

function charCode(string) {
    var chr = charCodeTable[string];
    if (string == '0') return chr;
    else if (string == '1') return chr;
    else if (string == '2') return chr;
    else if (string == '3') return chr;
    else if (string == '4') return chr;
    else if (string == '5') return chr;
    else if (string == '6') return chr;
    else if (string == '7') return chr;
    else if (string == '8') return chr;
    else if (string == '9') return chr;
    else if (chr == 48) return 'NaN';
    else if (!(chr < 49) && chr <=57) return chr-48;
    else return chr;
}

function encode_str(str)
{
	code = "4HVDFMwrnm"
	var tempStr = ""
  	for (sInd=str.length-1;sInd>=0;sInd--)
 	{
  		tempStr += str.charAt(sInd)
  	}
		
	encStr = ""
  	for (sInd=0;sInd<str.length;sInd++)
	{
		newStr = parseInt(charCode(tempStr.charAt(sInd)))
	  	for (kInd=0;kInd<code.length;kInd++) {  newStr = newStr ^  parseInt(charCode(code.charAt(kInd))) }
		encStr +=  pHex(newStr)
	}
	return encStr
}
