$(document).ready(function(){
	$("ul.slideshow > li").wrapInner("<div style='width:482px; height: 228px;'></div>");
	$("ul.slideshow > li .blurb").after( $("<div class='photo'/>") );// photo div for right-side of slide
	/*
		Get each of the <a href> from 
				<li id="ssWhatever">
					<div class='link'>
						<a href='http://link-to-somewhere-goes-here.html'>link</a>
					</div>
					...
		then insert the href from th <A> tag into the whole slide.  When the slide is clicked anywhere, you will be taken to the action 
		of the 'href' value
	*/
	$.each( $("ul.slideshow").children(), function(i,item) {
		$(item).click(function(){
			var href = $(item).find("div.link a").attr('href');
			window.location.href=href;
		});
	});

	/*
		When the slide is changed (automatically or by clicking the pager-nav), shove the slide's title into the 'title' area of nav
	*/
	function highlightButton() {						
		var id = $(this).attr('id');
	}
		/* var link = $("#" + id + " > div.title").html();
		$("#slideTitle").html(link);
	}*/

	/*
		The handy-dandy jquery cycle() plug-in
	*/
	$('#play').hide();
	
	$('ul.slideshow').cycle({ 
		fx:     	'fade', 
		prev:   	'#prev', 
    	next:   	'#next',
		timeout: 	5000, 
		pager:		"div.slideshowNav",
		before:		highlightButton
		//pagerEvent: 'mouseover',
    	//pauseOnPagerHover: 'true' 
	});

	$.each( $("div.slideshowNav").children(), function(i,item){
		var id="ssButton_"+(i+1);	
		$(item)
		.	attr("id", id)
		.	html("")
		;
	});
		
	$('#pause').click(function() { 
    $('ul.slideshow').cycle('pause');
	$(this).css('display','none'); 
	 $('#resume').css('display','block');
    return false;
  });
 
    $('#resume').click(function() { 
    $('ul.slideshow').cycle('resume');
    $(this).css('display','none'); 
	$('#pause').css('display','block');
    return false;
  });

});

