$(window).load(function() {
	$.ajax({
        type: "GET",
		url: "/xml/sb_bluebronna/rotatingStory2.xml?_nc= " + Math.random(),
		dataType: "xml",
		success: function(slide_xml) {
			setupHTMLandSlideshow(slide_xml);
		}
	});    
});        

function setupHTMLandSlideshow(slide_xml) {
	// setup html                       
	var newHTML = "";
	var storyCount = 0;
	$(slide_xml).find('story').each(function(){
		newHTML += "<div><a href='" + $(this).attr('pageLink') + "'><img src='" + $(this).attr('imageLink') + "' /></a></div>";
		storyCount++;
	});                                                                                                          
	
	$("#slider").html(newHTML);
	$("#slider").cycle({
		fx: "fade", pager: "#slideshow_controls_list", speed: 1000, timeout: 5000, pause: 1
	});                                      
	var newControlWidth = $(".slideshow_controls").width() * storyCount;
	$(".slideshow_controls").css("width", newControlWidth + "px");
	
	

}

/*function makeSlideshow() {
	// create slideshow
	$('#slider').nivoSlider({
		effect:'fade',
		slices:15,
		animSpeed:500,
		pauseTime:3000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:true, //Next & Prev
		directionNavHide:true, //Only show on hover
		controlNav:false, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:false, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});
}*/
