﻿		var isIE6 = (navigator.userAgent.indexOf('MSIE 6') > -1) ? true : false;
		
		if (isIE6) {
			window.onscroll = calculateWindowDimensions;
			window.onresize = calculateWindowDimensions;
		}

		function calculateWindowDimensions() {
			scroll();
			resize();
		}

		function resize() {
			var overlay = document.getElementById('overlayDiv');
			var video = document.getElementById('videoDiv');

			var myWidth = 0, myHeight = 0;
			if( typeof( window.innerWidth ) == 'number' ) {
				//Non-IE
				myWidth = window.innerWidth;
				myHeight = window.innerHeight;
			} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
				//IE 6+ in 'standards compliant mode'
				myWidth = document.documentElement.clientWidth - 2;
				myHeight = document.documentElement.clientHeight - 2;
			} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
				//IE 4 compatible
				myWidth = document.body.clientWidth;
				myHeight = document.body.clientHeight;
			}

			overlay.style.width = myWidth + "px"; //document.documentElement.clientWidth;
			overlay.style.height = myHeight + "px"; // document.documentElement.clientHeight;
			
			video.style.width = myWidth + "px"; //document.documentElement.clientWidth;
		}

		function scroll() {
			var overlay = document.getElementById('overlayDiv');
			var video = document.getElementById('videoDiv');
			
			var scrOfX = 0, scrOfY = 0;
			if( typeof( window.pageYOffset ) == 'number' ) {
				//Netscape compliant
				scrOfY = window.pageYOffset;
				scrOfX = window.pageXOffset;
			} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
				//DOM compliant
				scrOfY = document.body.scrollTop;
				scrOfX = document.body.scrollLeft;
			} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
				//IE6 standards compliant mode
				scrOfY = document.documentElement.scrollTop;
				scrOfX = document.documentElement.scrollLeft - 1;
			}

			overlay.style.top = scrOfY + "px";
			overlay.style.left = scrOfX + "px";

			video.style.left = scrOfX + "px";

		}

		var globalParam;

		function showVideo(param) {
            
            tagAction (param);
            // call the right tagging function
            /*switch (param)
            {
            case 1: 
                tagAction ('clickleroy');
                break;
            case 2:
                tagAction ('clickelise');
                break;
            case 3:
                tagAction ('clickdick');
                break;
            }
            */
			if (isIE6) {
				resize();
				scroll();
			}
			
			globalParam = param;

			document.getElementById('overlayDiv').style.display = 'block';
			document.getElementById('videoDiv').style.display = 'block';
		
			document.getElementById('flashPlaceHolder').innerHTML = flashObjectHtml;
		}
		
		function playVideo() {
			document.getElementById('videoPlayer').playVid(globalParam);
		}

		function hideVideo() {
			document.getElementById('flashPlaceHolder').innerHTML = '';
			document.getElementById('videoDiv').style.display = 'none';
			document.getElementById('overlayDiv').style.display = 'none';
			
		}
		
		function closeDiv(e) {
			if (!IE && (e.target.id == 'videoPlayer'))
				return;
				
			hideVideo();
		}
