﻿<!--
var Base64 = {
	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
	encode : function (input) {
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;

		input = Base64._utf8_encode(input);

		while (i < input.length) {

			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);

			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;

			if (isNaN(chr2)) {
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)) {
				enc4 = 64;
			}

			output = output +
			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);

		}

		return output;
	},

	decode : function (input) {
		var output = "";
		var chr1, chr2, chr3;
		var enc1, enc2, enc3, enc4;
		var i = 0;

		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

		while (i < input.length) {

			enc1 = this._keyStr.indexOf(input.charAt(i++));
			enc2 = this._keyStr.indexOf(input.charAt(i++));
			enc3 = this._keyStr.indexOf(input.charAt(i++));
			enc4 = this._keyStr.indexOf(input.charAt(i++));

			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;

			output = output + String.fromCharCode(chr1);

			if (enc3 != 64) {
				output = output + String.fromCharCode(chr2);
			}
			if (enc4 != 64) {
				output = output + String.fromCharCode(chr3);
			}

		}

		output = Base64._utf8_decode(output);

		return output;

	},

	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";

		for (var n = 0; n < string.length; n++) {

			var c = string.charCodeAt(n);

			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}

		}

		return utftext;
	},

	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;

		while ( i < utftext.length ) {

			c = utftext.charCodeAt(i);

			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}

		}

		return string;
	}

}

	
/*function player_wmp(url, wh, he){
	url = Base64.decode(Base64.decode(url));
	document.write('<object id="wmplayer" width="'+wh+'" height="'+he+'" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" standby="Загрузка компонентов проигрывателя Microsoft Windows Media..." type="application/x-oleobject"><param name="fileName" value="'+url+'" /><param name="showControls" value="1" /><param name="showDisplay" value="0" /><param name="showStatusBar" value="1" /><param name="autoSize" value="1" /><param name="fullScreen" value="False" /><param name="uiMode" value="full" /><param name="enableContextMenu" value="1" /><param name="Volume" value="100" /><embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/AllDownloads.aspx/" src="'+url+'" name="wmplayer" showControls="1" showDisplay="0" showStatusBar="1" width="'+wh+'" height="'+he+'" uiMode="full" fullScreen="False" autoSize="1" enableContextMenu="1" Volume="100"></embed></object>');
}*/
function player_wmp(url, wh, he){
	url = Base64.decode(Base64.decode(url));
	document.write('<object width="'+wh+'" height="'+he+'" bgcolor="#000000" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" type="application/x-oleobject"><param name="filename" value="'+url+'" /><param name="enablecontextmenu" value="true" /><param name="fullscreen" value="true" /><param name="showstatusbar" value="true" /><param name="showcontrols" value="1" /><param name="autostart" value="true" /><param name="showpositioncontrols" value="true" /><param name="showaudiocontrols" value="true" /><param name="showtracker" value="true" /><param name="enabletracker" value="false" /><embed name="wmplayer" src="'+url+'" width="'+wh+'" height="'+he+'" showcontrols="true" showstatusbar="true" showpositioncontrols="true" enabletracker="false" autostart="true" type="application/x-ms-wmp" enablecontextmenu="true" showaudiocontrols="true" stretchToFit="true" enablepositioncontrols="false" showtracker="true" pluginspage="http://port25.technet.com/pages/windows-media-player-firefox-plugin-download.aspx"></embed></object>');
}

function player_wmp_mini(url, wh, he){
	url = Base64.decode(Base64.decode(url));
	document.write('<object width="'+wh+'" height="'+he+'" bgcolor="#000000" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" type="application/x-oleobject"><param name="filename" value="'+url+'" /><param name="enablecontextmenu" value="true" /><param name="fullscreen" value="true" /><param name="showstatusbar" value="true" /><param name="showcontrols" value="1" /><param name="autostart" value="false" /><param name="showpositioncontrols" value="true" /><param name="showaudiocontrols" value="true" /><param name="showtracker" value="true" /><param name="enabletracker" value="false" /><embed name="wmplayer" src="'+url+'" width="'+wh+'" height="'+he+'" showcontrols="true" showstatusbar="true" showpositioncontrols="true" enabletracker="false" autostart="false" type="application/x-ms-wmp" enablecontextmenu="true" showaudiocontrols="true" stretchToFit="true" enablepositioncontrols="false" showtracker="true" pluginspage="http://port25.technet.com/pages/windows-media-player-firefox-plugin-download.aspx"></embed></object>');
}

