
$(function () {
			$("a#my-link").click(function () {		
				$.floatbox({
				        content: htmlContent,
				        fade: true,
				        closeContent: closeContent,
				       bgConfig : {
			                position: "absolute",
			                zIndex: 8,
			                width: "100%",
			                height: browserHeight + "px",
			                top:  scrollHeight + "px",
			                left: "0px",
			                backgroundColor: "#000",
			                opacity: "0.75",
			                display: "none"
			            },
				        boxConfig : {
			                position : "absolute",
			                zIndex: 9,
			                width: widthVideo + "px",
			                height: heightVideo + "px",
			                top: videoPosHeight + "px",
			                left: videoPosWidth + "px",
			                backgroundColor: "#fff",
			                display: "block"
			            },
			            closeBoxConfig : {
			                position : "absolute",
			                zIndex: 10,
			                width: "25px",
			                height: "25px",
			                top: closeButtonPosHeight + "px",
			                left: closeButtonPosWidth + "px",
			                backgroundColor: "#fff",
			                display: "block"
			            }
				});
			});
		});
		
		function playMovieClick(movieName, width, height){
			movieFile = movieName;
			widthVideo = width;
			heightVideo = height;
			if(flashVersion < 9){
				alert('You need at least Flash Player 9 to view this moive.\n \nTo get the latest flash player use the link provided.');
				return false;
			}
			//document.getElementById('demoSwf').style.display = "none";
    		//define html content for the jquery floatbox
    		
    		//get rid of scroll bars to remove scrolling issues
    		if($.browser.safari){
    			//do nothing
    		}else if($.browser.msie){
    			document.getElementsByTagName("html")[0].style.overflow = "hidden";
    		}else{
    			document.getElementsByTagName("body")[0].style.overflow = "hidden";
    		}
			
    		/*
    		if ((screen.width > widthVideo) && (screen.height > heightVideo)){
	    			widthVideo = widthVideo / 2;
	    			heightVideo = heightVideo / 2;
    		}
    		*/
    		//defined html content for video and close button
    		htmlContent = "<object id='flashMovie' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='" + widthVideo + "' height='" + heightVideo + "'><param name='movie' value='" + movieFile + "' /><!--[if !IE]>--><object type='application/x-shockwave-flash' data='" + movieFile + "' width='" + widthVideo + "' height='" + heightVideo + "'><param name='loop' value='false' /><!--<![endif]--><img alt='Learning Assistant E-portfolio is just fantastic for online NVQ delivery' width='856' height='313' src='/images/alternate_home_banner.jpg'/><!--[if !IE]>--></object><!--<![endif]--></object>";
		    closeContent = "<a href='javascript:void(0);' class='close-floatbox' ><img src='/images/close_button2.gif' width='25' height='25' style='border: none;' /></a>";   

    		
    		//get the size of the browser window
    		windowSize();
    		
    		//is video to tall for browser window?
    		if(browserHeight <= heightVideo){
    			blnVideoOverflow = true;
    		}else{
    			blnVideoOverflow = false;
    		}
    		

    		//set the position of video and close button
    		//set vertical height of video
    		

    		//set height scrolled down
    		scrollHeight = document.documentElement.scrollTop;
    		//beging to set vertical height of video
    		videoPosHeight = ((browserHeight - heightVideo) / 2 ) + scrollHeight;

    		if(!blnVideoOverflow){
    			closeButtonPosHeight = videoPosHeight - 30;
    		}else{
    			closeButtonPosHeight = 5;
    			// ajust for scroll
    			//if ($.browser.msie){
    				closeButtonPosHeight = closeButtonPosHeight + scrollHeight;
    			//}
    		}
    		//make sure its an integer
    		closeButtonPosHeight = Math.round(closeButtonPosHeight);
    		//for some reason the video is displayed half its height higher than expect, so compensate
    		videoPosHeight = videoPosHeight + (heightVideo/2)
    		//make sure integer
    		videoPosHeight = Math.round(videoPosHeight);
    		//set the videos width pos
    		videoPosWidth = (browserWidth - widthVideo) / 2;
    		//make sure integer
    		videoPosWidth = Math.round(videoPosWidth);
    		//set teh close button width
    		if(!blnVideoOverflow){
    			closeButtonPosWidth = videoPosWidth + widthVideo - 25;
    		}else{
    			closeButtonPosWidth = videoPosWidth + widthVideo + 5;
    		}
    		//make sure integer
    		closeButtonPosWidth = Math.round(closeButtonPosWidth);
    		
    		//simulate click to call floatbox function
    		$(document).ready (function() {$('a#my-link').click();});
		}

		function windowSize() {
			if( typeof( window.innerWidth ) == 'number' ) {
				//Non-IE
				browserWidth = window.innerWidth;
				browserHeight = window.innerHeight;
			} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
				//IE 6+ in 'standards compliant mode'
				browserWidth = document.documentElement.clientWidth;
				browserHeight = document.documentElement.clientHeight;
			} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
				//IE 4 compatible
				browserWidth = document.body.clientWidth;
				browserHeight = document.body.clientHeight;
			}
			
		}
