	$(function(){
		var numEle = $('#featured_pic').children().size();
		numEle = numEle-1;
		var imgArray = new Array(numEle);
		for (var i=0; i < numEle; i++)
		{
			imgArray[i] = i+1;
		}
		$('.featuredPic').hide();		
		
		$('#fpic'+imgArray[0]).show();
		$('#nextAd').attr('curr',0);
		$('#prevAd').attr('curr',0);
		
		$('#nextAd').click(function(){
			$('#play').stopTime('scroll').show();
			$('#pause').hide();	
			var next = $(this).attr('curr');
			var next = parseInt(next);				
			if (next == numEle-1) {
				$('#fpic'+imgArray[next]).hide();				
				var next = 0;
				$('#fpic'+imgArray[next]).show();
				$('#nextAd').attr('curr',next);					
				$('#prevAd').attr('curr',next);
			} else {				
				$('#fpic'+imgArray[next]).hide();				
				var next = next + 1;
				$('#fpic'+imgArray[next]).show();
				$('#nextAd').attr('curr',next);								
				$('#prevAd').attr('curr',next);
			}
		});
		
		$('#prevAd').click(function(){
			$('#play').stopTime('scroll').show();
			$('#pause').hide();
			var prev = $(this).attr('curr');
			var prev = parseInt(prev);			
			if (prev == 0) {
				$('#fpic'+imgArray[prev]).hide();				
				var prev = numEle-1;
				$('#fpic'+imgArray[prev]).show();
				$('#prevAd').attr('curr',prev);	
				$('#nextAd').attr('curr',prev);
			} else {				
				$('#fpic'+imgArray[prev]).hide();				
				var prev = prev - 1;
				$('#fpic'+imgArray[prev]).show();
				$('#prevAd').attr('curr',prev);	
				$('#nextAd').attr('curr',prev);
			}
		});
		
		
		$('#play').click(function(){
			$(this).everyTime("8s","scroll",function(){
					var next = $('#nextAd').attr('curr');
					var next = parseInt(next);
					if (next == numEle-1) {
						$('#fpic'+imgArray[next]).hide();				
						var next = 0;
						$('#fpic'+imgArray[next]).show();
						$('#nextAd').attr('curr',next);					
						$('#prevAd').attr('curr',next);	
					} else {				
						$('#fpic'+imgArray[next]).hide();				
						var next = next + 1;
						$('#fpic'+imgArray[next]).show();
						$('#nextAd').attr('curr',next);								
						$('#prevAd').attr('curr',next);	
					}
				}).hide();
				$('#pause').show();
		});
		
		$('#pause').click(function(){
			$('#play').stopTime('scroll').show();
			$(this).hide();
		});
		
		$('#pause').hide();
		$('#play').click();
		
		var colors = new Array("green","orange","magenta","purple");
		var rndNum = Math.floor(Math.random()*4);
		
		$('#gsbh').addClass(colors[rndNum]);
		
	});
