
function MediaPlayer() {

	this.InsertObj= function(URL, width, height) {
		var s = '';
		s += '<object id="MediaPlayer" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="' + width + '" height="' + height + '">';
		s += '  <param name="url"               value="' + URL + '" />';
		s += '  <param name="autoStart"         value="true" />';
		s += '  <param name="uiMode"            value="full" />';
		s += '  <param name="enableContextMenu" value="0" />';
		
		s += '  <embed id="MediaPlayerNS" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/" type="application/x-mplayer2" src="' + URL + '" width="' + width + '" height="' + height + '" ShowControls="1" ShowDisplay="0" ShowStatusBar="1" autostart="1" autorewind="0" ShowPositionControls="0" ShowTracker="1" EnableContextMenu="0"></embed>';
		s += '</object>';
		
		document.write(s);
	}
	
	this.FullScreen = function() {
		if ((!MP) || (!MP.PlayState)) {
			alert('Not supported. Try double-clicking the video');
		} else if (MP.playState != 3) {
			alert('Stream is not playing');
		} else {
			alert('Entering full-screen mode. Press <ESC> to exit.');
			MP.fullScreen = 'true';
		}
	}
	
	this.PopUp = function(video_id, category_id, ext_url) {
		var url = url_dyn + 'MediaPlayer.php?video_id=' + video_id + "&category_id=" + category_id + '&url=' + ext_url
		
		hWin = window.open(url, 'MTVNE_Mplayer', 'top=20,left=20,width=798,height=500');
		if (hWin) {
			hWin.focus();
		}
	}
}

function MediaPlayerDescriptor(title, articleUrl, description) {
	this.title = title;
	this.articleUrl = articleUrl;
	this.description = description;
	
	this.defaultTitle = title;
	this.defaultArticleUrl = articleUrl;
	this.defaultDescription = description;
	
	this.Refresh = function() {
		if (document.getElementById('MediaPlayerList_TitleText') && document.getElementById('MediaPlayerList_TitleDesc')) {
			var title = null;
			if (this.articleUrl == '') {
				title = this.title; 
			} else {
				title = '<a target="_blank" href="' + this.articleUrl + '">' + this.title + '</a>'; 
			}
			document.getElementById('MediaPlayerList_TitleText').innerHTML = title;
			document.getElementById('MediaPlayerList_TitleDesc').innerHTML = this.description;
		}	
	}
	
	this.Set = function(title, articleUrl, description) {
		this.title = title;
		this.articleUrl = articleUrl;
		this.description = description;
		this.Refresh();
	}
	
	this.Restore = function() {
		this.title = this.defaultTitle;
		this.articleUrl = this.defaultArticleUrl;
		this.description = this.defaultDescription;
		
		this.Refresh();		
	}
}