﻿$(document).ready(function(){
    $("#page-wrapper").addClass("js");
    
    $(".team-member", "#team-members").each(function()
    {
        var _this = $(this);        
        $(".left a,.title a", _this).attr("href", "#").click(function()
        {
            _this.toggleProfile();
            $("div.team-member:visible", "#team-members").not(_this).slideUpProfile();            
            return false;
        });
    });
});


jQuery.fn.toggleProfile = function() {
    return this.each(function() {
        var _this = $(this);
        _this.toggleClass("active");
        
        if(!(_this.hasClass("active")))
        {
            _this.slideUpProfile();
        }
        else
        {
            _this.slideDownProfile();
        }
    })};
    
jQuery.fn.slideUpProfile = function() {
    return this.each(function() {
        var _this = $(this);
        
        _this.removeClass("active");
        $(".left img", _this).animate({marginTop: "0px", width: "40px"}, "slow");
        $(".description", _this).slideUp("slow");
    })};
    
jQuery.fn.slideDownProfile = function() {
    return this.each(function() {
        var _this = $(this);
        
        _this.addClass("active");
        $(".description", _this).slideDown("slow");
        $(".left img", _this).animate({marginTop: "56px", width: "88px"},"slow");
    })};