    var tm = 0;
    var tp = 0;
    var ds = 0;
    var ep = 0;
    
    function mpsr() { 
        obj = document.getElementById('hpMiniGallery'); 
        if (obj) { 
            ep = parseInt(obj.style.left);
            if (ep > (0 - ((pc - 2) * 120))) {
                mpst(-1);
            }
        } 
    }
    
    function mpsl() { 
        obj = document.getElementById('hpMiniGallery'); 
        if (obj) { 
            ep = parseInt(obj.style.left);
            if (ep < 0) {
                mpst(+1);
            }
        } 
    }

    function mpst(t) {
        if (tm != 0) {
            clearTimeout(tm);
        }
        ds = ds + t;
        if (ds > 0) {
            ds = 0;
        }
        if (ds < (0 - (pc - 2))) {
            ds = 0 - (pc - 2);
        }
        //alert("Position: " + ep + "\nDelta: " + ds);
        tm = setTimeout("mpsm()",50);
    }
    
    function mpsm() {
        if (tm != 0) {
            clearTimeout(tm);
        }
        obj = document.getElementById('hpMiniGallery'); 
        if (obj) { 
            ep = parseInt(obj.style.left);
            pk = ds * 120;
            if ((pk - ep) < 0) {
                ep -= 2;
            } else {
                ep += 2;
            }
            //alert("Position: " + ep + "\nPark: " + pk + "\nOffset: " + ds);
            if (Math.abs(Math.abs(ep) - Math.abs(pk)) < 3) {
                ep = pk;
                if (tm != 0) {
                    clearTimeout(tm);
                }
                obj.style.left = ep + 'px';
            } else {
                obj.style.left = ep + 'px';
                tm = setTimeout("mpsm()",5);
            }
        } 
    }