// snatched from WGBH

var video_displaying = false;
var format_displaying = 'none';

// program video play/stop functions

// define function that calls QuickTime's "Play" method
function PlayIt(anObj) {
	anObj.Play();
}

// define function that calls QuickTime's "Stop" method
function StopIt(anObj) {
	anObj.Stop();
}

function videoControlledLinks()
{
	var as,i,islink;

	// alert(video_displaying);

	// grab all links, loop over them;
	as=document.getElementsByTagName('a');
	for(i=0;i<as.length;i++)
	{
	
	// check which links are of class 'vcl' and turn them into controlled links
	if(as[i].className=='vcl')
		{
			as[i].onclick=function(){return(pop_new(this));};
			// as[i].onkeypress=function(){return(pop_new(this));};
		}
	}
	findimg();
}
		
function pop_new(o)
{
// open a new window with the location of the link's href
	if(video_displaying == true) {
		window.open(o.href,'newwin');
		frames['iframe1'].pop_stop();
	} else {
		window.load(o.href);
	}
	return false;
}

function swf_vid_window(which_window, image_width, image_height) {
	// swf popup window, but also pauses video
	newwin = window.open(which_window, "cfl_window",'toolbar=0,location=0,directories=0,scrollbars=1,status=0,menubar=0,resizable=1,width=' + image_width + ',height=' + image_height);
	window.self.name = "cfl_parent";
	if(video_displaying == true) {
		frames['iframe1'].pop_stop();
	}
	return false;
}


// if the browser can deal with DOM, call the function onload		
if(document.getElementById && document.createTextNode)
{
	window.onload=videoControlledLinks;
}

