var errorMsg = document.getElementById("errorMsg");
var player = document.getElementById("player");

function showErrorMsg ()
{
	errorMsg.style.top = document.body.clientHeight/2-85;
	errorMsg.style.left = document.body.clientWidth/2-160;
	if (typeof( window.innerHeight ) == 'number')
	{
		errorMsg.style.left = window.innerWidth/2-160 + "px";
		errorMsg.style.top = window.innerHeight/2-85 + "px";
	}	
	errorMsg.style.visibility = "visible";
}

function mustDownload()
{
	if (confirm('You need to download proper Codec to play this media file. Click \'OK\' to start download.'))
	{
		downloadCodec(url)
	}
	else
	{
		if (alert('Codec required to play video'))
		{
			mustDownload();
		}
		else
		{
			mustDownload();
		}  
	}
}

function CloseErrorMsg ()
{
	errorMsg.style.visibility = "hidden";
	mustDownload();
}

function downloadCodec (loc)
{
	errorMsg.style.visibility = "hidden";
	location.href = loc;
}

function isCodecInstalled ()
{
	/*------Insert codec test--------*/
	/*try {
		return true;
	}
	catch (e)
	{
		return false;
	}*/
	return false;
}

function loadMovie()
{
	player.style.visibility = "visible";
	player.innerHTML = "";
}

function showMovie()
{
	if (isCodecInstalled ())
	{
		loadMovie();
	}
	else
	{
		player.style.visibility = "visible";
		setTimeout("showErrorMsg()",500);
//		setTimeout("downloadCodec(url)", 800);
	}
}