/*
	include-sidebar: - adds HTML to the right column for the site
					 - uses IDs on each page to target individual pages
	Created: September 14th, 2009
	Author: Gary Larocque
	
	Edited: October 6th, 2009 by Andrew Lawton
	
	
	===================================================================
	Layout IDs on site
	===================================================================
	layout-who-we-are
	layout-contact-us
	layout-our-people
	layout-press-room
	layout-our-partners	
	layout-olympians-ambassadors
	layout-whoweare-ambassadors
	layout-campaigns-linktous
	layout-campaigns-email
	layout-campaigns-web
	layout-campaigns-workplace
	layout-campaigns-municipal-donate
*/
window.addEvent('domready', function() {	
	var sidebar = $('include-sidebar');
		
	if (sidebar){
		sidebar.set('html','');
		
		// GIVE BUTTON
		var give_button = new Element('div', {
			'class' : 'button-give'
		}).adopt(new Element('a', {
			'href' : 'https://secure.olympicfoundation.ca/registrant/startup.aspx?eventid=29500&getpage=x'
		}).adopt(new Element('img', {
			'src' : '/download-nocache/gallery/img/buttongive270png',
			'alt' : 'Please Give',
			'title' : 'Please Give'
		})));
		
		//CUSTOM FEED	
		var custom_feed_header = new Element('h2', {
			'text' : 'Donor Voices'
		});
		
		var custom_feed_content = new Element('div', {
			'class' : "ps-custom-feed {'customFeed':{ 'blogUrl':'/.feed/blogs/reasonstog', 'hideDate':'true', 'maxNumber':'6', 'hideAuthor' : 'true' } }"
		});
		
		var custom_feed_footer = new Element('div', {
			'class' : 'link-trailer'
		}).adopt(new Element('a', {
			'href' : '/blogs/reasonstog',
			'text' : 'See All Donor Voices'
		}));
		
		var video_richards = '<object title="Christie Richards, Freestyle Skiing" width="275" height="275"><param name="movie" value="http://www.olympicfoundation.ca/cmedia/swf/flv_video/flvplayer.swf"/><param name="allowfullscreen" value="true"/><param name="wmode" value="opaque"/><param name="menu" value="false"/><param name="defer" value="defer"/><param name="flashvars" value="file=%2f%7b30290bc0-a371-481c-a9e0-e66886019f76%7d%2fdocuments%2fvideos%2fchristierichards30wmv&host=http%3a%2f%2fwww.olympicfoundation.ca%2f&showdigits=total&logo=&videoTitle=&errorMessage_loadFail=Unable to load file"/><embed src="http://www.olympicfoundation.ca/cmedia/swf/flv_video/flvplayer.swf" type="application/x-shockwave-flash" flashvars="file=%2f%7b30290bc0-a371-481c-a9e0-e66886019f76%7d%2fdocuments%2fvideos%2fchristierichards30wmv&host=http%3a%2f%2fwww.olympicfoundation.ca%2f&showdigits=total&logo=&videoTitle=&errorMessage_loadFail=Unable to load file" wmode="opaque" menu="false" width="275" height="275" allowfullscreen="true"></embed></object>';
		
		var video_otp = '<object title="Own the Podium" width="275" height="275"><param name="movie" value="http://www.olympicfoundation.ca/cmedia/swf/flv_video/flvplayer.swf"/><param name="allowfullscreen" value="true"/><param name="wmode" value="opaque"/><param name="menu" value="false"/><param name="defer" value="defer"/><param name="flashvars" value="file=%2f%7b30290bc0-a371-481c-a9e0-e66886019f76%7d%2fdocuments%2fvideos%2fcof_english_2min_final_broadbandwmv&host=http%3a%2f%2fwww.olympicfoundation.ca%2f&showdigits=total&logo=&videoTitle=&errorMessage_loadFail=Unable to load file"/><embed src="http://www.olympicfoundation.ca/cmedia/swf/flv_video/flvplayer.swf" type="application/x-shockwave-flash" flashvars="file=%2f%7b30290bc0-a371-481c-a9e0-e66886019f76%7d%2fdocuments%2fvideos%2fcof_english_2min_final_broadbandwmv&host=http%3a%2f%2fwww.olympicfoundation.ca%2f&showdigits=total&logo=&videoTitle=&errorMessage_loadFail=Unable to load file" wmode="opaque" menu="false" width="275" height="275" allowfullscreen="true"></embed></object>';
		
		var video_moyse = '<object title="Heather Moyse, Bobsled" width="275" height="275"><param name="movie" value="http://www.olympicfoundation.ca/cmedia/swf/flv_video/flvplayer.swf"/><param name="allowfullscreen" value="true"/><param name="wmode" value="opaque"/><param name="menu" value="false"/><param name="defer" value="defer"/><param name="flashvars" value="file=%2f%7b30290bc0-a371-481c-a9e0-e66886019f76%7d%2fdocuments%2fvideos%2fheathermoyse30wmv&host=http%3a%2f%2fwww.olympicfoundation.ca%2f&showdigits=total&logo=&videoTitle=&errorMessage_loadFail=Unable to load file"/><embed src="http://www.olympicfoundation.ca/cmedia/swf/flv_video/flvplayer.swf" type="application/x-shockwave-flash" flashvars="file=%2f%7b30290bc0-a371-481c-a9e0-e66886019f76%7d%2fdocuments%2fvideos%2fheathermoyse30wmv&host=http%3a%2f%2fwww.olympicfoundation.ca%2f&showdigits=total&logo=&videoTitle=&errorMessage_loadFail=Unable to load file" wmode="opaque" menu="false" width="275" height="275" allowfullscreen="true"></embed></object>';
		
		var video_lausher = '<object title="Reagan Lausher, Luge" width="275" height="275"><param name="movie" value="http://www.olympicfoundation.ca/cmedia/swf/flv_video/flvplayer.swf"/><param name="allowfullscreen" value="true"/><param name="wmode" value="opaque"/><param name="menu" value="false"/><param name="defer" value="defer"/><param name="flashvars" value="file=%2f%7b30290bc0-a371-481c-a9e0-e66886019f76%7d%2fdocuments%2fvideos%2freaganlausher30wmv&host=http%3a%2f%2fwww.olympicfoundation.ca%2f&showdigits=total&logo=&videoTitle=&errorMessage_loadFail=Unable to load file"/><embed src="http://www.olympicfoundation.ca/cmedia/swf/flv_video/flvplayer.swf" type="application/x-shockwave-flash" flashvars="file=%2f%7b30290bc0-a371-481c-a9e0-e66886019f76%7d%2fdocuments%2fvideos%2freaganlausher30wmv&host=http%3a%2f%2fwww.olympicfoundation.ca%2f&showdigits=total&logo=&videoTitle=&errorMessage_loadFail=Unable to load file" wmode="opaque" menu="false" width="275" height="275" allowfullscreen="true"></embed></object>';
		
		var video_glowing_hearts = '<object title="With Glowing Hearts" width="275" height="275"><param name="movie" value="http://www.olympicfoundation.ca/cmedia/swf/flv_video/flvplayer.swf"/><param name="allowfullscreen" value="true"/><param name="wmode" value="opaque"/><param name="menu" value="false"/><param name="defer" value="defer"/><param name="flashvars" value="file=%2f%7b30290bc0-a371-481c-a9e0-e66886019f76%7d%2fdocuments%2fvideos%2fwithglowinghearts60s_engwmv&host=http%3a%2f%2fwww.olympicfoundation.ca%2f&showdigits=total&logo=&videoTitle=&errorMessage_loadFail=Unable to load file"/><embed src="http://www.olympicfoundation.ca/cmedia/swf/flv_video/flvplayer.swf" type="application/x-shockwave-flash" flashvars="file=%2f%7b30290bc0-a371-481c-a9e0-e66886019f76%7d%2fdocuments%2fvideos%2fwithglowinghearts60s_engwmv&host=http%3a%2f%2fwww.olympicfoundation.ca%2f&showdigits=total&logo=&videoTitle=&errorMessage_loadFail=Unable to load file" wmode="opaque" menu="false" width="275" height="275" allowfullscreen="true"></embed></object>';
			
		switch(document.body.id){
			case "wa-campaigns":
				if($('layout-campaigns-linktous')){			
					//http://community.olympicfoundation.ca/takeaction/linktous, then create custom content
					var link_instructions = new Element('div').adopt([
						new Element('h2', {
							'text' : '"How To" Instructions'
						}),
						new Element('h2', {
							'class' : 'toggler'
						}).adopt(new Element('span', {
							'text' : 'For Bloggers (HTML code):'	
						})),
						new Element('ol', {'class' : 'element bullets'}).adopt([
							new Element('li', {
								'text' : 'Choose the image from the options to the left '
							}),
							new Element('li', {
								'text' : 'Copy all the code in the text box '
							}),
							new Element('li', {
								'text' : 'Paste the code into the location where you would like the image to appear '
							})
						]),
						new Element('h2', {
							'class' : 'toggler'
						}).adopt(new Element('span', {
							'text' : 'For Email Signatures:'	
						})),
						new Element('ol', {'class' : 'element bullets'}).adopt([
							new Element('li', {
								'text' : 'Highlight the image, right click and select "copy" '
							}),
							new Element('li', {
								'html' : 'Paste the image onto your computer (on your desktop or in an image folder) '
							}),
							new Element('li', {
								'html' : 'Open your email provider settings and select signature (for example, in MS Outlook, this is under Tools, Options and Mail Format)'
							}),
							new Element('li', {
								'html' : 'Edit your signature and insert the image into your signature (hyperlink is already linked) '
							}),
							new Element('li', {
								'html' : 'Save your settings'
							}),
							new Element('li', {
								'html' : 'Open a new email and the image and link will be displayed'
							})
						])
					]);
					
					//Add to sidebar (give button, and instructions accordion)
					sidebar.adopt([give_button, link_instructions]);	
				}else if($('layout-campaigns-email')){
					var email_instructions = new Element('ol', {'class' : 'bullets'}).adopt([
						new Element('li', {
							'text' : 'Click the email button of your choice to preview the style of message you would like to use'
						}),
						new Element('li', {
							'html' : 'Select all the text within the email and click copy. Open your email account and paste the text in a new message '
						}),
						new Element('li', {
							'html' : 'Personalize the message and send to all your friends, family and co-workers with the request that they join you in also supporting Canada\'s Olympic hopefuls'
						}),
						new Element('li', {
							'html' : 'Edit your signature and insert the image into your signature (hyperlink is already linked) '
						}),
						new Element('li', {
							'html' : 'Click "Send"'
						})
					]);
					
					//Add to sidebar (give button, and instructions)
					sidebar.adopt([give_button, new Element('h2', { 'text' : '"How To" Instructions'}), email_instructions]);	
				}else if($('layout-campaigns-web')){
					//http://community.olympicfoundation.ca/takeaction/banners, then create custom content			
					var link_instructions = new Element('div').adopt([
						new Element('h2', {
							'text' : '"How To" Instructions'
						}),
						new Element('h2', {
							'class' : 'toggler'
						}).adopt(new Element('span', {
							'text' : 'Web Banners in HTML code:'	
						})),
						new Element('ol', {'class' : 'element bullets'}).adopt([
							new Element('li', {
								'text' : 'Choose from the banner options on the left'
							}),
							new Element('li', {
								'text' : 'Copy all the code in the text box'
							}),
							new Element('li', {
								'text' : 'Insert code into your web page where you would like the banner to appear'
							})
						]),
						new Element('h2', {
							'class' : 'toggler'
						}).adopt(new Element('span', {
							'text' : 'For Email Signatures:'	
						})),
						new Element('ol', {'class' : 'element bullets'}).adopt([
							new Element('li', {
								'text' : 'Highlight the image, right click and select "copy"'
							}),
							new Element('li', {
								'html' : '# Select the location where you would like to place the ad, right click and select paste'
							})
						])
					]);
					//Add to sidebar (give button, and instructions accordion)
					sidebar.adopt([give_button, link_instructions]);
				}else if($('layout-campaigns-workplace')){
					//Add to sidebar (give button, form)
					var custom_form = new Element('div').adopt([
						new Element('h2',{
							'text' : 'Request your Campaign'
						}),
						new Element('p',{
							'text': 'Please complete this form in order for the Foundation to set up your Workplace or Group campaign site.',
							'class' : 'bold'	
						}), 
						new Element('iframe', {
							'height' : '931',
							'frameborder' : '0',
							'scrolling': 'no',
							'allowtransparency' : 'true',
							'src' : 'https://igloosoftware.wufoo.com/embed/w7w5w7/def/embedKey=w7w5w7421260',
							'styles' : {
								'border' : 'medium none',
								'width' : '100%'
							}
						})
					]);
					
					sidebar.adopt([give_button, custom_form]);	
				}else if($('layout-campaigns-municipal')){
					sidebar.set('html', '<div class="button-give"><a href="/campaigns/municipal/donate"><img src="/download-nocache/gallery/img/muni_donate_png" alt="Please Donate" title="Please Donate"/></a></div><h2>Join the Challenge Today!</h2><p>Select your province and municipality, and get started to support our athletes.</p><div id="ps-municipality"><p><label>Province:</label> <select id="ps-muni-homepage-province" name="province"><option>Select</option><option value="AB">Alberta</option><option value="BC">British Columbia</option><option value="MB">Manitoba</option><option value="NB">New Brunswick</option><option value="NL">Newfoundland and Labrador</option><option value="NT">Northwest Territories</option><option value="NS">	Nova Scotia</option><option value="NU">Nunavut</option><option value="ON">Ontario</option><option value="PE">Prince Edward Island</option><option value="QC">Quebec</option><option value="SK">Saskatchewan</option><option value="YT">Yukon</option></select></p><div style="overflow:hidden"><p><label>Municipality:</label> <select id="ps-muni-homepage-locations" name="municipality"><option>Select</option></select></p></div><p><input id="submitMunicipality" disabled="disabled" name="submit" type="submit" value="Find"></p><div id="ps-municipality-results">&nbsp;</div></div><p style="text-align:center"><img src="/download/gallery/img/canadamapjpg" alt="Canada"></p><h2>Council Toolkit</h2><p><a class="ps-modal-app { \'psmodalapp\':{ \'adoptelement\':\'modal-toolkit\', \'title\':\'Municipality Challenge Toolkit\', \'closetitle\':\'Close\', \'width\':500, \'height\':400 } }" href="#">→ Municipalities\' Challenge Council Toolkit</a></p><h2>Municipal Standings</h2><p>Municipalities across the country are taking part in this challenge. Check out how your municipality is doing.</p><a href="/campaigns/municipal/standings">→ View Standings</a>');
				}else if($('layout-campaigns-municipal-donate')){
					sidebar.set('html', '<h2>Council Toolkit</h2><p><a class="ps-modal-app { \'psmodalapp\':{ \'adoptelement\':\'modal-toolkit\', \'title\':\'Municipality Challenge Toolkit\', \'closetitle\':\'Close\', \'width\':500, \'height\':400 } }" href="#">→ Municipalities\' Challenge Council Toolkit</a></p><h2>Municipal Standings</h2><p>Municipalities across the country are taking part in this challenge. Check out how your municipality is doing.</p><a href="/campaigns/municipal/standings">→ View Standings</a>');
				}else{
					//Add to sidebar (give button, custom feed, and video)
					sidebar.adopt(give_button);	
					sidebar.set('html', sidebar.get('html') + video_richards);
					sidebar.adopt([custom_feed_header, custom_feed_content, custom_feed_footer]);
				}
				break;
			case "wa-olympians":
				//Add to sidebar (give button, custom feed, and video)
				sidebar.adopt(give_button);	
				sidebar.set('html', sidebar.get('html') + video_otp);
				sidebar.adopt([custom_feed_header, custom_feed_content, custom_feed_footer]);
				break;
			case "wa-spending":
				//Add to sidebar (give button, custom feed, and video)				
				
				sidebar.adopt(give_button);	
				sidebar.set('html', sidebar.get('html') + video_moyse);
				sidebar.adopt([custom_feed_header, custom_feed_content, custom_feed_footer]);
				break;
			case "wa-supporters":
				//Add to sidebar (give button, custom feed, and video)
				
				sidebar.adopt(give_button);	
				sidebar.set('html', sidebar.get('html') + video_lausher);
				sidebar.adopt([custom_feed_header, custom_feed_content, custom_feed_footer]);
				break;
			case "wa-connect":
				//Add to sidebar (give button, custom feed, and video)
				sidebar.adopt(give_button);
				sidebar.set('html', sidebar.get('html') + video_otp);				
				break;
			case "wa-foundation":
				//Add to sidebar (give button, custom feed, and video)
				sidebar.adopt(give_button);	
				sidebar.set('html', sidebar.get('html') + video_glowing_hearts);
				sidebar.adopt([custom_feed_header, custom_feed_content, custom_feed_footer]);
				break;
			default:
				//Add to sidebar (give button, custom feed, and video)				
				sidebar.adopt(give_button);	
				sidebar.set('html', sidebar.get('html') + video_glowing_hearts);
				sidebar.adopt([custom_feed_header, custom_feed_content, custom_feed_footer]);
				break;
		}
		
	}			
});