﻿function flowMove(a, id, w, move, num) {
    var obj = $("#" + id);
    if (num > obj.children().length) {
        return;
    }
    if (move == "v") {
        if (a > 0) {
            if (obj.css("top") != "0px") { tappendf(obj); }
            obj.animate({ top: -w + "px" }, 500, function () { tappendf(obj); });
            obj.children("img").eq(1).click();
        }
        else {
            if (obj.css("top") != -w + "px") { tprependl(obj, w); }
            obj.animate({ top: 0 + "px" }, 500, function () { tprependl(obj, w); });
            obj.children("img").eq(0).click();
        }
    }
    else {
        if (a > 0) {
            if (obj.css("left") != "0px") { lappendf(obj); }
            obj.animate({ left: -w + "px" }, 500, function () { lappendf(obj); });
        }
        else {
            if (obj.css("left") != -w + "px") { lprependl(obj, w); }
            obj.animate({ left: 0 + "px" }, 500, function () { lprependl(obj, w); });
        }
    }
}

function tappendf(obj) {
    obj.append(obj.children(":first-child")).css("top", "0px");
}
function tprependl(obj, w) {
    obj.prepend(obj.children(":last-child")).css("top", -w + "px");
}
function lappendf(obj) {
    obj.append(obj.children(":first-child")).css("left", "0px");
}
function lprependl(obj, w) {
    obj.prepend(obj.children(":last-child")).css("left", -w + "px");
}
