﻿var speed = 4;
var mouseoverTop;
var moveoverBottom;

function up(container) {

    
    if ((parseInt(container.css('top')) + speed) <= 0) {
        container.css('top', parseInt(container.css('top')) + speed + "px");
        mouseoverTop = setTimeout(function () {
            up(container);
        }, 20);
    }
};

function down(container) {
    
    var OffsetHeight = container.attr("offsetHeight");
    var containerHeight = container.parent().height();

    if (parseInt(container.css('top')) >= (OffsetHeight * (-1) + containerHeight)) {
        container.css('top', parseInt(container.css('top')) - speed + "px");
        moveoverBottom = setTimeout(function () {
            down(container);
        }, 20);
    }
};
