﻿var intervalUp =  1;
var intervalDown = 1;
var step = 3;
var current;
var element;
var topheight;
var initialheight;
//slide up
function SlideUpRun(elementId, top_height, initial_height) {
    element = document.getElementById(elementId);
    topheight = top_height;
    initialheight = initial_height;

    setTimeout("SubSlideUpRun();", intervalUp);
};
function SubSlideUpRun() {
    if (current < initialheight) {
        current = current + step;
        element.style.marginTop = current +"px";
        setTimeout("SubSlideUpRun();", intervalUp);
    }
};
//slide down

function SlideDownRun(elementId, top_height, initial_height) {

    element = document.getElementById(elementId);
    topheight = top_height;
    initialheight = initial_height;
    current = initial_height;
    setTimeout("SubSlideDownRun();", intervalDown);
    

};
function SubSlideDownRun() {
    if (current > topheight) {
        current = current - step;
        element.style.marginTop = current + "px";
        setTimeout("SubSlideDownRun();", intervalDown);
    }
};
 