/// <reference path="~/Scripts/app/references.js" />

if (typeof FLTK.DEP === "undefined" || !FLTK.DEP) {
    FLTK.DEP = {};
}

FLTK.DEP.getElement = function(theid, thedoc) {
    return $("#" + theid, (thedoc || document))[0];
};

FLTK.DEP.getOffsetLeft = function(element, value) {
    if (element != null && element.tagName != null) {
        if (element.tagName.toLowerCase() == "th" || element.tagName.toLowerCase() == "td" || element.tagName.toLowerCase() == "a" ||
			element.tagName.toLowerCase() == "table") {
            value += element.offsetLeft;
        }
    }
    try {
        if (element != null) {
            value = FLTK.DEP.getOffsetLeft($(element).parent()[0], value);
        }
    } catch (e) { }
    return value;
};

FLTK.DEP.getOffsetTop = function(element, value) {
    if (element != null && element.tagName != null) {
        if (element.tagName.toLowerCase() == "th" || element.tagName.toLowerCase() == "td" || element.tagName.toLowerCase() == "a" ||
			element.tagName.toLowerCase() == "table") {
            value += element.offsetTop;
        }
    }
    if (element != null) {
        value = FLTK.DEP.getOffsetTop($(element).parent()[0], value);
    }
    return value;
};
