var Base64 = {};
//Base64.map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
Base64.map = function(c) {
        if (c>=97) return c-71;
        if (c>=65) return c-65;
        if (c==61) return 0;
        if (c>=48) return c+4;
        if (c==47) return 63;
        if (c==43) return 62;
    return 0;
};
Base64.decode = function(cs) {
    var buf=[], bf=[];
    var i=0, i1, i2;
    var datas = new Array();
    do {
        buf[0] = this.map(cs.charCodeAt(i++));
        buf[1] = this.map(cs.charCodeAt(i++));
        i1 = cs.charCodeAt(i++);
        i2 = cs.charCodeAt(i++);
        buf[2] = this.map(i1);
        buf[3] = this.map(i2);
        datas.push(((buf[0]<<2) | (buf[1]>>4)));
        if (i1!=61) datas.push(((buf[1]<<4)&0xff) | (buf[2]>>2));
        if (i2!=61) datas.push(((buf[2]<<6)&0xff) | buf[3]);
    } while (i < cs.length);
    var ds = [];
    for (var i=2; i<datas.length; i+=2) ds.push(datas[i+1]<<8 | datas[i]);
    return eval("String.fromCharCode(" + ds.join(",") + ")");
};