Bgsound loop + fade in /out

am a noob flash designer. somebody gave me an AS2 script that makes the sound fade out when a button is clicked and fades back in to continue at where the last position was stopped.

the problem is, when i click the fade out button, the bgsound won’t loop anymore. but if i won’t touch(click) any of the buttons, the bgsound will loop.

can anybody help me out here please? thanks in advance. below is the said script:

var bgSound:Sound = new Sound();
bgSound.attachSound(“myTrack”);
bgSound.start(0,99999);
var soundStarted:Boolean = true;
var lastPosition:Number = 0;
var id:Number;
fadeIn_btn.onRelease = fadeInSound;
function fadeInSound():Void {
if (id) {
clearInterval(id);
}
bgSound.start(lastPosition);
var volume = bgSound.getVolume();
id = setInterval(fadeIn, 5);
function fadeIn():Void {
bgSound.setVolume(volume++);
if (volume>=100) {
clearInterval(id);
}
}
}
fadeOut_btn.onRelease = fadeOutSound;
function fadeOutSound():Void {
if (id) {
clearInterval(id);
}
var volume = bgSound.getVolume();
id = setInterval(fadeOut, 5);
function fadeOut():Void {
bgSound.setVolume(volume–);
if (volume<=0) {
clearInterval(id);
bgSound.stop();
lastPosition = Math.round(bgSound.position/1000);
}
}
}