function player_wmp_radio(url){
	url = Base64.decode(Base64.decode(url));
	document.write('<object id="wmplayer" width="200" height="45" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" standby="Загрузка компонентов проигрывателя Microsoft Windows Media..." type="application/x-oleobject"><param name="fileName" value="'+url+'" /><param name="showControls" value="0" /><param name="showDisplay" value="0" /><param name="showStatusBar" value="0" /><param name="autoSize" value="1" /><param name="fullScreen" value="False" /><param name="uiMode" value="full" /><param name="enableContextMenu" value="0" /><param name="Volume" value="100" /><embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/AllDownloads.aspx/" src="'+url+'" name="wmplayer" showControls="0" showDisplay="0" showStatusBar="0" width="200" height="45" uiMode="full" fullScreen="False" autoSize="1" enableContextMenu="0" Volume="100"></embed></object>');
}

function player_flash(url, fv, wh, he){
	url = Base64.decode(Base64.decode(url));
	fv = Base64.decode(Base64.decode(fv));
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="'+wh+'" height="'+he+'"><param name="bgcolor" value="#000" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="flashvars" value="'+fv+'" /><param name="movie" value="'+url+'" /><embed src="'+url+'" flashvars="'+fv+'" width="'+wh+'" height="'+he+'" bgcolor="#000" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://get.adobe.com/flashplayer/" /></object>');
}

function player_flash_mini(url, fv, wh, he){
	url = Base64.decode(Base64.decode(url));
	fv = Base64.decode(Base64.decode(fv));
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="'+wh+'" height="'+he+'"><param name="bgcolor" value="#000" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="flashvars" value="'+fv+'" /><param name="movie" value="'+url+'" /><embed src="'+url+'" flashvars="'+fv+'&amp;autostart=false" width="'+wh+'" height="'+he+'" bgcolor="#000" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://get.adobe.com/flashplayer/" /></object>');
}

function player_flash_radio(url, fv){
	url = Base64.decode(Base64.decode(url));
	fv = Base64.decode(Base64.decode(fv));
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="20" height="200"><param name="bgcolor" value="#ffffff" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="flashvars" value="'+fv+'" /><param name="movie" value="'+url+'" /><embed src="'+url+'" flashvars="'+fv+'" width="200" height="20" bgcolor="#ffffff" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://get.adobe.com/flashplayer/" /></object>');
}

function player_apple(url, wh, he){
	url = Base64.decode(Base64.decode(url));
	document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="'+wh+'" height="'+he+'"><param name="bgcolor" value="#ffffff" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="'+url+'" /><embed src="'+url+'" bgcolor="#ffffff" allowScriptAccess="always" allowFullScreen="true" http://www.apple.com/quicktime/download/" type="video/quicktime" /></object>');
}

function player_sl(url, fv, wh, he){
	url = Base64.decode(Base64.decode(url));
	fv = Base64.decode(Base64.decode(fv));
	document.write('<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="'+wh+'" height="'+he+'" id="slp"><param name="source" value="'+url+'" /><param name="minRuntimeVersion" value="2.0.30923.0" /><param name="onerror" value="onSilverlightError" /><param name="background" value="#dddddd" /><a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"><img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/></a><param name="initparams" value="'+fv+'" /></object>');
}

