code: function() {
                      var hash = window.location.hash.substring(1),
                          params = {};
  
                      if (hash.length < 5) {
                          return params;
                      }
  
                      var vars = hash.split('&');
                      for (var i = 0; i < vars.length; i++) {
                          if (!vars[i]) {
                              continue;
                          }
                          var pair = vars[i].split('=');
                          if (pair.length < 2) {
                              continue;
                          }
                          params[pair[0]] = pair[1];
                      }
  
                      if (params.gid) {
                          params.gid = parseInt(params.gid, 10);
                      }
  
                      return params;
                  }
docs: parse picture index and gallery index from URL (#&pid=1&gid=2)