document.write('<div id="videoScreen" class="hidden"></div><div id="videoScreenPlayer" class="hidden"></div>');

loadInlineVideo = function(e) {
	document.getElementById("videoScreen").className = "";
	document.getElementById("videoScreen").onclick = closeInlineVideo;
	document.getElementById("videoScreenPlayer").className = "";
	// document.getElementById("videoScreenPlayer").innerHTML = '<iframe src="' + this.href.replace("/video", "/video/popup") + '" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" height="404" width="422"></iframe><div id="videoScreenCloser"><img src="http://static.reuters.com/resources/media/global/assets/interactives/inlinevideo/btn_closeVideo.gif" border="0" alt="Close Video" onclick="closeInlineVideo();" /></div>';
	var myVideoId = FindQueryStringParam(this.href, "videoId");
	document.getElementById("videoScreenPlayer").innerHTML = '<object type="application/x-shockwave-flash" data="http://static.reuters.com/resources/flash/include_video.swf?automaticplay=true&inlinePlayer=true&edition=' + strLocalization + '&videoId=' + myVideoId + '" width="422" height="346"><param name="wmode" value="transparent" /><param name="movie" value="http://static.reuters.com/resources/flash/include_video.swf?automaticplay=true&inlinePlayer=true&edition=' + strLocalization + '&videoId=' + myVideoId + '" /><embed src="http://static.reuters.com/resources/flash/include_video.swf?automaticplay=true&inlinePlayer=true&edition=' + strLocalization + '&videoId=' + myVideoId + '" type="application/x-shockwave-flash" wmode="transparent" width="422" height="346"></embed></object><div id="videoScreenCloser"><img src="http://static.reuters.com/resources/media/global/assets/interactives/inlinevideo/btn_closeVideo.gif" border="0" alt="Close Video" onclick="closeInlineVideo();" /></div>';
	document.getElementById("videoScreen").style.cssText = "height: " + document.getElementById("grid").offsetHeight + "px; width: 992px;";
	document.getElementsByTagName("body")[0].style.cssText = 'background: #666;';
	// dcsMultiTrack('DCSext.VirtualEvent', '1', 'DCSext.rChannel','Video','WT.cg_n','Video - Article Flash Popup','WT.cg_s','','DCSext.DartZone','reuters.com.dart','DCSext.ContentType','Video','DCSext.ContentID',myVideoId,'DCSext.rCountry',strLocalization);
	return false;
}

closeInlineVideo = function(e) {
	document.getElementById("videoScreen").className = "hidden";
	document.getElementById("videoScreenPlayer").className = "hidden";
	document.getElementsByTagName("body")[0].style.cssText = 'background: #F5F5F5;';
}

initInlineVideo = function() {
	var aLinks = document.getElementsByTagName("a");
	for (i=0; i<aLinks.length; i++) {
		if ((aLinks[i].href.search("videoId") != -1) && (aLinks[i].href.search("newsChannel") != -1)) {
			aLinks[i].onclick = loadInlineVideo;
			if (aLinks[i].innerHTML.search("Video Thumbnail") != -1) {
				aLinks[i].innerHTML = '<div class="relatedVideoOverlay"><img src="http://static.reuters.com/resources/images/btn_vidPlayLg.gif" border="0" /></div>' + aLinks[i].innerHTML;
			}
		}
	}
}

addLoadEvent(initInlineVideo);