// JavaScript Document

//function click_thumb(filename, title)
//{
//
//	var image_viewer = document.getElementById("image_window");
//	var string = '<center><a href="../images/' + filename + '_large.jpg" rel="lightbox" title="' + title + '"><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 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 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_move()
{
		var image = document.getElementById("image_window");
		image.style.width= "510px";
		image.style.marginLeft="10px";
}


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><object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="500" height="370"><param name="src" value="../qtvr/' + filename +'.mov" /><param name="controller" value="true" /><object type="video/quicktime" data="../qtvr/' + filename +'.mov" width="500" height="370" class="mov"><param name="controller" value="true" /></object></object><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 = "15px";
}
