function PlayerConcurso(playerName, playerObjName)
{
	// ************************************************************************************************
	// *** Inicialization
	// ************************************************************************************************

	// Fields
	// ******
	this.playerName = playerName;		
	
	if (GetPlayerType() == 1)// initialize wmv Player type defined in PlayerType.js	
	{	
		this.player = new PlayerWm(this.playerName + '.player', document.getElementById(playerObjName));				
	}	
	
	// ************************************************************************************************
	// *** Interface
	// ************************************************************************************************	
	 
	// Methods
	// *******
	this.playUrl = player_PlayUrl;
	this.setUrl = player_SetUrl;
	this.playPause = player_PlayPause;
	this.mute = player_Mute;
	this.ff = player_FF;
	this.rew = player_Rew;

	this.setVolume = player_SetVolume;
	this.setDragVolume = player_SetDragVolume;
	this.increaseVolume = player_IncreaseVolume;
	this.decreaseVolume = player_DecreaseVolume;
	this.maxVolume = player_MaxVolume;

	this.setDragPosition = player_SetDragPosition;
	this.setDragPositionStart = player_SetDragPositionStart;

	// Draw methods
	this.updateTimeInfo = player_UpdateTimeInfo;
	this.updatePlayState = player_UpdatePlayState;
	this.updateMute = player_UpdateMute;
	
	this.fullScreen = player_FullScreen;
	
	// Bind event handlers
	// *******************	
	this.player.onCurrentPositionChange.add(this.playerName, 'updateTimeInfo');
	this.player.onPlayStateChange.add(this.playerName, 'updatePlayState');
	this.player.onMuteChange.add(this.playerName, 'updateMute');
	
	// Initial states for button
	this.updatePlayState();
	this.updateMute();
	
	// Initial volume
	this.setVolume(50);
	
	// Drag and drop control
	this.volumeDrag = null;
	this.positionDrag = null;
	this.dragging = false;
	
	// ************************************************************************************************
	// *** Implementation
	// ************************************************************************************************

	function player_PlayUrl(url)
	{
		this.player.playUrl(url);
	}
	
	function player_SetUrl(url)
	{
		this.player.setUrl(url);
	}

	// Plays the current media item
	function player_PlayPause() 
	{
		var playState = this.player.getPlayState();
		if(playState==this.player.playState.stopped ||  playState==this.player.playState.paused)
		{
			this.player.play();
		}
		else
		{
			this.player.pause();
		}
		
		// Forces an image update
		this.updatePlayState();
	}

	// Mute
	function player_Mute()
	{
		// Reverses mute state
		this.player.setMute(!this.player.getMute());
		
		// Forces an image update
		this.updateMute();
	}
	
	// FF
	function player_FF()
	{
		var playState = this.player.getPlayState();
		if(playState==this.player.playState.forwarding)
		{
			// Resumes regular playback
			this.player.play();
		}
		else
		{
			// Forwards track
			this.player.fastForward();
		}
		
		// Forces an image update
		this.updatePlayState();		
	}
	
	// Rew
	function player_Rew()
	{
		var playState = this.player.getPlayState();
		if(playState==this.player.playState.rewinding)
		{
			// Resumes regular playback
			this.player.play();
		}
		else
		{
			// Rewinds track
			this.player.rewind();
		}
		
		// Forces an image update
		this.updatePlayState();		
	}

	// Sets the volume to the specified level
	function player_SetVolume(volume)
	{
		this.player.setVolume(volume);
		
		// Updates the volume bar
		var obj = document.getElementById('divScrollVolume');
		if(obj)
		{
			var newStyle = 1 + Math.ceil(volume * 0.30 - 4) + 'px';
			obj.style.width=newStyle;
		}
	}
	
	// Sets the volume to the specified level
	function player_SetDragVolume()
	{
		// Updates the volume bar
		var newVolume = this.volumeDrag.getValue() * 100;
		this.player.setVolume(newVolume);
	}
	
	// Increases player volume by 10
	function player_IncreaseVolume()
	{
		var volume = this.player.getVolume();
		volume += 10;
		
		if(volume > 100)
			volume = 100;
				
		this.setVolume(volume);
	}
	
	// Decreases player volume by 10
	function player_DecreaseVolume()
	{
		var volume = this.player.getVolume();
		volume -= 10;
		
		if(volume < 0)
			volume = 0;
				
		this.setVolume(volume);
	}
	
	// Sets to the drag position
	function player_SetDragPosition()
	{
		// Gets the media duration
		var duration = this.player.getCurrentMediaDuration();

		// Updates to the desired position
		var newPosition = this.positionDrag.getValue() * duration;

		this.player.setPosition(newPosition);
		
		// Reenables the auto-updates
		this.dragging = false;

		// Forces a redraw
		this.updateTimeInfo();
	}
	
	// Warns the player that the user has started dragging the position marker
	function player_SetDragPositionStart()
	{
		this.dragging = true;
	}
	
	// Sets to the maximum volume
	function player_MaxVolume()
	{
		this.setVolume(100);
	}
		
	// Updates time info
	function player_UpdateTimeInfo() 
	{
		var duration = this.player.getCurrentMediaDuration();
		var currentPosition = this.player.getPosition();

		// Updates duration
		var obj = document.getElementById('divPosition');
		if(obj)
		{
			var duration = this.player.getCurrentMediaDuration();
			var currentPosition = this.player.getPosition();

			obj.innerHTML = FormatTime(currentPosition) + ' / ' + FormatTime(duration);	
		}
		
		// Updates scrollbar
		if(!this.dragging)
		{
			var obj = document.getElementById('divScroll');
			if(obj)
			{
				var duration = this.player.getCurrentMediaDuration();
				var currentPosition = this.player.getPosition();
				
				if(currentPosition>0)
				{
					var percent = currentPosition/duration;
					var newStyle = Math.ceil(percent * 193) + 'px'; 
					
					if(obj.style.width!=newStyle) obj.style.width=newStyle;

				}
				else
				{
					if(obj.style.width!=newStyle) obj.style.width='1%';
				}
			}
		}
	}
	
	// Updates playstate
	function player_UpdatePlayState() 
	{
		var playState = this.player.getPlayState();
		
		// Play/Pause Image
		var obj = document.getElementById('playImage');
		if(playState==this.player.playState.stopped ||  playState==this.player.playState.paused)
		{
			obj.src = '../img/player_play_button.gif';
		}
		else
		{
			obj.src = '../img/player_pause_button.gif';
		}
		
		// Rew
		obj = document.getElementById('rewImage');
		if(obj!=null)
		{
			if(playState==this.player.playState.rewinding)
			{
				obj.src = '../image/videoBox_controls_reward_buttonOn.gif';
				obj.onmouseover = null;
				obj.onmouseout = null;
			}
			else
			{
				obj.src = '../image/videoBox_controls_reward_button.gif';
				obj.onmouseover = new Function('this.src=\'../image/videoBox_controls_reward_buttonOn.gif\';');
				obj.onmouseout = new Function( 'this.src=\'../image/videoBox_controls_reward_button.gif\';');
			}
		}
		
		// FF
		obj = document.getElementById('ffImage');
		if(obj!=null)
		{
			if(playState==this.player.playState.forwarding)
			{
				obj.src = '../image/videoBox_controls_forward_buttonOn.gif';
				obj.onmouseover = null;
				obj.onmouseout = null;
			}
			else
			{
				obj.src = '../image/videoBox_controls_forward_button.gif';
				obj.onmouseover = new Function('this.src=\'../image/videoBox_controls_forward_buttonOn.gif\';');
				obj.onmouseout = new Function( 'this.src=\'../image/videoBox_controls_forward_button.gif\';');
			}
		}
	}
	
	function player_FullScreen()
	{
		this.player.fullScreen();
	}
	
	// Updates mute
	function player_UpdateMute() 
	{
		var muteState = this.player.getMute();
		var obj = document.getElementById('muteImage');
		if(obj)
		{
			if(muteState)
			{
				obj.src = '../image/videoBox_volume_mute_buttonOn.gif';
				obj.onmouseover = null;
				obj.onmouseout = null;
			}
			else
			{
				obj.src = '../image/videoBox_volume_mute_button.gif';
				obj.onmouseover = new Function('this.src=\'../image/videoBox_volume_mute_buttonOn.gif\';');
				obj.onmouseout = new Function( 'this.src=\'../image/videoBox_volume_mute_button.gif\';');
			}
		}
	}
}

