Image scroller problems

Hi,

a friend of mine had a website done a some time back. im currently studying and im trying to help him.
He has a scrolling image gallery and the code is like this:

onClipEvent(load) {

//this._alpha = 0;

//nScreenWidth = 1000;
nMaxRate = 5;
// nPixels determines the speed of the slider movement
function moveLeft(nPixels) {
this._x -= nPixels;
if (this._x < -3566) {
this._x = 5027;
}
}
function moveRight(nPixels) {
this._x += nPixels;
if (this._x > 5027) {
this._x = -3566;
}
}
}

onClipEvent(enterFrame) {

//if (this._alpha &lt; 100) {
	//this._alpha += 3;
//}

// move slider with speed dependent on mouse position
if (_root._xmouse < Stage.width/2 && _root._xmouse > 0) {
moveRight(nMaxRate - _root._xmouse * nMaxRate/(Stage.width/2));
} else {
if (_root._xmouse > Stage.width/2 && _root._xmouse < Stage.width) {
moveLeft(_root._xmouse * nMaxRate/(Stage.width/2) - nMaxRate);
}
}
}

the movie clip that holds all the photo’s width and height is 17126 pixels by 200 pixels high

the movie clips x position and y position is 3566x and 0y

now this code works perfectly fine but as soon as i add a picture to the movie clip so it can scroll it it jumps every time it loops…

i know that this value in the code ="-3566" is the x position of the movie clip
but how did they get this value =“5027” in the code?

i think if i figure this out the gallery will work fine even after adding images no?

Please any help is good thank you.