﻿
    function infoTips() {
        var $tt = jQuery('a.infoTip');
        if ($tt.size() > 0) {
            var ttCnt = '<span class="toolTip_content"><span class="toolTip_top">&nbsp;</span><span class="toolTip_span"></span><span class="toolTip_bottom">&nbsp;</span></span>';

            $tt.each(function () {
                $this = jQuery(this);
                this.thisTop = 0;

                $this.append(ttCnt);
                if ($this.attr('href') != '#') {
                    jQuery('.toolTip_span', $this).load($this.attr('href') + ' #blank-wrapper');
                } else {

                    jQuery('.toolTip_span', $this).html(jQuery('.infoTipContent').eq($this.index('a.infoTip')).text());
                }                
            });

            $tt.click(function () {
                return false;
            });

            $tt.hover(function () {
                if (jQuery(this).parents('li').size() > 0) {
                    jQuery(this).parents('li').css('zIndex', '9999');
                }
                jQuery('.toolTip_content', this).stop().fadeIn(0);


                this.thisTop = jQuery(this).offset().top - jQuery(document).scrollTop();
                //alert(this.thisTop + ' ' + jQuery(this).children().height());
                if (jQuery(this).children().height() > this.thisTop) {
                    //flip classes on top, bottom, and container
                    jQuery(this).find('span').addClass('toolTip_down');
                }
                else {
                    jQuery(this).find('span').removeClass('toolTip_down');
                }


            }, function () {
                if (jQuery(this).parents('li').size() > 0) {
                    jQuery(this).parents('li').css('zIndex', '100');
                }
                jQuery('.toolTip_content', this).stop().fadeOut(0);
                jQuery(this).find('span').removeClass('toolTip_down');
            });
        }

        var $filterGrp = jQuery('.filterGroup');
        if ($filterGrp.size() > 0) {
            $filterGrp.eq($filterGrp.size() - 1).find('.infoTip').attr('style', 'display:inline-block').eq(0).attr('style', 'display:none') ;
        }

        jQuery(function () {
            var zIndexNumber = 1000;
            jQuery('a').each(function () {
                $(this).css('zIndex', zIndexNumber);
                zIndexNumber -= 10;
            });
        }); 

    }


