<!--

$(function(){
	// Display the feature spot slideshow
	$('#featureSpot').after('<ul id="featureSpotPager">').cycle({
		fx: 'fade',
		speed: 'fast',
		timeout: 8000,
		pager: '#featureSpotPager',
		pagerEvent: 'mouseover',
		pagerAnchorBuilder: function(key, slide) {
			var featureSpot = jQuery(slide);
			var heading = featureSpot.children('div.content').children('h1').text();
			var url = featureSpot.children('div').children('a').attr('href');
			if ( url == undefined ){
				url = featureSpot.children('div').children('p').children('a').attr('href');
			}
			return '<li><a href="'+url+'" class="featureSpotItem"><h1>' + heading + '</h1><p>read more <img src="/images/read-more-arrow.gif" alt="read more" width="13" height="16" /></p></a></li>';
		},
		updateActivePagerLink: function(elementId, selIndex) {
			$.each($(elementId).children(), function(pageIndex, page) {
				if ( selIndex == pageIndex ) {
					$(this).css('background-color', '#facd40');
				}
				else {
					$(this).css('background-color', '#f26f21');
				}
			});
		}
	});
	$('a.featureSpotItem').click(function(e){
		var alink = jQuery(e.target);
		if ( alink.attr('href') != undefined ) {
			window.location = alink.attr('href');
		}
		else {
			alink = alink.parent();
			if ( alink.attr('href') != undefined ) {
				window.location = alink.attr('href');
			}
			else {
				alink = alink.parent();
				window.location = alink.attr('href');
			}
		}
	});
	// Display the feature spot slideshow
	$('#featuredDanceStyle').before('<ul id="danceStylePager">').cycle({
		fx: 'fade',
		speed: 'fast',
		timeout: 10000,
		pager: '#danceStylePager',
		pagerEvent: 'mouseover',
		pagerAnchorBuilder: function(key, slide) {
			var danceStyle = jQuery(slide);
			var heading = danceStyle.children('h1').text();
			return '<li>' + heading + '</li>';
		},
		updateActivePagerLink: function(elementId, selIndex) {
			$.each($(elementId).children(), function(pageIndex, page) {
				if ( selIndex == pageIndex ) {
					$(this).css('background-color', '#ff9a12');
				}
				else {
					$(this).css('background-color', '#f25d21');
				}
			});
		}
	});
});

//-->