function FormatTime(seconds) 
{
	var hrs, min, sec;
		
	// Hours
	hrs = parseInt(seconds / 3600);
		
	// Minutes
	seconds = seconds % 3600;
	min = parseInt(seconds / 60);
	if(min < 10) 
		min = '0' + min;
		
	// Seconds
	sec = parseInt(seconds % 60);
	if(sec < 10) 
		sec = '0' + sec;
		
	// Formatted string
	return ((hrs > 0) ? (hrs + ':') : '') + min + ':' + sec;
}

var playerConcurso = null;
var url = null;
var urlflash = null;
var urlwmv = null;
var embedPlayer = true;
var isHomePlayer = false;
var objFla;
var objRel;
var videoTitle = '';

function DrawPlayer()
{	
	if( urlflash == null || urlflash == '' )
		enableFlash = false;
				
	url = urlwmv; // manter a logica anterior
	
	switch (GetPlayerType())
	{
		case 0:
			DrawPlayerEmbed(url);
			break;
		case 1:
			RenderWindowsMediaPlayer();
			break;
		case 2:
			RenderQuickTime();
			break;
		case 4 :
			DrawPlayerFlash();
			break;
	}
}

function RenderWindowsMediaPlayer()
{
	document.write('<OBJECT id="player" name="player"');
	document.write('CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"\n');
	document.write('width="396" height="297" type="application/x-oleobject"\n');
	document.write('trr.id="wmp" >\n');
	document.write('<param name="uimode" value="none">\n');
	document.write('<param name="stretchtofit" value="true">\n');
	document.write('<param name=\"AutoStart\" value=\"0\">\n');
	document.write('</OBJECT>\n');
	embedPlayer = false;	
	playerType = 1;
}

