﻿jQuery(document).ready(function() {
    var word = jQuery(".glossaryLabel span.highlight");//.each(function(){alert(jQuery(this).parent("a").length);if(jQuery(this).parent("a").length === 0){ return jQuery(this);}});

    var msie = jQuery.browser.msie;
    var config = {
        sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)    
        interval: 350, // number = milliseconds for onMouseOver polling interval
        over: over, // function = onMouseOver callback (REQUIRED)    
        timeout: 150, // number = milliseconds delay before onMouseOut
        out: out // function = onMouseOut callback (REQUIRED)
    };

    word.each(function() {
        if (jQuery(this).parent("a").length === 0) {

            jQuery(this).hoverIntent(config);
 
            insertWordPopup(jQuery(this));         
        }else{
            jQuery(this).toggleClass("highlight");
        }
    });

   
 


    function over(e) {
        var word = jQuery(this);
        var description = jQuery("span.description", word);
        description.show();
    }

    function out() {
        var word = jQuery(this);
        var description = jQuery("span.description", word);
        if (msie) description.hide(); else description.fadeOut();
    }

    function redirectToGlossaryPage() {
        window.location = jQuery(this).attr("title");
    }

    function insertWordPopup(word)
    {
        jQuery(".popup", word).html(jQuery(".popup-holder." + word.text()).html());
    }
});  
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();