function player_rp(url, wh, he){
	url = Base64.decode(Base64.decode(url));
	document.write('<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="'+wh+'" height="'+he+'"><param name="src" value="'+url+'"><param name="autostart" value="true"><param name="controls" value="imagewindow"><param name="console" value="video"><embed src="'+url+'" width="'+wh+'" height="'+he+'" type="audio/x-pn-realaudio-plugin" autostart="true" controls="imagewindow" console="video"></object>');
}
var url_base = 'http://'+window.location.host;
function player_vlc(url, wh, he){
	url = Base64.decode(Base64.decode(url));
	document.write('<object classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" codebase="http://www.videolan.org/" width="'+wh+'"  height="'+he+'" id="vlc" events="True" style="z-index:2;"><param name="MRL" value="" /><param name="AutoLoop" value="true" /><param name="ShowDisplay" value="True" /><param name="Src" value="'+url+'" /><param name="AutoPlay" value="true" /><param name="Volume" value="25" /><param name="bgcolor" value="#000" /><embed pluginspage="http://tvtvtv.ru/faq.php#plugins" type="application/x-vlc-plugin" progid="VideoLAN.VLCPlugin.2" width="'+wh+'" height="'+he+'" name="vlc" target="'+url+'" autoplay="true" autoloop="true" volume="25" bgcolor="#000" style="z-index:2;"></embed></object><br /><div id="vlc_panel" style="position:relative; top:-3px; left:0px; width: '+wh+'px; height:20px; background:url(img/vlc_f.png)"><div style="position:absolute; top:2px; left:5px;"><a href="javascript: doPlay();" title="Воспроизведение"><img src="img/vlc_play.png" width="28" height="9" alt="Воспроизведение" /></a></div><div style="position:absolute; top:2px; left:38px;"><a href="javascript: doPause();" title="Пауза"><img src="img/vlc_pause.png" width="34" height="9" alt="Пауза" /></a></div><div style="position:absolute; top:2px; left:78px;"><a href="javascript: doStop();" title="Стоп"><img src="img/vlc_stop.png" width="30" height="9" alt="Стоп" /></a></div><div style="position:absolute; top:2px; left:113px;"><a href="javascript: asp3();" title="4:3"><img src="img/vlc_4x3.png" width="13" height="9" alt="4:3" /></a></div><div style="position:absolute; top:2px; left:131px;"><a href="javascript: asp9();" title="16:9"><img src="img/vlc_16x9.png" width="15" height="9" alt="16:9" /></a></div><div style="position:absolute; top:2px; right:5px;"><a href="javascript: updateVolume(-5);" title="Громкость -"><img src="img/vlc_volume_m.png" width="6" height="9" alt="Громкость -" /></a></div><div style="position:absolute; top:2px; right:16px;"><a href="javascript: updateVolume(5);" title="Громкость +"><img src="img/vlc_volume_p.png" width="6" height="9" alt="Громкость +" /></a></div><div style="position:absolute; top:2px; right:27px;"><a href="javascript: Mute();" title="Громкость -"><img src="img/vlc_volume.png" width="5" height="9" alt="Громкость -" /></a></div><div style="position:absolute; top:2px; right:37px;"><a href="javascript: doFS();" title="На весь экран"><img src="img/vlc_fs.png" width="64" height="9" alt="На весь экран (не работает в версиях плеера выше чем 1.0.5)" /></a></div></div>'); doGo(url);
}
		
function player_vlc_2(url, wh, he){
	url = Base64.decode(Base64.decode(url));
	document.write('<object classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" codebase="http://www.videolan.org/" width="'+wh+'"  height="'+he+'" id="vlc" events="True"><param name="MRL" value="" /><param name="AutoLoop" value="true" /><param name="ShowDisplay" value="True" /><param name="Src" value="'+url+'" /><param name="AutoPlay" value="true" /><param name="Volume" value="25" /><embed pluginspage="http://tvtvtv.ru/faq.php#plugins" type="application/x-vlc-plugin" progid="VideoLAN.VLCPlugin.2" width="'+wh+'" height="'+he+'" name="vlc" target="'+url+'" autoplay="true" autoloop="true" volume="25"></embed></object><br /><div id="vlc_panel" style="position:relative; left:0px; width: '+wh+'px; height:20px; background:url(img/vlc_f.png)"><div style="position:absolute; top:6px; left:5px;"><a href="javascript: doPlay();" title="Воспроизведение"><img src="img/vlc_play.png" width="28" height="9" alt="Воспроизведение" /></a></div><div style="position:absolute; top:6px; left:38px;"><a href="javascript: doPause();" title="Пауза"><img src="img/vlc_pause.png" width="34" height="9" alt="Пауза" /></a></div><div style="position:absolute; top:6px; left:78px;"><a href="javascript: doStop();" title="Стоп"><img src="img/vlc_stop.png" width="30" height="9" alt="Стоп" /></a></div><div style="position:absolute; top:6px; left:113px;"><a href="javascript: asp3();" title="4:3"><img src="img/vlc_4x3.png" width="13" height="9" alt="4:3" /></a></div><div style="position:absolute; top:6px; left:131px;"><a href="javascript: asp9();" title="16:9"><img src="img/vlc_16x9.png" width="15" height="9" alt="16:9" /></a></div><div style="position:absolute; top:6px; right:5px;"><a href="javascript: updateVolume(-5);" title="Громкость -"><img src="img/vlc_volume_m.png" width="6" height="9" alt="Громкость -" /></a></div><div style="position:absolute; top:6px; right:16px;"><a href="javascript: updateVolume(5);" title="Громкость +"><img src="img/vlc_volume_p.png" width="6" height="9" alt="Громкость +" /></a></div><div style="position:absolute; top:6px; right:27px;"><a href="javascript: Mute();" title="Громкость -"><img src="img/vlc_volume.png" width="5" height="9" alt="Громкость -" /></a></div><div style="position:absolute; top:6px; right:37px;"><a href="javascript: doFS();" title="На весь экран"><img src="img/vlc_fs.png" width="64" height="9" alt="На весь экран (не работает в версиях плеера выше чем 1.0.5)" /></a></div></div>'); doGo(url);
}

