﻿(function (c)
{
    function p() { var d, a = { height: h.innerHeight, width: h.innerWidth }; if (!a.height && ((d = i.compatMode) || !c.support.boxModel)) d = d === "CSS1Compat" ? k : i.body, a = { height: d.clientHeight, width: d.clientWidth }; return a } var m = {}, e, a, i = document, h = window, k = i.documentElement, j = c.expando; c.event.special.inview = { add: function (a) { m[a.guid + "-" + this[j]] = { data: a, $element: c(this)} }, remove: function (a) { try { delete m[a.guid + "-" + this[j]] } catch (c) { } } }; c(h).bind("scroll resize", function () { e = a = null }); setInterval(function ()
    {
        var d =
c(), j, l = 0; c.each(m, function (a, b) { var c = b.data.selector, e = b.$element; d = d.add(c ? e.find(c) : e) }); if (j = d.length)
        {
            e = e || p(); for (a = a || { top: h.pageYOffset || k.scrollTop || i.body.scrollTop, left: h.pageXOffset || k.scrollLeft || i.body.scrollLeft }; l < j; l++) if (c.contains(k, d[l]))
            {
                var g = c(d[l]), f = { height: g.height(), width: g.width() }, b = g.offset(), n = g.data("inview"), o; if (!a || !e) break; b.top + f.height > a.top && b.top < a.top + e.height && b.left + f.width > a.left && b.left < a.left + e.width ? (o = a.left > b.left ? "right" : a.left + e.width < b.left + f.width ?
"left" : "both", f = a.top > b.top ? "bottom" : a.top + e.height < b.top + f.height ? "top" : "both", b = o + "-" + f, (!n || n !== b) && g.data("inview", b).trigger("inview", [!0, o, f])) : n && g.data("inview", !1).trigger("inview", [!1])
            } 
        } 
    }, 250)
})(jQuery);
