function embedVideoPlayer(videoPath,videoWidth,videoHeight,videoAutoPlay,videoTarget,videoID,videoThumb,videoLink,linkOutText){
	
	// Decide if user doesn't have Flash, and needs the iFrame fallback for YouTube
	var useYoutubeFallback = (swfobject.hasFlashPlayerVersion("9.0.115")) ? false : true;
	//var useYoutubeFallback = true;
	
	var $videoTarget = $('#'+videoTarget);
	$videoTarget.parent().height(videoHeight);
	
	if(videoPath.indexOf('.flv') > 0 || videoPath.indexOf('.mov') > 0){
		var playerSWF = "/ltr/video_player/FlvPlayerTEG.swf";
		
		var flashvars = {};
		flashvars.flvTarget = videoPath;
		flashvars.flvWidth = videoWidth;
		flashvars.flvHeight = videoHeight;
		flashvars.autoPlay = videoAutoPlay;
		flashvars.flvThumb = videoThumb;
		flashvars.flvLink = videoLink;
		flashvars.linkOutText = linkOutText;
		
		var params = {};
		params.bgcolor = "#FFFFFF";
		params.wmode = "opaque";
		
		var attributes = {};
		attributes.id = "videoPlayer";
		
		$videoTarget.show();
		swfobject.embedSWF(playerSWF, videoTarget, videoWidth, videoHeight, "9.0.0", false, flashvars, params, attributes);
	}
	
	else if(videoPath.indexOf('.swf') > 0){
		var playerSWF = videoPath;
		
		var flashvars = {};
		
		var params = {};
		params.bgcolor = "#FFFFFF";
		params.wmode = "opaque";
		
		var attributes = {};
		attributes.id = "videoPlayer";
		
		$videoTarget.show();
		swfobject.embedSWF(playerSWF, videoTarget, videoWidth, videoHeight, "9.0.0", false, flashvars, params, attributes);
	}
	
	else if(videoPath.indexOf("youtube.com/watch?v=") > 0){
		
		var flashvars = {};
		flashvars.fs = "1";
		
		var params = {};
		params.wmode = "opaque";
		params.autoplay = videoAutoPlay ? "1" : "0";
		params.allowScriptAccess = "always";
		params.allowFullScreen= "true";
		
		var attributes = {};
		attributes.id = videoID;
		
		//http://www.youtube.com/watch?v=12dcxI9S1Nk
		//http://www.youtube.com/v/12dcxI9S1Nk
		videoPath = videoPath.split('/watch?v=').join('/v/').split('&')[0];
		
		if(videoThumb != undefined && videoThumb != ""){
			var playIconLeft = parseInt((videoWidth/2)-64,10);
			var playIconTop = parseInt((videoHeight/2)-63,10);
			var videoPlayIcon = "/ltr/video_player/play_icon.png";
			if(fixIE6) videoPlayIcon = "/ltr/video_player/play_icon.gif";
			$videoTarget.hide();
			$videoTarget
				.parent()
				.prepend(
					'<div id="videoThumbButton">' + 
						'<img src="'+videoThumb+'" width="'+videoWidth+'" height="'+videoHeight+'" class="videoThumb" alt="">' + 
						'<a href="javascript:void(0)" onclick="playYouTubeVideo(\''+videoPath+'\',\''+videoWidth+'\',\''+videoHeight+'\',\''+videoTarget+'\',\''+videoID+'\',this)">' + 
							'<img class="playIcon" src="' + videoPlayIcon + '" width="128" height="128" style="left:'+playIconLeft+'px; top:'+playIconTop+'px;" alt="" />' + 
						'</a>' + 
					'</div>');
			
			// Add link out to YouTube if required
			if((videoLink != "" && videoLink != undefined) && (linkOutText != "" && linkOutText != undefined)){
				//alert('I am a YouTube video that needs a link!');
				//alert(linkOutText+' ('+videoLink+') - $videoTarget = '+$videoTarget.parent().className);
				$videoTarget
					.parent()
					.append(
						'<div id="videoLinkOutButton">'+
							'<div class="startCap"></div>'+
							'<a href="'+videoLink+'">'+linkOutText+'</a>'+
							'<div class="endCap"></div>'+
						'</div>');
				// Move up by 63px if cropped on homepage
				var $videoLinkOutButton = $('#videoLinkOutButton');
				if($videoLinkOutButton.parent().attr('id') == "assetContainer") $videoLinkOutButton.css('bottom','83px');
			}
		}
		else{
			if(useYoutubeFallback){
				var youTubeFallback = 
					'<iframe height="' + videoHeight + '" frameborder="0" width="' + videoWidth + '" allowfullscreen="" ' +
						'src="https://www.youtube.com/embed/' + videoPath.split('/v/')[1] + '?wmode=opaque&amp;rel=0&amp;autohide=1" ' +
						'title="YouTube video player"></iframe>';
				$('#noFlashContent').html(youTubeFallback).css('display','block');
				enlargePlayerArea('#assetContainer');
				
				// jQuery function to fade in container div opacity (fades flash only if param transparency set)
				$(calledFrom).parent().fadeOut(500);
			}
			else{
				videoPath = videoPath + "?autoplay=0&autohide=1&enablejsapi=1";
				swfobject.embedSWF(videoPath, videoTarget, videoWidth, videoHeight, "9.0.0", false, flashvars, params, attributes);
			}
		}
	}

}

function playYouTubeVideo(videoPath,videoWidth,videoHeight,videoTarget,videoID,calledFrom){
	
	// Decide if user doesn't have Flash, and needs the iFrame fallback for YouTube
	var useYoutubeFallback = (swfobject.hasFlashPlayerVersion("9.0.115")) ? false : true;
	//var useYoutubeFallback = true;
	
	$('#videoLinkOutButton').css('display','none');
	
	// Manually hide the video play button for youTubeFallback?
	if(useYoutubeFallback) $(calledFrom).css('display','none');
	
	if(typeof stopAutoCycle == 'function') stopAutoCycle();
	
	if(useYoutubeFallback){
		var youTubeFallback = 
			'<iframe height="' + videoHeight + '" frameborder="0" width="' + videoWidth + '" allowfullscreen="" ' +
				'src="https://www.youtube.com/embed/' + videoPath.split('/v/')[1] + '?wmode=opaque&amp;rel=0&amp;autoplay=1&amp;loop=1&amp;autohide=1" ' +
				'title="YouTube video player"></iframe>';
		$('#noFlashContent').html(youTubeFallback).css('display','block');
		enlargePlayerArea('#assetContainer');
		
		// jQuery function to fade in container div opacity (fades flash only if param transparency set)
		$(calledFrom).parent().fadeOut(500);
	}
	else{
		var flashvars = {};
		flashvars.fs = "1";
		
		var params = {};
		params.wmode = "opaque";
		params.autoplay = "1";
		params.allowScriptAccess = "always";
		params.allowFullScreen= "true";
		
		var attributes = {};
		attributes.id = videoID;
		
		videoPath = videoPath + "?autoplay=1&autohide=1&enablejsapi=1";
		
		$(calledFrom).parent().fadeOut(500,function(){
				swfobject.embedSWF(videoPath, videoTarget, videoWidth, videoHeight, "9.0.0", false, flashvars, params, attributes);
			});
	}
}

