$(document).ready(function(){
	
	// ExtraContent Area
	$('.ExtraContent h4:first').wrap('<div class="ExtraHeader"></div>');
	$('.ExtraHeader').siblings().wrapAll('<div class="ExtraArea"></div>');
	$('.ExtraHeader').click(function(){
		$('.ExtraArea').slideToggle();
	});
	
	// Rotating fading images
	$('.MainPicture img').wrap('<div class="Slide"></div>');
	$('.MainPicture').cycle({ 
		fx: 'fade', 
		speed: 1500,
		timeout: 8000,
		pause: true,
		slideExpr: '.Slide',
		fit: 1
	 });
	 
	 // Add classes to balloons in picture area (Balloon1, Balloon2 etc)
	 /*var count = 1;
	 $('.Home .BalloonPicture img').each(function(){
		$(this).addClass('Balloon' + count);
		count++;
	 });*/

	// Make balloons move
	/*balloonmove1();
	balloonmove2();
	balloonmove3();*/
	
	picturemove();
	
	// Move location of Enhance2NewsArticleImageWrap in News feed markup
	/*$('.Enhance2NewsFeedArticle').each(function(){
		var imageWrap = $(this).find('.Enhance2NewsArticleImageWrap');
		imageWrap.remove();
		$(this).prepend(imageWrap);
	});*/
	
	/* Scrolling Feature panels */
	$('.FeatureContent1').wrapInner('<div class="FeatureInnerWrap"></div>').carousel({
		dispItems: 2,
		autoSlide: true,
		loop: true,
		autoSlideInterval: 6000
	});
	
	// Sliding news rss
	$('.FeatureContent3 .rssincl-entry').addClass('Slide');
	$('.FeatureContent3 .rssincl-content').cycle({ 
		fx: 'scrollLeft', 
		speed: 1500,
		timeout: 8000,
		pause: true,
		slideExpr: '.Slide',
		fit: 1
	 });
	
});

// Moving background
function picturemove(){
	$('.MainContentWideWrap').css({'backgroundPosition': '0 bottom'}).animate({'backgroundPosition': "-2000 bottom"}, 200000, 'linear', picturemove);
}

// Balloon move animations
function balloonmove1(){
	$('.Balloon1').animate({'top': '-20px', 'left': '220px'}, 5000)
	.animate({'top': '30px', 'left': '200px'}, 7000)
	.animate({'top': '-20px'}, 5000)
	.animate({'top': '30px', 'left': '220px'}, 7000, balloonmove1);
}
function balloonmove2(){
	$('.Balloon2').animate({'top': '0px'}, 10000)
	.animate({'top': '50px'}, 5000, balloonmove2);
}
function balloonmove3(){
	$('.Balloon3').animate({'top': '320px'}, 20000)
	.animate({'top': '50px'}, 10000, balloonmove3)
	.animate({'top': '150px', 'left': '450px'}, 10000)
	.animate({'top': '220px', 'left': '380px'}, 10000, balloonmove3)
	;
}