/*
	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
	layout-connect
*/
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&LangPref=fr-CA&getpage=donate.aspx%3FLangPref%3Dfr-CA'
		}).adopt(new Element('img', {
			'src' : '/download-nocache/gallery/img/buttongive270png',
			'alt' : 'Faire un Don',
			'title' : 'Faire un Don'
		})));
		
		//CUSTOM FEED	
		var custom_feed_header = new Element('h2', {
			'text' : 'Voix de partisans'
		});
		
		var custom_feed_content = new Element('div', {
			'class' : "ps-custom-feed {'customFeed':{ 'blogUrl':'/.feed/blogs/raisonsded', 'hideDate':'true', 'maxNumber':'4', 'hideAuthor' : 'true' } }"
		});
		
		var custom_feed_footer = new Element('div', {
			'class' : 'link-trailer'
		}).adopt(new Element('a', {
			'href' : '/blogs/reasonstog',
			'text' : 'Plus de Voix'
		}));
		
		var video_rochette = '<object title="Joannie Rochette (Patinage Artistique)" width="275" height="275"><param name="movie" value="http://www.fondationolympique.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="usingDownloadURL=0&file=/download/documents/videos/joannierochetter30wmv;v1&host=&frontcolor=0x888888&lightcolor=0x005082&backcolor=0xffffff&screencolor=0x000000&showdigits=total&logo"/><embed src="http://www.fondationolympique.ca/cmedia/swf/flv_video/flvplayer.swf" type="application/x-shockwave-flash" flashvars="usingDownloadURL=0&file=/download/documents/videos/joannierochetter30wmv;v1&host=&frontcolor=0x888888&lightcolor=0x005082&backcolor=0xffffff&screencolor=0x000000&showdigits=total&logo=" wmode="opaque" menu="false" width="275" height="275" allowfullscreen="true"></embed></object>';
		
		var video_exploits = '<object title="Des Plus Brillants Exploits" width="275" height="275"><param name="movie" value="http://www.fondationolympique.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="usingDownloadURL=0&file=/download/documents/videos/desplusbrillantsexploits60s_frwmv;v1&host=&frontcolor=0x888888&lightcolor=0x005082&backcolor=0xffffff&screencolor=0x000000&showdigits=total&logo="/><embed src="http://www.fondationolympique.ca/cmedia/swf/flv_video/flvplayer.swf" type="application/x-shockwave-flash" flashvars="usingDownloadURL=0&file=/download/documents/videos/desplusbrillantsexploits60s_frwmv;v1&host=&frontcolor=0x888888&lightcolor=0x005082&backcolor=0xffffff&screencolor=0x000000&showdigits=total&logo=" wmode="opaque" menu="false" width="275" height="275" allowfullscreen="true"></embed></object>';
		
		var video_otp = '<object title="&Agrave; nous le podium" width="275" height="275"><param name="movie" value="http://www.fondationolympique.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="usingDownloadURL=0&file=/download/documents/videos/francechretiendesmbfb41bfrwmv;v1&host=&frontcolor=0x888888&lightcolor=0x005082&backcolor=0xffffff&screencolor=0x000000&showdigits=total&logo="/><embed src="http://www.fondationolympique.ca/cmedia/swf/flv_video/flvplayer.swf" type="application/x-shockwave-flash" flashvars="usingDownloadURL=0&file=/download/documents/videos/francechretiendesmbfb41bfrwmv;v1&host=&frontcolor=0x888888&lightcolor=0x005082&backcolor=0xffffff&screencolor=0x000000&showdigits=total&logo=" wmode="opaque" menu="false" width="275" height="275" allowfullscreen="true"></embed></object>';
		
		switch(document.body.id){
			case "wa-campaigns":
			case "wa-defi":
				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' : 'Directives «Comment»'
						}),
						new Element('h2', {
							'class' : 'toggler'
						}).adopt(new Element('span', {
							'text' : 'Pour les blogueurs (code HTML):'	
						})),
						new Element('ol', {'class' : 'element bullets'}).adopt([
							new Element('li', {
								'text' : 'Choisissez l’image parmi les options à gauche'
							}),
							new Element('li', {
								'text' : 'Copiez tout le code dans la boîte de texte'
							}),
							new Element('li', {
								'text' : 'Collez le code à l’endroit où vous voulez que l’image apparaisse'
							})
						]),
						new Element('h2', {
							'class' : 'toggler'
						}).adopt(new Element('span', {
							'text' : 'Pour les signatures de courriel:'	
						})),
						new Element('ol', {'class' : 'element bullets'}).adopt([
							new Element('li', {
								'text' : 'Mettez l’image en surbrillance, cliquez avec le bouton droit de la souris et choisissez «copier»'
							}),
							new Element('li', {
								'html' : 'Collez l’image dans votre ordinateur (sur votre bureau ou dans un dossier d’image)'
							}),
							new Element('li', {
								'html' : 'Ouvrez les paramètres de votre fournisseur de courriel et choisissez signature (par exemple, dans MS Outlook, cela est sous Outils, Options et Format de courrier)'
							}),
							new Element('li', {
								'html' : 'Modifiez votre signature et insérez l’image dans votre signature (l’hyperlien est déjà relié)'
							}),
							new Element('li', {
								'html' : 'Sauvegardez vos paramètres'
							}),
							new Element('li', {
								'html' : 'Ouvrez un nouveau courriel et l’image et le lien seront affichés'
							})
						])
					]);
					
					//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' : 'Cliquez sur le bouton de courriel de votre choix pour voir le genre de message que vous aimeriez utiliser'
						}),
						new Element('li', {
							'html' : 'Sélectionnez tout le texte dans le courriel et cliquez sur copier. Ouvrez votre compte de courriel et collez le texte dans un nouveau message'
						}),
						new Element('li', {
							'html' : 'Personnalisez le message et envoyez-le à tous vos amis, votre famille et vos collègues de travail, en leur demandant qu’ils se joignent à vous pour appuyer aussi les espoirs olympiques canadiens'
						}),
						new Element('li', {
							'html' : 'Cliquez sur «Envoyer»'
						})
					]);
					
					//Add to sidebar (give button, and instructions)
					sidebar.adopt([give_button, new Element('h2', { 'text' : 'Directives «Comment»'}), 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' : 'Directives «Comment»'
						}),
						new Element('h2', {
							'class' : 'toggler'
						}).adopt(new Element('span', {
							'text' : 'Bannières Internet dans un code HTML:'	
						})),
						new Element('ol', {'class' : 'element bullets'}).adopt([
							new Element('li', {
								'text' : 'Choisissez parmi les options de bannières à gauche'
							}),
							new Element('li', {
								'text' : 'Copiez tout le code dans la boîte de texte'
							}),
							new Element('li', {
								'text' : 'Insérez le code dans votre page Internet où vous voulez que la bannière apparaisse'
							})
						]),
						new Element('h2', {
							'class' : 'toggler'
						}).adopt(new Element('span', {
							'text' : 'Copiez et collez les bannières et les boîtes avec des hyperliens:'	
						})),
						new Element('ol', {'class' : 'element bullets'}).adopt([
							new Element('li', {
								'text' : 'Mettez l’image en surbrillance, cliquez avec le bouton droit de la souris et choisissez «copier»'
							}),
							new Element('li', {
								'html' : 'Choisissez l’endroit où vous voulez placer l’annonce, cliquez avec le bouton droit de la souris et choisissez coller'
							})
						])
					]);
					//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' : 'Demandez votre campagne'
						}),
						new Element('p',{
							'text': 'Veuillez remplir ce formulaire afin que la Fondation puisse mettre sur pied votre campagne en milieu de travail ou de groupe.',
							'class' : 'bold'	
						}), 
						new Element('iframe', {
							'height' : '951',
							'frameborder' : '0',
							'scrolling': 'no',
							'allowtransparency' : 'true',
							'src' : 'https://igloosoftware.wufoo.com/embed/w7w5q7/',
							'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="/defi/municipalites/don"><img src="/download-nocache/gallery/img/muni_donate_png" alt="Please Donate" title="Please Donate"/></a></div><h2>Le Défi est terminé</h2><p>Même si le Défi est terminé, vous pouvez faire un don au nom de votre municipalité.  Veuillez sélectionner la région et la province appropriées ci-dessous.</p><div id="ps-municipality" class="fr"><p><label>Province/état:</label> <select id="ps-muni-homepage-province" name="province"><option>Choisissez une</option><option value="AB">Alberta</option><option value="BC">Colombie-Britannique</option><option value="PE">Île-du-Prince-Édouard</option><option value="MB">Manitoba</option><option value="NB">Nouveau-Brunswick</option><option value="NS">Nouvelle-Écosse</option><option value="NU">Nunavut</option><option value="ON">Ontario</option><option value="QC">Québec</option><option value="SK">Saskatchewan</option><option value="NL">Terre-Neuve-et-Labrador</option><option value="NT">Territoires du Nord-Ouest</option><option value="YT">Yukon</option></select></p><p><label>Municipalité:</label> <select id="ps-muni-homepage-locations" name="municipality"><option>Choisissez une</option></select></p><p><input id="submitMunicipality" disabled="disabled" name="submit" type="submit" value="Trouver"></p><div id="ps-municipality-results">&nbsp;</div></div><img src="/download/gallery/img/canadamapjpg" alt="Canada">');
				}else if($('layout-campaigns-municipal-donate')){
					sidebar.set('html', '');
				}else if($('layout-connect')){
					//Add to sidebar (give button, custom feed, and video)
					sidebar.adopt(give_button);
					sidebar.set('html', sidebar.get('html') + video_otp);					
				}else{
					//Add to sidebar (give button, custom feed, and video)
					sidebar.adopt(give_button);
					sidebar.set('html', sidebar.get('html') + video_rochette);
					sidebar.adopt([custom_feed_header, custom_feed_content, custom_feed_footer]);	
				}
				break;	
			case "wa-olympians":
			case "wa-olympiens":
				//Add to sidebar (give button, custom feed, and video)
				sidebar.adopt(give_button);
				sidebar.set('html', sidebar.get('html') + video_exploits);
				sidebar.adopt([custom_feed_header, custom_feed_content, custom_feed_footer]);	
				break;
			case "wa-spending":
			case "wa-fonds":
				//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-supporters":			
				//Add to sidebar (give button, custom feed, and video)
				sidebar.adopt(give_button);
				sidebar.set('html', sidebar.get('html') + video_rochette);
				sidebar.adopt([custom_feed_header, custom_feed_content, custom_feed_footer]);	
				break;
			case "wa-connect":
			case "wa-sociaux":			
				//Add to sidebar (give button, custom feed, and video)
				sidebar.adopt(give_button);
				sidebar.set('html', sidebar.get('html') + video_exploits);				
				break;
			case "wa-foundation":
			case "wa-quisommesnous":			
				//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;
			default:
				//Add to sidebar (give button, custom feed, and video)
				sidebar.adopt(give_button);
				sidebar.set('html', sidebar.get('html') + video_rochette);
				sidebar.adopt([custom_feed_header, custom_feed_content, video_rochette]);	
				break;
		}
	}
});