// JavaScript Document

function click_thumb(filename, title)
{
	var cleanTitle = clean_html_from_title(title);
	var image_viewer = document.getElementById("image_window");
	var string = '<center><a href="../images/' + filename + '_large.jpg" rel="lightbox" name="' + title + '" title="' + cleanTitle + '"><img src="../images/' + filename + '.jpg" /></a><div id="caption"></div></center>';
	image_viewer.innerHTML = string;
	
	var caption = document.getElementById("caption");
	caption.innerHTML = title;
	initLightbox();
}

function clean_html_from_title(passedTitle)
//run a regex over the passed descriptive text to strip out any html tags
//regex works as follows: 	/	begin statement
//							<	match opening tag literally
//							.*?	match any characters that occur 1 or more times
//							>	until you match closing tag literally
//							/g	end statement and run globally (ie keep making matches until all replacements made)
//							,""	replace with nothing
{
	var string = passedTitle.replace(/<.*?>/g,"");
	return string;
}

function audio_thumb(filename,title)
{

	var image_viewer = document.getElementById("image_window");
	var string ='<center><object type="application/x-shockwave-flash" data="flash_audio/radio.swf?x=' + filename + '" width="287" height="350"><param name="movie" value="flash_audio/radio.swf?x=' +filename+ '" /></object><div id="caption"></div></center>';
	image_viewer.innerHTML = string;
	
	var caption = document.getElementById("caption");
	caption.innerHTML = title;

}

function barker_thumb(filename,title)
{

	var image_viewer = document.getElementById("image_window");
	var string ='<center><object type="application/x-shockwave-flash" data="flash_audio/barker.swf?x=' + filename + '" width="360" height="240"><param name="movie" value="flash_audio/barker.swf?x=' +filename+ '" /></object><div id="caption"></div></center>';
	image_viewer.innerHTML = string;
	
	var caption = document.getElementById("caption");
	caption.innerHTML = title;

}

function video_thumb(filename, title)
{

	var image_viewer = document.getElementById("image_window");
	var string ='<center><object type="application/x-shockwave-flash" data="video_player/video_player.swf?x=' + filename + '" width="400" height="300"><param name="movie" value="video_player/video_player.swf?x=' +filename+ '" /><param name="wmode" value="transparent" /></object><div id="caption"></div></center>';	
	image_viewer.innerHTML = string;
	
	var caption = document.getElementById("caption");
	caption.innerHTML = title;
}

function qtvr_thumb(filename, title)
{
	var image = document.getElementById("image_window");
	image.style.width= "510px";
	image.style.marginLeft="10px";
		
	var thumbs = document.getElementById("thumbnails");
	thumbs.style.width = "140px";
	thumbs.style.marginLeft="60px";
	
	var image_viewer = document.getElementById("image_window");
	var string='<center><embed src="../qtvr/' + filename + '.mov" width="500" height="370" controller="true"></embed><div id="caption"></div></center>';
	image_viewer.innerHTML = string;
	
	var caption = document.getElementById("caption");
	caption.innerHTML = title;
}

function glossary(link)
{
	window.open(link, "glossary","height=300,width=400");
}

function reset()
{
	var image = document.getElementById("image_window");
	image.style.width= "460px";
	image.style.marginLeft="0px";
	
	var thumbs = document.getElementById("thumbnails");
	thumbs.style.width = "280px";
	thumbs.style.marginLeft="0px";
	
}

function font_small()
{
	document.getElementById("text").style.fontSize = size_string = "12px";
}

function font_medium()
{
	document.getElementById("text").style.fontSize = size_string = "13px";
}

function font_large()
{
	document.getElementById("text").style.fontSize = size_string = "16px";
}