function RenderSilverlightPlayer()
{
	RenderSilverlight(396, 297, "host");
	if(slBannerMode)
	{
		SetSilverlightMode(); // hide html controls
	}
	playerType = 3;
	embedPlayer = false;
}

function DrawPlayerEmbed(url)
{
    document.write('<embed type="application/x-mplayer2"\n');
    document.write('pluginspage="http://www.microsoft.com/windows/windowsmedia/download/AllDownloads.aspx/"\n');
    document.write('filename="' + url + '"\n');
	document.write('src="' + url + '"\n');
	document.write('Name="player"\n');
	document.write('ShowControls="1"\n');
	document.write('ShowDisplay="-0"\n');
	document.write('ShowStatusBar="0"\n');
	document.write('width="400"\n');
	document.write('height="345">\n');
	document.write('</embed>\n');
	embedPlayer = true;	
}

function RessurectWmvPlayer()
{
	document.getElementById( 'actions' ).style.display = "inline"; void( 0 );
	document.getElementById( 'player' ).style.visibility = "visible";
}
var WmvDestroyed = false;
function DestroyWmvPlayer()
{
	if( !WmvDestroyed )
	{
		document.getElementById( 'player' ).style.visibility = "hidden";
		document.getElementById( 'actions' ).style.display = "none"; void( 0 );
		
		var objRel = document.getElementById('PlayerRelatedFlash');
		objRel.style.visibility = "visible";
		setTimeout(CallRelatedFlash,10);
		WmvDestroyed = true;
	}
	
}

