/// <reference path="../../../../References/jquery-1.2.6-vsdoc.js" />

jQuery.fn.equalHeight = function() {
        var height = 0, 
                maxHeight = 0;

        // Store the tallest element's height
        this.each(function() {
                var t = jQuery(this);
                height = t.height() + parseInt(t.css('paddingTop'), 10) + parseInt(t.css('paddingBottom'), 10) + parseInt(t.css('borderTopWidth'), 10) + parseInt(t.css('borderBottomWidth'), 10);
                maxHeight = (height > maxHeight) ? height : maxHeight;
        });

        // Set element's min-height to tallest element's height
        return this.each(function() {
                var t = jQuery(this);
                        mh = maxHeight - (parseInt(t.css('paddingTop'), 10) + parseInt(t.css('paddingBottom'), 10) + parseInt(t.css('borderTopWidth'), 10) + parseInt(t.css('borderBottomWidth'), 10));
                if  (
                    $.browser.msie
                    &&
                    $.browser.version.substr(0,1) ==  "6"
                    )
                {
                  t.css({height: mh +'px'});
                }
                else
                {
                  t.css({minHeight: mh +'px'});
                }
        });
};

jQuery.initMeetTeam = function() {
    $("ul.profile li.info").equalHeight();

    if (
       window.doNotCollapse_Profile === undefined
       )
    {
        $("div.profiles h3").each(
            function()
            {
                var elId = $(this).attr("id").split('-')[1];
                var pos = $("#info-" + elId + " .position").text()
                if  (
                    $("#info-" + elId).length > 0
                    )
                {
                    $(this).append('<span class="toggle">Show [+]</span>');
                    $(this).hover(
                        function()
                        {
                            $(this).css({ "cursor": "pointer" });
                        }
                        ,
                        function()
                        {
                            $(this).css({ "cursor": "default" })
                        }
                    );
                }
                else
                {
                    $(this).children("span.name").css({ "text-decoration": "none", "color": "#003680" });
                }
            }
        );

        $("div.info").hide();

        $("div.profiles h3").click(
            function()
            {
                var elId = $(this).attr("id").split('-')[1];

                if  (
                    $("#info-" + elId).is(":hidden")
                    )
                {
                    if  (
                        $.browser.msie
                        &&
                        $.browser.version.substr(0, 1) == "6"
                        )
                    {
                        $("#info-" + elId).show(
                            0
                            ,
                            function()
                            {
                                $("#info-" + elId + " li.profileimage").css({ "position": "absolute", "right": "20px;" })
                            }
                        );
                    }
                    else
                    {
                        $("#info-" + elId).slideDown("slow");
                    }
                    $(this).children("span.toggle").text("Hide [-]");
                    $(this).children("span.name").addClass("highlight");
                    $(this).children("span.position").css({ "display": "none" });
                }
                else
                {
                    if  (
                        $.browser.msie
                        &&
                        $.browser.version.substr(0, 1) == "6"
                        )
                    {
                        $("#info-" + elId).hide();
                    }
                    else
                    {
                        $("#info-" + elId).slideUp("fast");
                    }
                    $(this).children("span.toggle").text("Show [+]");
                    $(this).children("span.name").removeClass("highlight");
                    $(this).children("span.position").css({ "display": "inline" });
                }
            }
        );
    }
}

$(document).ready
(
  function()
  {
    
    $.initMeetTeam();
    
  }
);