code: function decodeBase64(sEncoded) {
  
      // Input must be dividable with 4.
      if (!sEncoded || (sEncoded.length % 4) > 0) { return sEncoded; }
      else if (typeof (atob) != 'undefined') { return atob(sEncoded); }
  
      var nBits, i, sDecoded = '';
      var base64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  
      sEncoded = sEncoded.replace(/\W|=/g, '');
      for (i = 0; i < sEncoded.length; i += 4) {
          nBits =
              (base64.indexOf(sEncoded.charAt(i)) & 0xff) << 18 |
              (base64.indexOf(sEncoded.charAt(i + 1)) & 0xff) << 12 |
              (base64.indexOf(sEncoded.charAt(i + 2)) & 0xff) << 6 |
               base64.indexOf(sEncoded.charAt(i + 3)) & 0xff;
          sDecoded += String.fromCharCode(
              (nBits & 0xff0000) >> 16, (nBits & 0xff00) >> 8, nBits & 0xff);
      }
      return sDecoded.substring(0, sDecoded.length -
          ((sEncoded.charCodeAt(i - 2) == 61) ? 2 :
          (sEncoded.charCodeAt(i - 1) == 61 ? 1 : 0)));
  
  }
docs: from [Soya.Encode.Base64](http://soya.saltstorm.net)