﻿/*
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:1,interval:0,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);

/*
* FLYOUT LAYERS (Based off of Megamenus)
* This part of the script taken from: http://www.sitepoint.com/blogs/2009/03/31/make-a-mega-drop-down-menu-with-jquery/
* 
* Modified by: Chandan Sinha
* Project: LexisNexis' Communities
*/
$(document).ready(function() {

    function addMega() {
        $(this).children().css('visibility','visible');
        $(this).addClass("hovering");
        $($(this).find("a span")).addClass("hover");
        $($(this).find("div.glance")).css('display','block');
        $($(this).find("div.section-bg")).css('visibility','hidden');
        $($(this).find("div.section-bg-content")).css('visibility','visible');
    }
    function removeMega() {
        $(this).removeClass("hovering");
        $($(this).find("a span")).removeClass("hover");
        $('embed').css('visibility','visible');
        $('object').css('visibility','visible');
        $($(this).find("div.glance")).css('display','none');
        $($(this).find("div")).removeClass("section-bg-big");
        $($(this).find("div.float-left")).html("&nbsp;");
    }
    var megaConfig = {
        interval: 0,
        sensitivity: 1,
        over: addMega,
        timeout: 0,
        out: removeMega
    };
    $("li.mega").hoverIntent(megaConfig);
    
    $($(this).find("a.close-button")).click(function() {
        //$($(this).parent().parent().parent().find("li.mega")).removeClass("hovering");
        $("li.mega").mouseout();
    });
    
    $($(this).find("div.glance a")).click(function() {
        $('embed').css('visibility','hidden');
        $('object').css('visibility','hidden');
        $($(this).parent().parent().find("div.section-bg")).addClass("section-bg-big");
        $($(this).parent().parent().find("div.section-bg")).css('visibility','visible');
        $($(this).parent()).css('display','none');
        var Id = $(this).attr("id");
        if(Id!="")
        {
            var leftid = "#left" + Id;
            var sectionid = "#section" + Id;
            $(leftid).html("<div class='flyout-loader'><img src='/community/portal/images/loader.gif' border='0' />&nbsp;</div>");
            Flyout($(leftid), Id,"FlyoutProcess"); 
            Flyout($(sectionid), Id, "MoreSection"); 
        }
    });
});

function Flyout(em,id,functionname) {
    $.ajax({
        type: "POST",
        url: "http://www.lexisnexis.com/community/bankruptcylaw/themes/practicearea/common/service.aspx/"+functionname,
        data: "{no:"+id+"}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {
            $(em).html(msg.d); 
            $.jFastMenu("#menu");
            //updateTypeface();
        }
    });
}

function updateTypeface(){
if (_typeface_js) { 
  _typeface_js.renderDocumentLock = false;
  _typeface_js.renderDocument(function(e){
  e.style.visibility = 'visible'
  });
}
} 