function DrawRelatedFlash()
{	
	document.write('<object id="PlayerRelatedFlash" type="application/x-shockwave-flash" data="../swf/related.swf" width="404" height="330">');	
	document.write('<param name="movie" value="../swf/related.swf" />');	
	document.write('<param name="allowScriptAccess" value="always" />');	
	document.write('<param name="quality" value="high" />');	
	document.write('<param name="wmode" value="transparent" />');	
	document.write('</object>');	
	//if( isHomePlayer )
	
	objRel = document.getElementById( "PlayerRelatedFlash" );
	
}

function DrawHomePlayerFlash()
{
		if( window.location.href.indexOf( "?vid=" ) == -1 ) // primeiro video, mostra embed
		{
			document.write('<object type="application/x-shockwave-flash" id="HomeFlashPlayer" data="../swf/player.swf?videoMode=embed&url=' + urlflash + '" width="404" height="330">');
			document.write('<param name="movie" value="../swf/player.swf?videoMode=embed&url=' + urlflash + '" />');
			document.write('<param name="allowFullScreen" value="true" />');
			document.write('</object>');
		}
		else
		{
			document.write('<object type="application/x-shockwave-flash" id="HomeFlashPlayer" data="../swf/player.swf?url=' + urlflash + '" width="404" height="330">');
			document.write('<param name="movie" value="../swf/player.swf?url=' + urlflash + '" />');
			document.write('<param name="allowFullScreen" value="true" />');
			document.write('</object>');
		}

		objFla = document.getElementById('HomeFlashPlayer');
		embedPlayer = false;
		playerType = 4;
}

function DrawPlayerFlash()
{
	if( isHomePlayer )
	{
		DrawHomePlayerFlash();
		return;
	}

	document.write('<object type="application/x-shockwave-flash" id="FlashPlayer" data="../swf/player.swf?url=' + urlflash + '" width="404" height="330">');
	document.write('<param name="movie" value="../swf/player.swf?url=' + urlflash + '" />');
	document.write('<param name="allowFullScreen" value="true" />');
	document.write('</object>');	
	objFla = document.getElementById('FlashPlayer');
	
	embedPlayer = false;
	playerType = 4;
}

function fnHideDiv()
{		 
 if (GetPlayerType() == 4)//flash plugin player ok  type 4 defined in playerType.js
    {    
	document.getElementById( "actions" ).style.display = "none"; void( 0 );
    }
}

function InitDrag()
{
	var direction = new DragDirection();

	// Position drag	
	playerConcurso.positionDrag = new DragItem(document.getElementById('divScrollPointer'), document.getElementById('divScroll'), 0, 193, direction.horizontal);
	playerConcurso.positionDrag.onDragFinish.add('playerConcurso', 'setDragPosition');
	playerConcurso.positionDrag.onDrag.add('playerConcurso', 'setDragPositionStart');
	ddItems.push(playerConcurso.positionDrag);
	
	// Volume drag	
	playerConcurso.volumeDrag = new DragItem(document.getElementById('divScrollPointerVolume'), document.getElementById('divScrollVolume'), 0, 26, direction.horizontal);
	playerConcurso.volumeDrag.onDrag.add('playerConcurso', 'setDragVolume');
	//playerConcurso.volumeDrag.onDrag.add('playerConcurso', 'setDragPositionStart');
	ddItems.push(playerConcurso.volumeDrag);
}

function SendVideo(userVideoId)
{
	alert('Send userVideoId ' + userVideoId);
}

function ReportVideo(userVideoId)
{
	alert('Report userVideoId ' + userVideoId);
}

//function VoteVideo()
//{
//	var id = document.getElementById('voteUserVideoId').value;
//	var positive = document.getElementById('votePositive').value;
//	var hash = document.getElementById('voteHash').value;
//	var captcha = document.getElementById('voteCaptcha').value;

