//****************************************************************************************
//  catvideo.js: javascript routines for embedding Jaguar movies.						
//  (c) 1997-2000 by Catalla Systems, Inc.												
//  All Rights Reserved.                                          						
//****************************************************************************************
var jaguarPath = "http://app.vblogcentral.com/host";
var jagPath = "%2Fstevegarfield%2FOn+the+Record+Berkman+Bloggers";
var msWidth = "320";
var msHeight = "240";

var defaultPopWidth = 510;
var defaultPopHeight = 350;
var widthAddition = 20;
var heightAddition = 80;
var minWidth = 320;
var minHeight = 120;

var isNav4 = (document.layers) ? true : false;
var hasEmbeddedMovie = false;

//
// Show the URL embedded within the document.  Width and height are dimensions
// that are used in the iframe tag.
//
function showEmbedded ( url, fallbackText, width, height )
{
	hasEmbeddedMovie = true;
	if ( isNav4 )
	{
		document.write( '<center><ilayer width="' + width + '" height="' + height + '" visibility="show" src="' 
					+ url
					+ '</ilayer></center>' );
	}
	else
	{
		document.write( '<center><iframe width="' + width + '" height="' + height + '" src="'
					+ url
					+ '" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0"'
					+ ' scrolling="no" bordercolor="#000000">'
					+ fallbackText
					+ '</iframe></center>' );
	}
}

//
// Returns an image tag to display a movie set's thumbnail. Be sure to use the
// movie set's full path name, and use encoding for any non-standard characters.
// For example, showThumbnail( "pets/My+cat" )
//
function getThumbnailTag( movieSetPath ) 
{ 
	var val = '<img src="' + jaguarPath + '/screen/make.Thumbnail?moviesetname=' + movieSetPath + '" border="0">';
	return val;
} 

//
// Returns <a> and <img> tags to put a movie set's thumbnail into an HTML 
// page, with a link to play the movie. Be sure to use the movie set's full 
// path name, and use encoding for any non-standard characters.
// For example, showMovieLink( "pets/My+cat" )
//
function getMovieLink( movieSetPath ) 
{ 
	var val = '<a href="' + jaguarPath + '/screen/make.MovieLink?moviesetname=' + movieSetPath + '">'
		   + getThumbnailTag( movieSetPath )
		   + '</a>';
	return val;
} 

//
// Return the Thumbnail screen URL for a movie path.
//
function getThumbScreenUrl ( moviepath )
{
	var val = jaguarPath + '/template/LinkedThumbnail.vm?moviesetname=' + moviepath + '';
	return val;
}

//
// Show the content of what should be in a Blog entry.
//
function showBlogContent ( moviepath, width, height )
{
	var url = getThumbScreenUrl( moviepath );
	var fallback = getMovieLink( moviepath );
	showEmbedded( url, fallback, width, height );
}

//
// The following code takes care of refreshing the page when the window is resized,
// if the user is using Navigator 4.0. This works around a Navigator bug.
//
function HandleResize()
{
	location.reload();
	return false;
}

if (isNav4)
{
	window.captureEvents(Event.RESIZE);
	window.onresize = HandleResize;
}

var iWidth = Math.max( parseInt( msWidth ) + widthAddition, minWidth );
var iHeight = Math.max( parseInt( msHeight ) + heightAddition, minHeight );

showBlogContent( jagPath, iWidth, iHeight );

