﻿function displayDHTMLWindow(windowName)
{
    Effect.BlindDown(windowName);
}

function displaySermonMediaPlayer(sermonID, playerBaseUrl)
{
	var width = 650;
	var height = 515;
	var left = ((screen.width - width) / 2);
	var top = ((screen.height - height) / 2);

	if(!playerBaseUrl)
		playerBaseUrl = "";

    window.open(
		playerBaseUrl + "MediaPlayer.aspx?ID=" + sermonID,
		"SermonMediaPlayer",
		"height="+height+"px,width="+width+"px,top="+top+",left="+left+",directories=0,location=0,resizable=0,status=1,toolbar=0,menubar=0"
	);
}
function fixSermonMediaPlayerWindowSize()
{
	window.resizeTo(670,560);
}

function displaySermonMediaDownload(sermonID, playerBaseUrl)
{
	var width = 650;
	var height = 460;
	var left = ((screen.width - width) / 2);
	var top = ((screen.height - height) / 2);

	if(!playerBaseUrl)
		playerBaseUrl = "";

    window.open(
		playerBaseUrl + "MediaDownload.aspx?ID=" + sermonID,
		"SermonMediaDownload",
		"height="+height+",width="+width+",top="+top+",left="+left+",directories=0,location=0,resizable=1,status=1,toolbar=0,menubar=0"
	);
}
function fixSermonMediaDownloadWindowSize()
{
	window.resizeTo(670,505);
}

function playSermonMedia(mediaPlayerName, url)
{
	var mediaPlayer = GetMediaPlayer(mediaPlayerName);
	
	mediaPlayer.set_mediaUrl(url);
	mediaPlayer.play();
}

function GetMediaPlayer( mediaPlayerName )
{
    return $find(mediaPlayerName);
}

function TrackUsage()
{
	alert( "TrackUsage()" );
}

function mediaPlayer_MediaFailed(sender, eventArgs)
{
	alert( "There was a problem loading the selected media." );
}