//	var voteurl='ajax/votingAjax.aspx?id=' + id + '&positive=' + positive + '&hash=' + hash + '&captcha=' + captcha;
//	genericManager.manager.Add(voteurl,VoteParser);
//}

//function VoteParser()
//{
//	if (this.httpRequest.readyState == 4) // readyState = 4 -> Complete
  //  {
	//	if(this.httpRequest.status == 200)  // status = 200 -> OK
	//	{
	//		var obj = document.getElementById('divVote');
	//		if(obj)
	//		{
	//			obj.innerHTML = this.httpRequest.responseText;
	//		}
	//	}
//	}
//}

function CommentVideo(userVideoId, userName, Hash) //O hash pode ser usado para o captcha. Mas no momento nao esta funcional
{
	var captcha = document.getElementById('capHash').value;
	var userCaptcha = document.getElementById('capText').value;
	var text = document.getElementById('commentText').value;
	var pageData = document.getElementById('pageData').value;
	
	if(userCaptcha=='' || userCaptcha==null)
	{
		alert('Por favor preencha o código da imagem');
		return;
	}
	else if(text=='' || text==null)
	{
		alert('Por favor preencha o campo de comentário');
		return;
	}
	else 
	{
		document.getElementById('capText').value = '';
		document.getElementById('commentText').value = '';
	}
	
	text = filterSpecial(text);
	
	PostComment(userVideoId, escape(captcha), escape(userCaptcha), userName, escape(text), pageData);
}


 function filterSpecial(string)
  {
      totalString = string.length;
	  while (totalString >0)
	  {
       string =   string.replace(/</,'&lt');		  
	   totalString--;
	  }
      totalString = string.length;
	  while (totalString >0)
	  {
       string =  string.replace(/>/,'&gt');		  
	   totalString--;
	  }    
      return string;
  }
	

function UpdateCommentCaptcha(videoId, userName) //O hash pode ser usado para o captcha. Mas no momento nao esta funcional
{
	document.getElementById('capText').value = '';
	var userComment = document.getElementById('commentText').value;
	//document.getElementById('commentText').value = '';
	var pageData = document.getElementById('pageData').value;
	PostComment(videoId,'', '', userName, userComment, pageData);
}

function CommentParser()
{
	if (this.httpRequest.readyState == 4) // readyState = 4 -> Complete
    {
		if(this.httpRequest.status == 200)  // status = 200 -> OK
		{
			alert("Obrigado! Seu comentário estará disponível em alguns minutos.");
			//document.getElementById('commentAuthor').value = '';
			document.getElementById('commentText').value = '';
		}
	}
}

function voteVideo(idVideo, voteValue) //O hash pode ser usado para o captcha. Mas no momento nao esta funcional
{
//	var captcha = document.getElementById('capHashDetail').value;
//	var captcha = document.getElementById('capTextDetail').value;
//	var vote = document.getElementById('Vote').value;
	var pageDat = document.getElementById('pageDat').value;
	
//	if(text=='' || text==null)
//	{
//		alert('Por favor preencha o campo da imagem');
//		return;
//	}
//	document.getElementById('capTextDetail').value = '';
//	document.getElementById('Vote').value = '';
	PostVote(idVideo, voteValue, pageDat);
}

//function UpdateVoteCaptcha(videoId, voteValue) //O hash pode ser usado para o captcha. Mas no momento nao esta funcional
//{
//	document.getElementById('capTextDetail').value = '';
//	var vote = document.getElementById('Vote').value
//	PostVote(videoId, voteValue);
//}

function VoteVideoParser()
{
	if (this.httpRequest.readyState == 4) // readyState = 4 -> Complete
    {
		if(this.httpRequest.status == 200)  // status = 200 -> OK
		{
			alert("Obrigado! Seu voto estará disponível em alguns minutos.");
			//document.getElementById('capHashDetail').value = '';
//			document.getElementById('capTextDetail').value = '';
//			document.getElementById('Vote').value = '';
		}
	}
}

