
function loadVideo()
{
	try
	{
		var vidObj = $("img[src='/am/admin/utilities/videomanager/video.gif']");
		var videoSrc = $(vidObj).attr("video");
		var videoType = $(vidObj).attr("type");
		
		//build the embed obj
		if(videoType=="flash")
		{
			var flashObj = document.createElement('EMBED');   
			flashObj.setAttribute('id',"video11"); // Give id to it
			flashObj.setAttribute('src',"/am/admin/utilities/videomanager/player.swf");
			flashObj.setAttribute('width',$(vidObj).width());
			flashObj.setAttribute('height',$(vidObj).height());
			flashObj.setAttribute('allowscriptaccess',"always");
			flashObj.setAttribute('allowfullscreen',"true");
			flashObj.setAttribute('flashvars',"file=" + videoSrc);
		
			//swap the embed object
			
			$(vidObj).replaceWith(flashObj);
	
		}else{
			var wmObj = document.createElement('EMBED');   
			wmObj.setAttribute('id',"video11"); // Give id to it
			wmObj.setAttribute('name',"MediaPlayer"); 
			wmObj.setAttribute('type',"application/x-mplayer2"); 
			
			wmObj.setAttribute('src',videoSrc);
			wmObj.setAttribute('width',$(vidObj).width());
			wmObj.setAttribute('height',$(vidObj).height());
			wmObj.setAttribute('ShowControls',"1");
			wmObj.setAttribute('ShowStatusBar',"0");
			wmObj.setAttribute('ShowDisplay',"0");
			wmObj.setAttribute('autostart',"0");
		
			//swap the embed object
			$(vidObj).replaceWith(wmObj);
		}
		
	}
	catch(err)
	{
		//document.write("err" + err);
	}
}
	
   
 $(window).ready(function(){
	   loadVideo();
 });
