$(document).ready(function(){
	// Listener specifically for the carousel
	// Pause videos when carousel activates
	
	CarouselVideoPlayer.listener = function() {
		var pids = this.playerIds;
		$(".jcarousel-control").each(function(){
			$("button",this).click(function(){ listenClick(); });
			$("a",this).click(function(){ listenClick(); });
		});
		
		function listenClick() {
			$.each(pids,function(i,val){
				if (document.getElementById(val)) { 
					try { document.getElementById(val).pause(); } 
					catch(err) { 
						var txt = err; //just do something.. IE complains  
					}
				}
			});
		}
	};
	CarouselVideoPlayer.listener();

	$("#sponsor-carousel").jCarouselLite({
		btnNext: ".jcarousel-control .next",
   	 	btnPrev: " .jcarousel-control .prev",
	    visible: 1,
	    start: 0,
  		scroll:1,
  		auto: null,
    	speed: 1000,
		circular:false,
	    btnGo: [".jcarousel-control .one", ".jcarousel-control .two",
	            ".jcarousel-control .three"],
	    afterEnd: function(a,b) {
			cs = ['one','two','three'];
			$(".jcarousel-control a").removeClass('active');
          	$(".jcarousel-control ."+cs[b]).addClass('active');
      }  

	}); 
	$('.rotate ul li').css('display','block');
});