function validateFields() 
{
	var descr = document.getElementById('textDescription').value;
	var title = document.getElementById('textTitle').value;
	alert(descr);
	alert(title);
	if(title=='' || title==null)
	{
		alert('Por favor informes el título del video');
		return;
	}
	else if(descr=='' || descr==null)
	{
		alert('Por favor informes la descripción del video');
		return;
	}
	else 
	{
		form.submit;
	}
}

//* New Player Functions */
// Flash Video is playing (flash call)
function PlayingFlashVideo(){
//	alert('Video is ready');
}

// Flash Video is complete (flash call)
function FlashVideoComplete(){
	//alert('Video is over - Turning Related visible');
	objRel.style.visibility = "visible";
	objFla.style.visibility = "hidden";
	setTimeout(CallRelatedFlash,10);
}

// RELATED //
		
// Call Related (js call)
function CallRelatedFlash(){
	//var obj = document.getElementById('PlayerRelatedFlash');
	var isMozilla = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined') ;	
	//objRel.callRelatedFlash();
	
	if (isMozilla)
	{
	objRel.callRelatedFlashFireFox();
	}
	else
	{
	objRel.callRelatedFlashIe();
	}
}

// Call Flash Related Texts Translation (flash call)
function InitializeTranslationRelatedFlash(){
	//alert('Flash is Ready to Translate Related Texts');
	TranslateRelated('Ver de novo', 'Próximo', 'Vídeos Relacionados', 'Reproduzindo em');
	ActualVideoName( videoTitle );
}

// ActualVideoName (js call)
function ActualVideoName(videoName){
//	alert('Sending Actual Video Name: '+ videoName);
	//var obj = document.getElementById('PlayerRelatedFlash');
	objRel.actualVideoName(videoName);
}
		
// Translate Flash Texts (js call)
function TranslateRelated(playAgainTit, titNextVideo, titRelatedList, playingIn){
	//alert('Flash Translate: '+ playAgainTit +' | '+ titNextVideo +' | '+ titRelatedList +' | '+ playingIn +'');
	//var obj = document.getElementById('PlayerRelatedFlash');
	objRel.translateRelatedData(playAgainTit, unescape(titNextVideo), titRelatedList, playingIn);
}

// Flash is loaded and ready (flash call)
function InitializeRelatedFlash(){
//	alert('Flash Related is ready');
	FlashVideoSetRelated();
}

// Send Parameters to Related (js call)
function SetFlashRelatedData(flashRelTitle, flashRelThumb, flashRelLink, id){
	//alert('Title: ' + flashRelTitle + '<br />Thumb: ' + flashRelThumb + '<br />Link: ' + flashRelLink + '<br />Channel: ' + flashRelChannel + '<br />Id: ' + id);

	try{
		//var obj = document.getElementById('PlayerRelatedFlash');		
		objRel.setRelatedData(flashRelTitle, flashRelThumb, flashRelLink, id);
	}
	catch(e){
		alert('Exception calling method on flash: ' + e);
	}
}

function PlayAgainFlash(){
	objRel.style.visibility = "hidden";
	objFla.style.visibility = "visible";
	//getMovieName("playerFlash").playAgain();
	objFla.playAgain();
}

function PlayRelatedVideo(link, redirect){
	videoId = link.substr( link.lastIndexOf( "?vid=" )+5 );	
	//alert( videoId );

	//SetFlashUrl( playerUrl + 'videoMode=embed&url=' + link  );
	//SetFlashData(link);
	if( isHomePlayer )
	{
		if(redirect)
		{
			var temp = window.location.href;
			var homePlayerUrl = temp.substring( 0, link.indexOf( "?vid=" )+4 );
			homePlayerUrl += '?vid=' + videoId;
			//alert( 'homeplayerurl= ' + homePlayerUrl );
			window.location =  homePlayerUrl;
		}else{
			//alert( link );
			window.top.location = link;
		}	
	}
	else
	{
		window.location = link;
	}
}

