function aichevideoplayer () 
{

try
  {
    var aicheVideoContainer = document.getElementById('aichevideoblock');

    if (aicheVideoContainer!=null) // page must have a div with ID=aichevideoblock to embed videos
    {
	var baseUrl=aicheVideoContainer.getAttribute('url');
	var videopath=aicheVideoContainer.getAttribute('videopath');
	var width=aicheVideoContainer.getAttribute('playerwidth');
	var height=aicheVideoContainer.getAttribute('playerheight');

	height = parseInt(height)+25; // player-specific; to account for player controls' height

	aicheVideoContainer.style.width = width+'px';
	aicheVideoContainer.style.height = height+'px';
	aicheVideoContainer.style.align = 'center';
	aicheVideoContainer.style.verticalAlign = 'middle';

	// include video player specific script file -- flowplayer
	//var playerJSfile = "/includes/flowplayer/flowplayer-3.0.3.min.js"

	// include video player specific script file -- jwplayer
	if (videopath.toLowerCase().indexOf('.wmv')>0) {
		var script1 = document.createElement("script");
		script1.setAttribute("type", "text/javascript");
		var playerJSfile ="/includes/jwplayer/silverlight.js";
		script1.setAttribute("src", playerJSfile);
		document.getElementsByTagName("head")[0].appendChild(script1);

		var script2 = document.createElement("script");
		script2.setAttribute("type", "text/javascript");
		var playerJSfile ="/includes/jwplayer/wmvplayer.js";
		script2.setAttribute("src", playerJSfile);
		document.getElementsByTagName("head")[0].appendChild(script2);
	}
	else {
		var noFlashMssg = document.createElement("a");
		noFlashMssg.href="http://www.macromedia.com/go/getflashplayer";
		noFlashMssg.appendChild (document.createTextNode("Flash Player is required to view this video."));
		aicheVideoContainer.appendChild(noFlashMssg ); 

		var playerJSfile ="/includes/jwplayer/swfobject.js";
		var script = document.createElement("script");
		script.setAttribute("type", "text/javascript");
		script.setAttribute("src", playerJSfile);
		document.getElementsByTagName("head")[0].appendChild(script);

	}

/****** JWPlayer ****/

	// Player-specific script is NOT available immediately for (needs a few milli-seconds)
	// So execute any video player-specific code that needs to reference the script after a time delay (eg 1000 milisecs)
	var timerID = setInterval(
		function() {

			if (videopath.toLowerCase().indexOf('.wmv')>0) {
			 	var src = "/includes/jwplayer/wmvplayer.xaml";
		 		var cfg = {file:"mms://aice.wmod.llnwd.net/a3559/o33/"+videopath};
			 	var ply = new jeroenwijering.Player(aicheVideoContainer,src,cfg);
			} else {
				var jwplayer = new SWFObject("/includes/jwplayer/player.swf","ply",width,height,"9","#FFFFFF");
				jwplayer.addParam("allowfullscreen","true");
				jwplayer.addParam("allowscriptaccess", "always");
				jwplayer.addVariable("streamer", baseUrl);
				if (videopath.toLowerCase().indexOf('.flv')>0) 
					jwplayer.addVariable("file", videopath);
				else
					jwplayer.addVariable("file", videopath+".flv");

				jwplayer.write("aichevideoblock");
			}
			clearInterval(timerID);
		}, 1500);

/****** flowplayer: REMOVED 03/04/09 due to inconsistent performance if network connection is poor

	// create video player specific container (e.g flowplayer wants a <a> tag)
	var playerVideoContainer = document.createElement("a");
	playerVideoContainer.style.display = "block";
	playerVideoContainer.style.width = width+"px";
	playerVideoContainer.style.height = height+"px";
	playerVideoContainer.style.border = "1px solid gray";
	playerVideoContainer.setAttribute("id","playerVideoContainer");
	aicheVideoContainer.appendChild(playerVideoContainer); 

	// Player-specific script is NOT available immediately for (needs a few milli-seconds)
	// So execute any video player-specific code that needs to reference the script after a time delay (eg 1000 milisecs)
	var timerID = setInterval(
		function() {
			if (document.getElementById("playerVideoContainer")!=null) {
	    			$f("playerVideoContainer", "/includes/flowplayer/flowplayer-3.0.3.swf", { 
					clip: {    
						url: videopath,  
						provider: 'cdn', autoPlay: false, scaling: 'fit' 
					},
					plugins:{
						cdn: { 
							url: '/includes/flowplayer/flowplayer.rtmp-3.0.2.swf', 
							netConnectionUrl: baseUrl
						} 
					}
		    		}); 
			};
			clearInterval(timerID);
		}, 1000);
**********/

    }
  }
  catch(e){}
  return;
}

aichevideoplayer();