//---: Zoomify Javascript functions for swapping out the main image for Zoomify flash objects.
//---: Author: Andy Cummins
//---: Date: 06/08/2008

//***if zoomify available add links to swap the flash in.

function addZoomifyLinks(path, link)
{
	if (document.getElementById(link)) 
	{
		if(link == 'zoomifyLink'){
			var playerPath = '../../onlinecollection/zoomify/zoomifyDynamicViewer.swf';
			var objZoomLink = document.getElementById(link);
			objZoomLink.innerHTML ='<a id="zoomLink" href="#"><img src="images/layout/zoom_image.gif" alt="zoom" /></a>';
			document.getElementById('zoomLink').onclick=function(){swap4Zoomify(playerPath,path);return false;};
		}
		else if(link == 'videoLink'){
			var playerPath = '../../onlinecollection/videoPlayer/flvplayer.swf';
			var objVideoLink = document.getElementById(link);
			objVideoLink.innerHTML ='<a id="videoEducation" href="#"><img src="images/layout/video.gif" alt="video" /></a>';	
			document.getElementById('videoEducation').onclick=function(){swap4VideoAudio(playerPath,path, 'videoContent', 320, 308);return false;};
		}
		else if(link == 'audioLink'){
			var playerPath = '../../onlinecollection/audioPlayer/JMAudio.swf';
			var objAudioLink = document.getElementById(link);
			objAudioLink.innerHTML ='<a id="audioEducation" href="#"><img src="images/layout/audio_description.gif" alt="audio" /></a>';	
			document.getElementById('audioEducation').onclick=function(){swap4VideoAudio(playerPath,path, 'audioContent', 377, 66);return false;};
		}
	}
}

//***replace main image with zoomify flash object

function swap4Zoomify(playerPath, assetPath)
{
	var flashvars = {zoomifyImagePath: '../../onlinecollection'+assetPath};
	var params = {bgcolor: "#f3f3f3", allowFullScreen: "true"};
	swfobject.embedSWF(playerPath, "zoomifyContent", "450", "496", "6","",flashvars,params);
	//document.getElementById("zoomifyLink").style.display="none";
}

function swap4VideoAudio(playerPath, assetPath, container, height, width)
{
	var flashvars = {file: '../'+assetPath, titleSplash: ''};
	var params = {bgcolor: "#f3f3f3", allowFullScreen: "true"};
	swfobject.embedSWF(playerPath, container, height, width, "6","",flashvars,params);
	//document.getElementById("zoomifyLink").style.display="none";
}