/*
 * Functions for showing videos on map.html.
 */
 
function showVideo(clipID) {
	var flashvars={
		state:"embed",
		clipId: clipID,
		site: "cbc.ent.ca",
		RSI: "cbc-production"
	};
	var params={
		allowFullScreen:"true",allowScriptAccess:"always",menu:"true",salign:"tl",scale:"noscale",
		bgcolor:"#ffffff"
	};
	var attributes={
		id:"VideoWinSwf",
		name:"VideoWinSwf"
	};
	swfobject.embedSWF("http://www.cbc.ca/video/swf/UberPlayer.swf", "videoWinAlt", "460", "311", "9.0.0", "expressInstall.swf", flashvars, params, attributes);

	$('videoWin').show();		
}

function showGallery() {
	var flashvars = {};
	flashvars.baseURL = "gallery";
	flashvars.galleryURL = "gallery.xml?v=3";
	var params = {};
	params.bgcolor = '000000';
	params.allowscriptaccess = "always";
	var attributes = {
		id:"GalleryWinSwf",
		name:"GalleryWinSwf"
	};
	swfobject.embedSWF("simpleviewer.swf", "galleryWinAlt", "800", "400", "9.0.0", false, flashvars, params, attributes);
	
	$('galleryWin').show();			
}

function hideVideo(event) {
	event.stop();
	$('videoWin').hide();
	swfobject.removeSWF("VideoWinSwf");
	$('shucktonMapSwf').videoPlayerClosed();

	// put the placeholder element back so the video swf can load again next time
	var el = new Element('div', {'id': 'videoWinAlt'});
	$('videoWinAltContainer').insert(el);
}

function hideGallery(event) {
	event.stop();
	$('galleryWin').hide();
	swfobject.removeSWF("GalleryWinSwf");
	$('shucktonMapSwf').videoPlayerClosed();
	
	// put the placeholder element back so the video swf can load again next time
	var el = new Element('div', {'id': 'galleryWinAlt'});
	$('galleryWin').insert(el);
}

Event.observe(window, 'load', function() {
	$('videoWinClose').observe('click', hideVideo);
	$('galleryWinClose').observe('click', hideGallery);
});




