Gallery.prototype.getPictureNumber = function(url) { for (var i = 0; i < this.pictures.length; i++) { if (url === this.pictures[i].url) { this.currentPicture = i; return i; } } return -1; };