/**
 * The javascript code for the fundraiser page -- essentially, the slideshow locations for each
 * day on the map, descriptions of each day, and functions to replace slideshow/movie/map content
 * into the modal.
 * 
 * @author Aprille 
 */

/* Michigan Day object used for each point on map */
function MichDay(title, description, embedLink) {
	this.title = title;
	this.desc = description;
	this.embedLink = embedLink;
}

/** define the days and related slideshows */
var day = new Array();
day[0] = new MichDay(
	'Oscoda Start',
	"The ~200 mile trek across Michigan starts here in Oscoda on the frozen shores of Lake Huron. Lake Michigan seems many miles away, and its beaches are probably just as frozen. Here's hoping the journey is safe and that we raise lots of support for Margy's transplant along the way.",
	'<embed type="application/x-shockwave-flash" src="http://picasaweb.google.com/s/c/bin/slideshow.swf" width="600" height="400" flashvars="host=picasaweb.google.com&captions=1&RGB=0x000000&feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fknuthill%2Falbumid%2F5294718226761169857%3Fkind%3Dphoto%26alt%3Drss" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
day[1] = new MichDay(
	"Day 1",
	"Oscoda to River Road Camp. 13 miles. Weather: 10 - 14 &deg;F, minus 5 &deg;F windchill, light snow. Almost 10 inches of fresh powder make the ungroomed trail tough going. Don't think I will try snowshoes out here anymore. Flat terrain with some rolling hills. Roads near town, and trails through red pine and mixed forest beyond. People in Oscoda are very nice.",
	'<embed type="application/x-shockwave-flash" src="http://picasaweb.google.com/s/c/bin/slideshow.swf" width="600" height="400" flashvars="host=picasaweb.google.com&captions=1&RGB=0x000000&feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fknuthill%2Falbumid%2F5294720464314259233%3Fkind%3Dphoto%26alt%3Drss" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
day[2] = new MichDay(
	'Day 2',
	"River Road to S. Branch Camp. 19 miles today. 32 miles total. Weather: 5 - 15 &deg;F (minus 5 windchill) with light snow. The Shore to Shore Trail is quite beautiful, but the un-groomed conditions in winter make it slow going. Also used ATV trails, roadsides and some bush wacking. Rolling terrain along the AuSable River through Jackpine and mixed forest. Don't know how it happened, but one of my skis broke!",
	'<embed type="application/x-shockwave-flash" src="http://picasaweb.google.com/s/c/bin/slideshow.swf" width="600" height="400" flashvars="host=picasaweb.google.com&captions=1&RGB=0x000000&feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fknuthill%2Falbumid%2F5294723866170587793%3Fkind%3Dphoto%26alt%3Drss" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
day[3] = new MichDay(
	"Day 3",
	"South Branch to M-33. Over 22 miles today! 54 miles total. Weather: 0 - 18 &deg;F (minus 6 windchill). A long day of more than 8 hours on the trail took me past the one quarter mark across the state! Some Shore to Shore trail, some roadside, but mostly skied on ATV trails. Michigan snow-mobilers are nice people. Hot cocoa and an extra snickers were very good today. I fell for the first time, and then fell four more times in the last two miles due to steep trails and exhausted leg muscles.  Happy to see my pickup. Need rest.",
	'<embed type="application/x-shockwave-flash" src="http://picasaweb.google.com/s/c/bin/slideshow.swf" width="600" height="400" flashvars="host=picasaweb.google.com&captions=1&RGB=0x000000&feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fknuthill%2Falbumid%2F5295715970919102817%3Fkind%3Dphoto%26alt%3Drss" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
day[4] = new MichDay(
	"Day 4",
	"M-33 to M-72. Over 23 miles today. 77 miles total. Warm Weather: 29 - 47 &deg;F. Another long day. Over 9 hours on skis that ended in the dark using a headlamp for almost the last hour. Trails eluded me today, so after bushwhacking quite a bit, I ended up sticking to snowmobile trails to finish it out. Thanks Snowmobiler Kevin for giving me your map! Slushy shallow snow and mud in some areas, but still lots of deep snow in forested areas of Shore to Shore Trail.",
	'<embed type="application/x-shockwave-flash" src="http://picasaweb.google.com/s/c/bin/slideshow.swf" width="600" height="400" flashvars="host=picasaweb.google.com&captions=1&RGB=0x000000&feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fknuthill%2Falbumid%2F5301662549187720513%3Fkind%3Dphoto%26alt%3Drss" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');	
day[5] = new MichDay(
	"Day 5",
	"M-72 to Grayling. Over 24 miles today. 101 miles total! Weather: 16 - 27 &deg;F, light snow. Crossed Interstate-75, so I am more than half-way across the state :^) Long, slow day. Over 9 hours on hard ice and snow with a few unplanned side tracks to find the route. Ungroomed shore to shore trail, followed by back roads and atv trails.",
	'<embed type="application/x-shockwave-flash" src="http://picasaweb.google.com/s/c/bin/slideshow.swf" width="600" height="400" flashvars="host=picasaweb.google.com&captions=1&RGB=0x000000&feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fknuthill%2Falbumid%2F5304003755103437041%3Fkind%3Dphoto%26alt%3Drss" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
day[6] = new MichDay(
	'Day 6',
	"Grayling to Bear Lake. 20 miles today. 121 miles total. Weather: winter storm; 14 - 23 &deg;F (4 - 11 &deg;F windchill), heavy snow. Almost all snowmobile and atv trail through pine forest, some of which was shared by Shore to Shore Trail. Fresh snow and new (used) skis from REI made for fast conditions. My arms and legs are tired after pushing it hard today.",
	'<embed type="application/x-shockwave-flash" src="http://picasaweb.google.com/s/c/bin/slideshow.swf" width="600" height="400" flashvars="host=picasaweb.google.com&captions=1&RGB=0x000000&feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fknuthill%2Falbumid%2F5306094747056768481%3Fkind%3Dphoto%26alt%3Drss" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
day[7] = new MichDay(
	'Day 7',
	"Bear Lake to Kalkaska, MI. 18 miles today, 139 total. Weather: 10 - 20 &deg;F and gentle winds. Half the day on packed down snowmobile trail through beautiful forested landscape. Saw several deer looking for food. Then along roadside into Kalkaska where I stopped for sweets and some human contact. Doubled back to retrieve a glove. Picked up another snowmobile trail west of Kalkaska. Snow is melting, so I'm gonna continue tomorrow.",
	'<embed type="application/x-shockwave-flash" src="http://picasaweb.google.com/s/c/bin/slideshow.swf" width="600" height="400" flashvars="host=picasaweb.google.com&captions=1&RGB=0x000000&feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fknuthill%2Falbumid%2F5313893830939705537%3Fkind%3Dphoto%26alt%3Drss" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>'
	);
day[8] = new MichDay(
	'Day 8',
	"Kalkaska to Mayfield, MI. 23 miles today, 162 miles total. Weather: 27 - 43 &deg;F and sunny. Major melting has started! Hilly, slick terrain. Don't know how I managed to stay upright the whole day. Left the Shore to Shore trail for a portion because of little snow, but then had to cross a stream. Luckily there was a fallen log just below the surface. Snowmobile trails were wet and fast today, so I covered a lot of ground.",
	'<embed type="application/x-shockwave-flash" src="http://picasaweb.google.com/s/c/bin/slideshow.swf" width="600" height="400" flashvars="host=picasaweb.google.com&captions=1&RGB=0x000000&feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fknuthill%2Falbumid%2F5313894273867158481%3Fkind%3Dphoto%26alt%3Drss" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>'
	);
day[9] = new MichDay(
	'Day 9',
	"Mayfield, MI to M-37. 9 miles today, 171 miles total. Weather: 48 - 52 &deg;F. Global warming in effect. I did about as much 'water-skiing' as snow skiing today. Hiked with skis on my back to start. Then the shore to shore trail joined a snowmobile trail which had packed snow and puddling slush so I could ski. I am tired after the last two hard days, so I only did a half day today. I think two more trail days until Lake Michigan!",
	'<embed type="application/x-shockwave-flash" src="http://picasaweb.google.com/s/c/bin/slideshow.swf" width="600" height="400" flashvars="host=picasaweb.google.com&captions=1&RGB=0x000000&feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fknuthill%2Falbumid%2F5313894550111526561%3Fkind%3Dphoto%26alt%3Drss" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>'	
);
day[10] = new MichDay(
	'Day 10',
	"Day 10: 17 miles today, 188 miles total. Weather: 34 - 47 &deg;F, slight wind and mist. More time on pavement then skis today. Found a couple miles of snow through forest. Doubled back to retrieve that glove again. So many people stopped me today, handing me money in their pockets, offering a warm meal and even advice for Margys health. Very nice area. Tomorrow will be the big day with snow on snowmobile trails.",
	'<embed type="application/x-shockwave-flash" src="http://picasaweb.google.com/s/c/bin/slideshow.swf" width="600" height="400" flashvars="host=picasaweb.google.com&captions=1&RGB=0x000000&feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fknuthill%2Falbumid%2F5315846720693444193%3Fkind%3Dphoto%26alt%3Drss" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>'	
);
day[11] = new MichDay(
	'Day 11',
	"Day 11, LAST DAY! 17 miles, ~ 205 miles total. Weather: chilly and sunny. Reaching Empire after a few hard falls on ice today and running 4.3 miles in ski boots was a thrill! Having family and friends greet me was great. As one reporter wrote, though this is the trek's end, it is just the beginning for Margy. We succeeded in kicking off our campaign. Thank you everyone! God Bless our Mom!!",
	'<embed type="application/x-shockwave-flash" src="http://picasaweb.google.com/s/c/bin/slideshow.swf" width="600" height="400" flashvars="host=picasaweb.google.com&captions=1&RGB=0x000000&feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fknuthill%2Falbumid%2F5316924013521524961%3Fkind%3Dphoto%26alt%3Drss%26authkey%3DGv1sRgCJWRjdbP6aDtUA" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>'	
);

function changeContentToMapHelp() {
	$("#mapText").fadeOut("slow", function() {
		$("#mapHelp").fadeIn("slow");		
	});
}

/** shows the day associated with a position on the map */
function showDay(dayNum) {
	var title = '<h3 style="color:#C66701;margin-top:0px">Day ' + dayNum + '</h3>';
	var link = '<br/><br/> <a href="javascript:void(0)" onclick="changeContent(' + dayNum + ');showModal()">Click here to view slideshow photos</a>';
	var backLink = '<br/><br/>&lt;&lt;&nbsp;<a href="javascript:void(0)" onclick="changeContentToMapHelp();">Return to Map Help</a>';			
	
	$("#mapHelp").fadeOut("slow", function() {
		$("#mapText").fadeOut("slow", function() {
			$("#mapText").html('<h3>' + day[dayNum].title + '</h3>' + day[dayNum].desc + link + backLink);
			$("#mapText").fadeIn("slow");
			return false;
		});
	});
}

/** changes the content of the modal with a new slideshow embed link according to the selected day */
function changeContent(dayNum) {
	$("#modalSlideshow").html(day[dayNum].embedLink);
}

function addMapToModal() {
	$("#modalSlideshow").html('<iframe width="600" height="400" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;t=h&amp;s=AARTsJr0usmJ9OoGrnwumTBuYifrFZQS_Q&amp;msa=0&amp;msid=106582135177131647800.0004613139fd33054898d&amp;ll=44.953137,-84.649658&amp;spn=1.554972,3.295898&amp;z=8&amp;output=embed"></iframe><br />');
}

function addVideoToModal() {
	$("#modalSlideshow").html('<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/lIiJgBFI7eg&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/lIiJgBFI7eg&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>');
}

function addHighDefVideoToModal() {
	$("#modalSlideshow").html('<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/oWTXlws96zM&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/oWTXlws96zM&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="295"></embed></object>');
}
