
function showLoading()
{
	$("global_display").style.display = "none";
	$("global_display").innerHTML = "";
	$("global_display_loading").style.display = "inline";
}

function hideLoading()
{
	$("global_display_loading").style.display = "none";
	$("global_display").style.display = "inline";
}
function showLoading_player()
{
	$("player").style.display = "inline";
	$("global_display_player").style.display = "none";
	$("global_display_player").innerHTML = "";
	$("global_logo_video_loading").style.display = "inline";
}

function hideLoading_player()
{
	$("global_logo_video_loading").style.display = "none";
	$("global_display_player").style.display = "inline";
}


function closePlayer()
	{
		try
		{
			$("global_display_player").innerHTML = "";
			$("page_background-image").style.display = "inline";
			$("panel_nav").style.display = "inline";
			$("global_display").style.display = "inline";
		}
		catch(ex)
		{
		}
		$("player").style.display = "none";
	}
	
	
function VideoImageDisplay_handleInfoClick (itemId, channelId, doPlay, brandName, videoName, videoImageSize)
    {    
        //loadItem(itemId, channelId, doPlay);
        document.location.href = "/lifestyleVideos/?iId=" + itemId;
    }
    
    
    

function loadVideo(videoId, flashContent, width, addOnPath, videoItemId) 
	{
		if(!addOnPath){addOnPath = "";}else{addOnPath = "";}
		showLoading_player();
		try
		{
			$("page_background-image").style.display = "none";
			$("panel_nav").style.display = "none";
			$("global_display").style.display = "none";
		}
		catch(ex)
		{}
		_doFade = false;
		var url = addOnPath + '/system/ajax/loadVideo.asp';
		var params = "id=" + videoId + "&fc=" + flashContent + "&w=" + width + "&vid=" + videoItemId + "";
		var ajax = new Ajax.Updater(
										{
											success: 'global_display_player'
										},
										url,
										{
											method: 'get', 
											parameters: params, 
											onFailure: reportError, 
											evalScripts : true,
											encoding : 'UTF-8',
											onComplete: function(response) 
																{
																	startPlayer();
																	hideLoading_player();
																} 
										}
									);
	}
	
function loadVideo_JS(videoId, flashCode, width)
	{
		_doFade = false;
		var head = document.getElementsByTagName('head').item(0)
		var scriptTag = document.getElementById('videoJS');
		if(scriptTag) head.removeChild(scriptTag);
		script = document.createElement('script');
		//alert("http://vstream5.esender.de/objectfiles/" + videoId + "_" + flashCode + "_" + width + ".js");
		script.src = "http://vstream5.esender.de/objectfiles/" + videoId + "_" + flashCode + "_" + width + "sd.js";
		script.type = 'text/javascript';
		script.id = 'videoJS';
		head.appendChild(script)
	}
	

var currentPlayingVideoId = null;

function startPlayer()
{
	setTimeout("initPlayer_start_loop()",250);
}

function initPlayer_start_loop()
{
		try
		{
			generateFlash();
		}
		catch(ex)
		{
			setTimeout("initPlayer_start_loop()",250);
		}
		
}	
	
	
	
function reportError(request) 
	{
		document.write(request.responseText);
	}