function player_vlc_mini(url, wh, he){
	url = Base64.decode(Base64.decode(url));
	document.write('<object classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" codebase="http://www.videolan.org/" width="'+wh+'"  height="'+he+'" id="vlc" events="True"><param name="MRL" value="" /><param name="AutoLoop" value="true" /><param name="ShowDisplay" value="True" /><param name="Src" value="'+url+'" /><param name="AutoPlay" value="false" /><param name="Volume" value="100" /><embed pluginspage="http://tvtvtv.ru/faq.php#plugins" type="application/x-vlc-plugin" progid="VideoLAN.VLCPlugin.2" width="'+wh+'" height="'+he+'" name="vlc" target="'+url+'" autoplay="false" autoloop="true" volume="100"></embed></object><br /><div id="vlc_panel" style="position:relative; width: '+wh+'px; height:20px; background:url(img/vlc_f.png); top:-3px;"><div style="position:absolute; top:2px; left:5px;"><a href="javascript: doPlay();" title="Воспроизведение"><img src="img/vlc_play.png" width="28" height="9" alt="Воспроизведение" /></a></div><div style="position:absolute; top:2px; left:38px;"><a href="javascript: doStop();" title="Стоп"><img src="img/vlc_stop.png" width="30" height="9" alt="Стоп" /></a></div><div style="position:absolute; top:2px; right:5px;"><a href="javascript: updateVolume(-5);" title="Громкость -"><img src="img/vlc_volume_m.png" width="6" height="9" alt="Громкость -" /></a></div><div style="position:absolute; top:2px; right:16px;"><a href="javascript: updateVolume(5);" title="Громкость +"><img src="img/vlc_volume_p.png" width="6" height="9" alt="Громкость +" /></a></div><div style="position:absolute; top:2px; right:27px;"><a href="javascript: Mute();" title="Громкость -"><img src="img/vlc_volume.png" width="5" height="9" alt="Громкость -" /></a></div><div style="position:absolute; top:2px; right:37px;"><a href="javascript: doFS();" title="На весь экран"><img src="img/vlc_fs.png" width="64" height="9" alt="На весь экран (не работает в версиях плеера выше чем 1.0.5)" /></a></div></div>'); doGo(url);
}

function player_uppod(url, fv, wh, he){
	fv = Base64.decode(Base64.decode(fv));
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="'+wh+'" height="'+he+'"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><param name="wmode" value="transparent"><param name="movie" value="engine/players/uppod.swf"><param name="flashvars" value="st=engine/players/video12-485.txt&'+fv+'"><embed src="engine/players/uppod.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="transparent" flashvars="st=engine/players/video12-485.txt&'+fv+'" width="'+wh+'" height="'+he+'"></object>');
}

function player_ytv(url, wh, he){
	url = Base64.decode(Base64.decode(url));
document.write('<object id="c'+url+'" name="c'+url+'" width="'+wh+'" height="'+he+'" type="application/x-shockwave-flash" data="http://yatv.ru/files/swf/container.swf?layout=1full&apps=translations&cid='+url+'&autoplay=1"><param name="allowScriptAccess" value="always"></param><param name="allowFullScreen" value="true"></param><param name="movie" value="http://yatv.ru/files/swf/container.swf?layout=1full&apps=translations&cid='+url+'&autoplay=1"/></param></object>');
}



function player_js(url){
	url = Base64.decode(Base64.decode(url));
	document.write(url);
}

function player_wcp(url, fv, wh, he){
	url = Base64.decode(Base64.decode(url));
	fv = Base64.decode(Base64.decode(fv));
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="'+wh+'" height="'+he+'"><param name="bgcolor" value="#ffffff" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="flashvars" value="'+fv+'" /><param name="movie" value="'+url+'" /><embed src="'+url+'" flashvars="'+fv+'" width="'+wh+'" height="'+he+'" bgcolor="#ffffff" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://get.adobe.com/flashplayer/" /></object>');
}



var prevState = 0;
var monitorTimerId = 0;
var isIE = 0;
//----------------------------------------------------
function startvlc(){
    isIE	= 1;
    if( navigator.appName.indexOf("Microsoft Internet")==-1 )
    {
        onVLCPluginReady()
	isIE	= 0;
    }
    else if( document.readyState == 'complete' )
    {
        onVLCPluginReady();
    }
    else
    {
        /* Explorer loads plugins asynchronously */
        document.onreadystatechange=function() {
            if( document.readyState == 'complete' )
            {
                onVLCPluginReady();
            }
        }
    }
}

