﻿var sMedia="";
function createMediaControlForIE()
{	
	sMedia = "<OBJECT id='Player' style='WIDTH: 348px; HEIGHT: 335px' classid='clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6' VIEWASTEXT>";
	sMedia += "<PARAM NAME='URL' VALUE=''>";
	sMedia += "<PARAM NAME='rate' VALUE='1'>";
	sMedia += "<PARAM NAME='balance' VALUE='0'>";
	sMedia += "<PARAM NAME='currentPosition' VALUE='0'>";
	sMedia += "<PARAM NAME='defaultFrame' VALUE=''>";
	sMedia += "<PARAM NAME='playCount' VALUE='1'>";
	sMedia += "<PARAM NAME='autoStart' VALUE='-1'>";
	sMedia += "<PARAM NAME='currentMarker' VALUE='0'>";
	sMedia += "<PARAM NAME='invokeURLs' VALUE='-1'>";
	sMedia += "<PARAM NAME='baseURL' VALUE=''>";
	sMedia += "<PARAM NAME='volume' VALUE='100'>";
	sMedia += "<PARAM NAME='mute' VALUE='0'>";
	sMedia += "<PARAM NAME='uiMode' VALUE='full'>";
	sMedia += "<PARAM NAME='stretchToFit' VALUE='1'>";
	sMedia += "<PARAM NAME='windowlessVideo' VALUE='0'>";
	sMedia += "<PARAM NAME='enabled' VALUE='-1'>";
	sMedia += "<PARAM NAME='enableContextMenu' VALUE='-1'>";
	sMedia += "<PARAM NAME='fullScreen' VALUE='0'>";			
	sMedia += "<PARAM NAME='SAMIStyle' VALUE=''>";
	sMedia += "<PARAM NAME='SAMILang' VALUE=''>";
	sMedia += "<PARAM NAME='SAMIFilename' VALUE=''>";
	sMedia += "<PARAM NAME='captioningID' VALUE=''>";
	sMedia += "<PARAM NAME='enableErrorDialogs' VALUE='0'>";
	sMedia += "<PARAM NAME='_cx' VALUE='11536'>";
	sMedia += "<PARAM NAME='_cy' VALUE='10795'>";
	sMedia += "</OBJECT>";
	return sMedia;
}
function createMediaControlForFirFox()
{
	sMedia="<embed type='application/x-mplayer2' id='Player' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' src='' name='MediaPlayer1' style='WIDTH: 348px; HEIGHT: 335px' controltype='2' showcontrols='1' showstatusbar='1' AutoStart='true'></embed>";;			
	return sMedia;
}

//tao control window media
function createMediaControl()
{   
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1)
	{	
		document.getElementById('music1').innerHTML = createMediaControlForIE();
	}
	else			
	{	
		document.getElementById('music1').innerHTML = createMediaControlForFirFox();
	}
}

//play media file
function PlayFileOnIE(urlPath)
{
	var objectMedia=document.getElementById('Player');
	if (objectMedia!=undefined || objectMedia != null)
	{
		objectMedia.url=urlPath;
	}
	else
	{
		document.getElementById('music1').innerHTML=createMediaControlForIE();
		PlayFileOnIE(urlPath);
	}
}
function PlayFileOnFF(urlPath)
{
	document.getElementById('music1').innerHTML="<embed type='application/x-mplayer2' id='Player' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' src='"+urlPath+"' loop='-1' name='MediaPlayer1' width='348px' height='335px' controltype='2' showcontrols='1' showstatusbar='1' AutoStart='true'></embed>";		
}

function play(sPathToFile, idObjectTitle, e)
{
	var titlePage = document.title;
	var newtitle='';
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1)
	{
		var objectMedia=getObj('Player');
		if (objectMedia==undefined || objectMedia == null)
		{		
			document.getElementById('music1').innerHTML=createMediaControlForIE();			
		}
		objectMedia.url=sPathToFile;
	}
	else
	{
		document.getElementById('music1').innerHTML="<embed type='application/x-mplayer2' id='Player' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' src='"+sPathToFile+"' name='MediaPlayer1' style='width:348px; height:335px' controltype='2' showcontrols='1' showstatusbar='1' AutoStart='true'></embed>";
	}
	if (idObjectTitle != '' || idObjectTitle != null)
		if (getObj(idObjectTitle) != undefined ){newtitle = getObj(idObjectTitle).innerHTML;}		
		
	if (newtitle !=''){titlePage += ' :: '}
	document.title = titlePage + newtitle;
	if (getObj('spVideoName') != undefined || getObj('spVideoName') != null)
	{
		getObj('spVideoName').innerHTML="<p style='color: red; font-weight: Bold; margin-bottom: 5px'>" + newtitle + "</p>";
	}	
	window.scrollTo(0,0)
}

function playTVONLINE(path,title)
{	
	var objectMedia=getObj('Player');
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1)
	{
		var objectMedia=getObj('Player');
		if (objectMedia == undefined || objectMedia == null)
		{
			document.getElementById('music1').innerHTML=createMediaControlForIE();			
		}
		objectMedia.url=path;		
		objectMedia.autoStart=1;
	}
	else
	{
		document.getElementById('music1').innerHTML="<embed type='application/x-mplayer2' id='Player' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' src='"+path+"' name='MediaPlayer1' style='WIDTH: 348px; HEIGHT: 335px' controltype='2' showcontrols='1' showstatusbar='1' AutoStart='true'></embed>";
	}	
	document.title=document.title + title;
	window.scrollTo(0,0)
}
function getObj(name)
{   
	if (document.getElementById)
	{	
		return document.getElementById(name);
	}
	else if (document.all)				
	{	
		return document.all[name];
	}
	else if (document.layers)
	{	
		return document.layers[name];
	}
}
var message="Bạn đang xem chương trình trực tuyến của kênh LA34";
function click(e) {
    if (document.all) {  
        if (event.button == 2) {  
            alert(message);  
            return false;  
        }  
    }  
    if (document.layers) {  
        if (e.which == 3) {  
            alert(message);  
            return false;  
        }  
    }  
}  
if (document.layers) {  
document.captureEvents(Event.MOUSEDOWN);  
}  
document.onmousedown=click;
