function MessageOpenWindow(theFile,useSpanish)
{
	parms = "&dt=" + theFile
		+ "&sp=" + useSpanish;
	popup_center( '', '/media/messages/message_popup.php?'+parms, 420, 420 );
}

// ---- addMovieEmbedHTML(parm_moviename,parm_width,parm_height) ----
//
// this function is called by the pop-up HTML to get around a problem in IE7
// if this code were directly in the pop-up HTML, then IE7 would force the user to press spacebar
// or click to play the movie... all to conform to some odd-ball patent
// by having this code separate it bypasses the patent problem

function Video_AddMovieEmbedHTML(parm_moviename,parm_width,parm_height)
{
document.write('<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ' +
				'WIDTH="' + parm_width + '" ' +
				'HEIGHT="' + parm_height + '" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">' +
				'<PARAM NAME="SRC" VALUE="' + parm_moviename + '">' +
				'<PARAM NAME="AUTOPLAY" VALUE="true">' +
				'<PARAM NAME="CONTROLLER" VALUE="true">' +
				'<PARAM NAME="SCALE" VALUE="tofit">' +

				'<EMBED SRC="' + parm_moviename + '" WIDTH="' + parm_width + '" HEIGHT="'+parm_height+'" ' +
				'SCALE="tofit" AUTOPLAY="true" CONTROLLER="true" ' +
				'PLUGINSPAGE="http://www.apple.com/quicktime/download/">' +
				'</EMBED></OBJECT>' );
}

var videoWindow = null;

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

function Video_OpenPopupWindow(theTitle,theFile,windWidth,windHeight,movWidth,movHeight)
{
	// 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;
	}
	theParms = 'title='+Video_FixTitle(theTitle)+'&movie='+theFile+'&width='+movWidth+'&height='+movHeight;
	videoWindow = popup_center( '', '/media/messages/video_popup.html?'+theParms, windWidth, windHeight );
}

function showSP(which)
{
	enDiv = document.getElementById("en_"+which);
	spDiv = document.getElementById("sp_"+which);
	if( spDiv.innerHTML )
	{
		enDiv.style.display = 'none';
		spDiv.style.display = 'block'; 
	}
	else
	{
		// alert(google_translate_language);
		google.language.translate(enDiv.innerHTML, "en", google_translate_language, function(result) { 
			if( !result.error)
			{
				enDiv.style.display = 'none';
				spDiv.innerHTML = result.translation;
				spDiv.style.display = 'block'; 
			}
		} );
	}
}

function showEN(which)
{
	document.getElementById("sp_"+which).style.display = 'none';
	document.getElementById("en_"+which).style.display = 'block'; 
}

function toggleSP(which)
{
	if( document.getElementById("sp_"+which).style.display == 'block' ) showEN(which);
	else showSP(which);
}
