$(document).ready(function() {
	// trademark on menu
	$('#PMSI-Click-11 a').append('&trade;');
	$("h2.grid_16:contains('PMSI Click')").append('<span>&trade;</span>');				   
	// video tabs
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	$("ul.tabs li").click(function() {//On Click Event
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});
	//industry carousel
    $('#carousel').jcarousel();
    
    $('#carousel li img').each(function()
    {
        var $label = $('<span>' + $(this).attr('alt') + '</span>');
        $(this).after( $label );
    });
    
    //randomise the bottom list of industries
    $("ul#carousel").randomize("li");
 // });

});

(function($) {

$.fn.randomize = function(childElem) {
  return this.each(function() {
      var $this = $(this);
      var elems = $this.children(childElem);

      elems.sort(function() { return (Math.round(Math.random())-0.5); });  

      $this.remove(childElem);  

      for(var i=0; i < elems.length; i++)
        $this.append(elems[i]);      

  });    
}
})(jQuery);