//----------------------------------------------------
function getVLC(name)
{
    if (window.document[name]) 
    {
        return window.document[name];
    }
    if (navigator.appName.indexOf("Microsoft Internet")==-1)
    {
        if (document.embeds && document.embeds[name])
            return document.embeds[name]; 
    }
    else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
    {
        return document.getElementById(name);
    }
}

//----------------------------------------------------
function onVLCPluginReady()
{
    updateVolume(0);
};

//----------------------------------------------------
function updateVolume(deltaVol)
{
    var vlc = getVLC("vlc");
    vlc.audio.volume += deltaVol;
//    document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%";
};

//----------------------------------------------------
function doPlay()
{
    var vlc = getVLC("vlc");
    if( vlc.playlist.isPlaying )
    {
        vlc.playlist.Play();
    }
    else if( vlc.playlist.items.count > 0 )
    {
        vlc.playlist.play();
        monitor();
    }
    else
    {
        // disable log
        vlc.log.verbosity = -1;
        alert('nothing to play !');
    }
};
//----------------------------------------------------
function doStop()
{
    getVLC("vlc").playlist.stop();
//    if( monitorTimerId != 0 )
//    {
//        clearInterval(monitorTimerId);
//        monitorTimerId = 0;
//    }
    onStop();
};
//----------------------------------------------------
function onStop()
{
    var vlc = getVLC("vlc");
    // disable logging
    vlc.log.verbosity = -1;
};
//----------------------------------------------------
function doPause()
{
	var vlc = getVLC("vlc");
            vlc.playlist.togglePause();
            monitor();

};
//----------------------------------------------------
function asp3()
{
	document.vlc.video.aspectRatio="4:3";s.preventDefault();
};
//----------------------------------------------------
function asp9()
{
	document.vlc.video.aspectRatio="16:9";s.preventDefault();
};
//----------------------------------------------------
function doFS()
{
	getVLC("vlc").video.toggleFullscreen();
};
//----------------------------------------------------
function Mute()
{
	getVLC("vlc").audio.toggleMute();
};
//----------------------------------------------------
function doGo(targetURL)
{
    var vlc = getVLC("vlc");
    var options = new Array(":aspect-ratio=default");
    vlc.playlist.items.clear();
    //while( vlc.playlist.items.count > 0 )
    //{
        // clear() may return before the playlist has actually been cleared
        // just wait for it to finish its job
    //}
    //var itemId = vlc.playlist.add(targetURL, null, options);
  // MS Voodoo, for some obvious reason upper call won't work with IE
    var itemId;
    if( isIE )	{
	    itemId	= vlc.playlist.add(targetURL);
    } else {
    	    itemId 	= vlc.playlist.add(targetURL, null, options);
    }
    if( itemId != -1 )
    {
        // clear the message log and enable error logging
        vlc.log.verbosity = 1;
        vlc.log.messages.clear();
        // play MRL
        vlc.playlist.playItem(itemId);
        if( monitorTimerId == 0 )
        {
            monitor();
        }
    }
    else
    {
        // disable log
        vlc.log.verbosity = -1;
        alert("cannot play at the moment !");
    }
//    updateVolume(50);
};

//----------------------------------------------------

function monitor()
{
    var vlc = getVLC("vlc");
    if( vlc.log.messages.count > 0 )
    {
        // there is one or more messages in the log
        var iter = vlc.log.messages.iterator();
        while( iter.hasNext )
        {
            var msg = iter.next();
            var msgtype = msg.type.toString();
            if( (msg.severity == 1) && (msgtype == "input") )
            {
                alert( msg.message );
            }
        }
        // clear the log once finished to avoid clogging
        vlc.log.messages.clear();
    }
    var newState = vlc.input.state;
    if( prevState != newState )
    {
        if( newState == 0 )
        {
            // current media has stopped 
            onStop();
        }
        else if( newState == 1 )
        {
            // current media is openning/connecting
            // onOpen();
        }
        else if( newState == 2 )
        {
            // current media is buffering data
            //onBuffer();
        }
        else if( newState == 3 )
        {
            // current media is now playing
            //onPlay();
        }
        else if( vlc.input.state == 4 )
        {
            // current media is now paused
            //onPause();
        }
        prevState = newState;
    }
    else if( newState == 3 )
    {
        // current media is playing
        //onPlaying();
    }
    if( ! monitorTimerId )
    {
        monitorTimerId = setInterval("monitor()", 1000);
    }
};

//-->
