var staggerSides = 1;
var superSize2 = false;

var videoWindow = null;

function fixTitle(theTitle)
{
	if( theTitle.charAt(0)=='-' ) return theTitle.slice(1);
	else return '"' + theTitle + '"';
}

function openVideoWindow(theTitle,theFile,windWidth,windHeight,movWidth,movHeight)
{
	theParms = 'title='+fixTitle(theTitle)+'&movie='+theFile+'&width='+movWidth+'&height='+movHeight;

	w = screen.availWidth, h = screen.availHeight;
	if( w<800 ) W = 800;
	if( h<600 ) h = 600;

	windLeft = (w-windWidth)/2, windTop = (h-windHeight)/2;
	windTop = windTop - (windTop/4);

	// if the window already exists, the open will fail to resize so close it first
	if( videoWindow && videoWindow.open )
	{
		if( !videoWindow.closed ) videoWindow.close();
		delete videoWindow;
		videoWindow = null;
	}

	windName = 'wndMovie';
	videoWindow = window.open('videos_popup.html?'+theParms, windName,
		  'width=' + windWidth
		+ ',height=' + windHeight
		+ ',top=' + windTop
		+ ',left=' + windLeft
		+ ',status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no');

	return
}

function addVideoSection_GraphicSide(theFile,theTitle)
{
	comm = "<SPAN CLASS=\"video_link\"><A CLASS=\"video\" HREF=\"javascript:openVideoWindow('" + theTitle + "','" + theFile;
	str = ''
		+ '<TD ALIGN="CENTER"><SPAN CLASS="video_icon"><IMG SRC="videos/video.gif" BORDER="0" ALT=""></SPAN>'
		+ comm + '_56k\',208,180,160,120)">56k&nbsp;modem</A></SPAN>'
		+ comm + '_DSL\',370,300,320,240)">Cable/DSL</A></SPAN>';

	if( superSize2 ) str += comm + '_HIGH2\',790,616,720,540)">SuperSize</A>';
	else str += comm + '_HIGH\',710,556,640,480)">SuperSize</A>';

	str += '</TD>'
		+ '<TD ALIGN="CENTER"><IMG SRC="'+theFile+'.jpg" WIDTH="250" HEIGHT="191" ALT=""></TD>';

	document.write(str);
}

function addVideoSection_TextSide(theTitle,theDescription,theTime,theSide)
{
	str = '<TD ALIGN="' + theSide + '" CLASS="description_width">'
		+ '<SPAN CLASS="video_name">' + fixTitle(theTitle) + '</SPAN>'
		+ '<SPAN CLASS="video_description">' + theDescription + '</SPAN>'
		+ '<SPAN CLASS="video_time">(' + theTime + ' min)</SPAN></TD>';
	document.write(str);
}

function addVideoSection(theTitle,theDescription,theTime,theFile)
{
	document.write('<TABLE ALIGN="CENTER" BORDER="0" CELLSPACING="0" CELLPADDING="7"><TR VALIGN="MIDDLE">');

	addVideoSection_GraphicSide(theFile,theTitle);
	addVideoSection_TextSide(theTitle,theDescription,theTime,'LEFT');

	document.write('</TR></TABLE>');
}
