(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);
(function (a) {
    a.fn.RYnavDropdown = function (c) {
        var d = a.extend({}, a.fn.RYnavDropdown.defaults, c);
        var b = navigator.appVersion;
        if (b.match("MSIE 6")) {
            b = "ie6"
        }
        return this.each(function (g) {
            $navWrapper = a(this);
            $navContainer = a(this).find("#navigation-primary");
            $navList = a(this).find("#navigation-primary > ul");
            $navContainer.after('<div id="wrapper-navigation-sub"><div id="navigation-sub" style="display: none;" class="navigation"></div></div>');
            $subContainer = a(this).find("#navigation-sub");
            var j = [];
            var f = -1;
            var e;
            $navList.children("li").each(function (i) {
                if (a(this).find(".inner").html() == null) {
                    j[i] = ""
                } else {
                    j[i] = a(this).find(".inner").html()
                }
                $subContainer.append('<div id="navigation-sub-' + i + '" class="inner" style="display:none;">' + j[i] + "</div>");
                if (j[i].indexOf("<ul>") >= 0 || j[i].indexOf("<UL>") >= 0) {
                    a(this).addClass("active")
                } else {
                    a(this).addClass("inActive")
                }
            });
            $navList.children("li.active").hoverIntent(function (i) {
                e = $navList.children("li").index(this);
                k();
                h()
            }, function (i) {});
            $navWrapper.hoverIntent(function (i) {}, function (i) {
                l();
                f = -1
            });
            $navList.children("li.inActive").hoverIntent(function (i) {
                l();
                f = -1
            }, function (i) {});
            a(".quick-search").hoverIntent(function (i) {
                l();
                f = -1
            }, function (i) {});

            function h() {
                $subContainer.animate({
                    height: "show"
                }, {
                    duration: d.duration,
                    easing: d.easeInType
                })
            }
            function l() {
                $subContainer.animate({
                    height: "hide"
                }, {
                    duration: d.durationFast,
                    easing: d.easeInType
                });
                $subContainer.find("div.inner:eq(" + f + ")").animate({
                    delay: 0
                }, d.durationFast, function () {
                    a(this).css("display", "none")
                })
            }
            function k() {
                if (f == -1 || f == e) {
                    $subContainer.find("div.inner:eq(" + e + ")").css({
                        display: "block",
                        opacity: 1
                    })
                } else {
                    $subContainer.find("div.inner:eq(" + f + ")").css({
                        display: "block",
                        opacity: 1
                    });
                    $subContainer.find("div.inner:eq(" + e + ")").css({
                        display: "block",
                        opacity: 0
                    });
                    $subContainer.find("div.inner:eq(" + f + ")").animate({
                        opacity: 0
                    }, 200, function () {
                        a(this).css("display", "none")
                    });
                    $subContainer.find("div.inner:eq(" + e + ")").animate({
                        opacity: 0
                    }, 100).animate({
                        opacity: 1
                    }, 350)
                }
                f = e
            }
        })
    }
})(jQuery);
$.fn.RYnavDropdown.defaults = {
    easeType: "easeInOutCirc",
    durationFast: 400,
    duration: 800
};
$(document).ready(function(){ 
 $('#navWrapper').RYnavDropdown(); 
 });
