		function setUpRotator(totalitems)
		{
			var totalFeatures = totalitems; //total number of features in feature rotator
			var current = 0; // number of current feature being rotated
		
			$('#rotate').cycle({
				fx: 'fade',
				timeout:7000,
				fit:1,
				width:"33.0em",
				height:"15em",
				random:0,
				cleartype:1,
				speed:250,
				next:'#next',
				prev:'#prev',
				after:function(c,n,o,f) //currentSlideElement,nextSlideElement,Options, forwardFlag(true unless pressed previous button)
				{	
					if(f){
						if(current<totalFeatures)
						{
							current++;
						}else{
							current = 1;
						}
					}else{
						if(current>1)
						{
							current--;
						}else{
							current = totalFeatures;
						}
					}
					$('#divNumbers').html(current + " of " + totalFeatures);
				}
			});
		
			$("#play_pause").click(
				function (){
				var src = $('#play_pause').attr('src');
				if(src.match("pause.png")){  //contains pause.png in image title
					$('#play_pause').attr('src','images/layout/play.png').attr('alt','resume news rotator');
					$('#rotate').cycle('pause');
				}else{
					$('#play_pause').attr('src','images/layout/pause.png').attr('alt','pause news rotator');
					$('#rotate').cycle('resume');
				}
				
			});
		}
		
		function rev_accordion(header)
		{
			$(header).prepend("<span class='icon'>+ </span>");
			$(header).toggle(function() {
				var t = $(this);
				var n = t.next();
			if(n.is(":hidden")){
				t.find(".icon").html("&ndash; ");
			}else{t.find(".icon").html("+ ")}
			n.slideToggle();
			return false;
		},function() {
				var t = $(this);
				var n = t.next();
			if(n.is(":hidden")){
				t.find(".icon").html("&ndash; ");
			}else{t.find(".icon").html("+ ")}
			n.slideToggle();
			return false;
		}).next().hide();
	
		}
		
		function onYouTubePlayerReady(playerId)
		{
			var ytplayer = document.getElementById("player");
			ytplayer.addEventListener('onStateChange','ifPlaying');
		}
		
		function ifPlaying(newState)
		{
			//console.log(newState);
			
			if(newState == 1 || newState == 3)
			{
				var src = $('#play_pause').attr('src');
				if(src == "images/layout/pause.png"){
					$('#play_pause').attr('src','images/layout/play.png').attr('alt','resume news rotator');
					$('#rotate').cycle('pause');
				}
			}
		}
		
		
