function equalHeight(group) {
   tallest = 0;
   group.each(function() {
      thisHeight = $(this).height();
      if(thisHeight > tallest) {
         tallest = thisHeight;
      }
   });
   group.height(tallest);
}


$(document).ready(function () {
							
	//Banner Cycle
	
	$('#banner').cycle({ 
    fx:      'scrollDown', 
    speed:    2000, 
	pauseOnPagerHover: true,
    timeout:  8000 
});
	
	//Hide Banner logo if empty
	
	$(".banner-logo img[src='']").parent().addClass("hide");

	
	
	// Banner Animation
							
	equalHeight($(".contact-item"));	
	
	$('.banner-image').fadeIn(1500);
	
	$('.banner-caption').hide().delay(1500).slideToggle(1000);
	  
    $('#navigation li').hover(
        function () {
            //show its submenu
            $('ul', this).slideDown(200);
 
        },
        function () {
            //hide its submenu
            $('ul', this).slideUp(100);        
        }
    );


	
	// Slide to Top
	
	$('a.top').bind('click',function(event){
       var $anchor = $(this);

        $('html, body').stop().animate({
            scrollTop: $($anchor.attr('href')).offset().top
        }, 2000,'easeOutSine');
        /*
        if you don't want to use the easing effects:
        $('html, body').stop().animate({
            scrollTop: $($anchor.attr('href')).offset().top
        }, 1000);
        */
        event.preventDefault();
    });


// Text Limiter


 $.fn.textlimit = function()
  { 

    return this.each(function()                       
    {

    var $elem = $(this);            // Adding this allows u to apply this anywhere
    var $limit = 100;                // The number of characters to show
    var $str = $elem.html();        // Getting the text
    var $strtemp = $str.substr(0,$limit);   // Get the visible part of the string
    $str = $strtemp + '<span class="hide">' + $str.substr($limit,$str.length) + '</span> ...';  
    $elem.html($str);
    })

  };

// Call the text limiter above 


    $('.news-caption').textlimit()
	
// HIDE SOCIAL BUTTONS IF EMPTY

if ($('#consultant-social a.linkedin').attr('href') != '') { 
    $(this).hide();
} else {
    $(this).show();
}

if ($('#consultant-social a.twitter').attr('href') != '') { 
    $(this).hide();
} else {
    $(this).show();
}


});
