//Client List

$(document).ready(function() {
   $("#client_logos").children(":first").css({'border': '2px solid #FFF'});
   $("#listy").children(":first").css({'opacity':'1'});
   
   $(".team").click(function(){
       
       $("#people-list").slideToggle();
       
   });
   
   $(".jlist").delegate("li", "hover",function(e){
       
       if(e.type=='mouseenter'){
          $(this).animate({ backgroundColor: "#d71a21" }).css({'border-bottom': '2px solid #f54454'});
          $(this).prev().css({'border-bottom': '2px solid #f54454'});
          $(this).children(":first").animate({color: "#FFF"});
          if($(this).hasClass('first')){
              $(this).css({'border-top': '2px solid #f54454'});
          }
       }else if(e.type=='mouseleave'){
          $(this).animate({ backgroundColor: "#e5e4e4"}).css({'border-bottom': '2px solid #d0cecd'});
          $(this).prev().css({'border-bottom': '2px solid #d0cecd'});
          $(this).children(":first").animate({color: "#000"});
          if($(this).hasClass('first')){
              $(this).css({'border-top': '2px solid #d0cecd'});
          }
       }
       
   });
});

$('#client_logos').delegate('img', 'click', function() {
    var id = $(this).attr('id').substr(0,$(this).attr('id').length - 4);
	var client = $("#" + id);
	
	if (client.parent().children(":first").attr('id') != client.attr('id')){
		$("#listy").children(":first").css({'opacity':'0.5'});
		$("#client_logostwo").children().css({'border': '2px solid transparent'});
		$(this).css({'border': '2px solid #FFF'});
		client.slideUp('slow', function() {
			$(this).css({'opacity':'1'});
			$(this).insertBefore('#listy li:first').slideDown(function () {
				$(this).effect("highlight", {}, 500);
				});
    	})
    }
    return false;
});