function fnGetCurrent()
{
		this.InternalMedia = function (pId, pTitle, pThumb, pDuration, pIsadult)
		{
			var originalid = pId;
			var title    = pTitle;
			var image    = pThumb;
			var duration = pDuration;
			var isAdult  = pIsadult; 
		}
}

function GetMediaInfo(propertyName)
{
      //var item = playerTerra.getCurrentInternalMedia();      
      var item = fnGetCurrent.InternalMedia();
      
      // Checks if this is an ad
      var isAd = false;
      if(lcEnabled)
      {
            var mediaItem = playerTerra.player.playerObject.currentMedia;
            if(mediaItem)
            {
                  // LCAUDIT parameter can be used to identify preroll videos in LC
                  var auditUrl = mediaItem.getItemInfo("LCAUDIT");
                  if(auditUrl) isAd = (auditUrl!='');
            }
      }
      else
      {
            isAd = playerTerra.playingAd;
      }
      
      // Gets the property value
      var propertyValue = null;
      if(item)
      {
            switch(propertyName.toLowerCase())
            {
                  case 'contentid':
                        if(isAd && lcEnabled)
                        {
                             propertyValue = -1;
                        }
                        else
                        {
                             propertyValue = item.originalid;
                        }
                        break;
                  case 'contenttitle':
                        propertyValue = item.title;
                        break;
                  case 'contentname':
                        propertyValue = item.title;
                        break;
                  case 'contentthumb':
                        propertyValue = item.image;
                        break;                       
                //  case 'sourcetitle':
               //         if(isAd)
               //         {
                             // Uses item source instead of ad source
              //               var currentItem = playerTerra.getCurrentMedia();
               //              propertyValue = currentItem.sourceTitle;
              //          }
              //          else
              //          {
              //               propertyValue = item.sourceTitle;
              //          }
                //        break;
                //  case 'contentprovider':
               //         propertyValue = item.provider;
                //        break;
                  case 'contentduration':
                        propertyValue = item.duration;
                        break;
                //  case 'islive':
                //       propertyValue = item.isLive;
               //         break;
                  case 'isadult':
                        propertyValue = item.isAdult;
                        break;
               //   case 'isclosed':
               //         propertyValue = item.isPrivate;
               //         break;
                 // case 'iswide':
                 //       propertyValue = item.isWide;
                //        break;
                  case 'isrelated':
                        propertyValue = item.isrelated;
                        break;
                  //case 'ispreroll':
                  //      propertyValue = isAd;
                  //      break;
            }
      }

      // Error handling
      if(propertyValue==null)
      {
            // Error reading data, send defaults according to spec
            switch(propertyName.toLowerCase())
            {
                  // Int properties
                  case 'contentid':
                  case 'contentduration':
                        return(0);
                  // String properties
                  case 'contenttitle':
                  case 'contentname':
                  case 'contentthumb':
                  case 'sourcetitle':
                  case 'contentprovider':
                        return('');
                  // Bool Properties
                  case 'islive':
                  case 'isadult':
                  case 'isclosed':
                  case 'iswide':
                  case 'isrelated':
                  case 'ispreroll':
                        return(false);
            }
      }
      else
      {
            // Property retrieved, just returns the data
            return(propertyValue)
      }
}

/*
function SetFlashData(flashLink){
//	alert('Link: ' + flashLink +'');
	var objRel = document.getElementById('PlayerRelatedFlash');
	var objFla = document.getElementById('FlashPlayer');
	objRel.style.visibility = "hidden";
	objFla.style.visibility = "visible";
	try{
		var obj = document.getElementById('FlashPlayer');
		obj.setFlashData(flashLink);
	}
	catch(e){
		alert('Exception calling method on flash: ' + e);
	}
}
*/