function PhotoPan(imgId, src, diff) {
    this.img = document.getElementById(imgId);
    this.diff = diff;
    this.left = 0;
    this.polarity = 1;
    var self = this;
    this.pload = new Image();
    this.pload.onload = function() { self.Pan(); }
    this.pload.src = src;
}
PhotoPan.prototype.scroll = function() {
    this.img.style.left = this.left + 'px';
    this.left += this.polarity;
    if(this.left >= 0)
        this.polarity = -1;
    if(this.left <= ((this.diff) * -1))
        this.polarity = 1;
}
PhotoPan.prototype.Pan = function() {
    this.img.src = this.pload.src;
    this.width = this.pload.width;
    var self = this;
    setInterval(function() { self.scroll(); },10);
}