    function getSilverlightVersion() 
    {
        var version = '0';
        var container = null;
        try {
            var control = null;
            if (window.ActiveXObject) {
                control = new ActiveXObject('AgControl.AgControl');
            }
            else {
                if (navigator.plugins['Silverlight Plug-In']) {
                    container = document.createElement('div');
                    document.body.appendChild(container);
                    container.innerHTML = '<embed type="application/x-silverlight" src="data:," />';
                    control = container.childNodes[0];
                }
            }
            if (control) {
                if (control.isVersionSupported('2.0')) {
                    version = '2';
                }
                else if (control.isVersionSupported('1.0')) {
                    version = '1';
                }
            }
        }
        catch (e) { }
        if (container) {
            document.body.removeChild(container);
        }
        return version;
    }

	function TrackPopup(queryparam)
	{
		try
	    {
            var querystr;
            if( location.search == "")
            {
                querystr = "?";
            }
            else 
            {
                querystr = location.search + "&";
            }
            
            msAnalytics.ProfileId = 'C69D';
            msAnalytics.TargetPage = location.protocol + location.host + location.pathname + querystr + queryparam;
            msAnalytics.PageViewRegistered = false;
            msAnalytics.TrackPage();
	    }
	    catch(e)
	    {
	        // Ignore exceptions.
	    }
	}

	function SilverlightParamEncode(text) {
	    return text.replace(/\s/g, '%20').replace(/,/g, '%2C');
	}

	function PlaySilverlightVideo(nHeight, nWidth, projectName, videoURL) {
	    try {
	        $('#FlashRequiredMessage').hide();
	        
	        // size VideoSpan
	        VideoSpan1.style.height = (nHeight + 64);
	        VideoSpan1.style.width = (nWidth + 40);
	        // Position video box so it lands in center of scrolled window
	        VideoSpan1.style.top = (document.body.scrollTop);

	        VideoSpan1.innerHTML = '<span style="width: 100%; text-align: right; height: 44; margin-right: 0; margin-bottom: 0; margin-top: 10; display: table"><img onclick="StopVideo()" src="/Style%20Library/Images/OLSite/XinBox.gif" style="cursor: pointer; position: relative; top: 10; left: -17; float: right" width="24" height="24" alt="" border="0"></span>'
                + '<object height="' + nHeight + '" width="' + nWidth + '" type="application/x-silverlight-2" data="data:application/x-silverlight," style="">'
                + '<param value="/_vti_bin/_xap/Microsoft.OfficeLabs.Silverlight.StandAloneMediaPlayer.xap?v=" name="source"/>'
                + '<param value="2.0.30908.0" name="minRuntimeVersion"/>'
                + '<param value="true" name="autoUpgrade"/>'
                + '<param value="true" name="windowless"/>'
                + '<param value="Enabled" name="htmlAccess"/>'
                + '<param value="projectName=' + projectName + ',videoURL=' + SilverlightParamEncode(videoURL) + '" name="initParams"/>'
                + '<param value="onMediaError" name="onerror"/>'
                + '<div style="width: 100%; height: 520px; background-color: black;"><a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="border: 0;"><img border="0" style="margin-top: 100px; border: 0;" src="/_layouts/olsite/images/installSL.gif" alt="Get Silverlight" /></a></div>'
                + '</object>'
    		    + '</span>';
	    }
	    catch (e) {
	        //ignore error
	        return;
	    }
	    //show semi-transparent white background
	    backgroundWhite.style.display = "block";
	    //size semi-transparent white background
	    SizeBackgroundImage();

	    // Check browser version and determine correct "display" css value
	    var sDisplayCSSValue = "table"
	    if (navigator.appName == "Microsoft Internet Explorer") {
	        sDisplayCSSValue = "block"
	    }

	    // Position vid window
	    vidTable.style.display = sDisplayCSSValue;

	    // if no SL, show the Watch as WMV link
	    $('#VideoSpan1').append('<div style="width: 548px; margin-right: 15px; text-align: right;"><a href="' + videoURL + '">Watch as WMV</a></div>');
	}
	
	function PlayVideo(nHeight, nWidth, sVidID)
	{
	    TrackPopup("Video=" + sVidID);
	    
	    try
	    {
		    // size VideoSpan
		    VideoSpan1.style.height = (nHeight + 64);		
		    VideoSpan1.style.width = (nWidth + 40);
		    // Position video box so it lands in center of scrolled window
		    VideoSpan1.style.top = (document.body.scrollTop);

		    VideoSpan1.innerHTML = '<span style="width: 100%; text-align: right; height: 44; margin-right: 0; margin-bottom: 0; margin-top: 10; display: table"><img onclick="StopVideo()" src="/Style%20Library/Images/OLSite/XinBox.gif" style="cursor: pointer; position: relative; top: 10; left: -17; float: right" width="24" height="24" alt="" border="0"></span><embed id="VideoObject1" style="position: relative; left: 0; top: 0" src="http://images.video.msn.com/flash/soapbox1_1.swf" quality="high" width="' + nWidth + '" height="' + nHeight + '" base="http://images.video.msn.com" type="application/x-shockwave-flash" allowFullScreen="true" allowScriptAccess="always" pluginspage="http://macromedia.com/go/getflashplayer" flashvars="c=v&ap=true&rv=false&SlateTime=-1&hideOptions=true&flvfc=10001&v=' + sVidID + '&d=video.msn.com&ifs=true&vc=catalog.video.msn.com&sbmk=uv-en-us "></embed></span>'
	    }
	    catch(e)
	    {
		    //ignore error
		    return;
	    }
	    
	    //show semi-transparent white background
		backgroundWhite.style.display = "block";
		//size semi-transparent white background
		SizeBackgroundImage();
		
		// Check browser version and determine correct "display" css value
		var sDisplayCSSValue = "table"
		if (navigator.appName == "Microsoft Internet Explorer")
		{
			sDisplayCSSValue = "block"
		}
		
		// Position vid window
		vidTable.style.display = sDisplayCSSValue;
    }

    function PlaySoapboxVideo(nHeight, nWidth, sVidID) {
        TrackPopup("Video=" + sVidID);

        try {
            // size VideoSpan
            VideoSpan1.style.height = (nHeight + 64);
            VideoSpan1.style.width = (nWidth + 40);
            // Position video box so it lands in center of scrolled window
            VideoSpan1.style.top = (document.body.scrollTop);

            VideoSpan1.innerHTML = '<span style="width: 100%; text-align: right; height: 44; margin-right: 0; margin-bottom: 0; margin-top: 10; display: table"><img onclick="StopVideo()" src="/Style%20Library/Images/OLSite/XinBox.gif" style="cursor: pointer; position: relative; top: 10; left: -17; float: right" width="24" height="24" alt="" border="0"></span><embed id="VideoObject1" style="position: relative; left: 0; top: 0" src="http://images.video.msn.com/flash/soapbox1_1.swf" quality="high" width="' + nWidth + '" height="' + nHeight + '" base="http://images.video.msn.com" type="application/x-shockwave-flash" allowFullScreen="true" allowScriptAccess="always" pluginspage="http://macromedia.com/go/getflashplayer" flashvars="c=v&ap=true&rv=false&SlateTime=-1&hideOptions=true&v=' + sVidID + '&d=video.msn.com&ifs=true&vc=catalog.video.msn.com&sbmk=uv-en-us "></embed></span>'
        }
        catch (e) {
            //ignore error
            return;
        }
        //show semi-transparent white background
        backgroundWhite.style.display = "block";
        //size semi-transparent white background
        SizeBackgroundImage();


        // Check browser version and determine correct "display" css value
        var sDisplayCSSValue = "table"
        if (navigator.appName == "Microsoft Internet Explorer") {
            sDisplayCSSValue = "block"
        }

        // Position vid window
        vidTable.style.display = sDisplayCSSValue;
    }    	
	
	function StopVideo()
	{
		// Remember inner HTML of video span
		var sTempStr = VideoSpan1.innerHTML;
		// Stop playback by clearing inner HTML
		VideoSpan1.innerHTML = "";
		// Restore inner HTML
		VideoSpan1.innerHTML = sTempStr;
		//Hide semi-transparent white background
		backgroundWhite.style.display = "none";
		// Hide vid window
		vidTable.style.display = "none";
	}
	
	function SizeBackgroundImage()
	{
		//If the semi-transparent white background box is not visible, exit
		if(backgroundWhite.style.display != 'block')
		{
			return;
		}
		//Size the semi-transparent white background box behind video window
		backgroundWhite.style.width = document.body.scrollWidth;
		backgroundWhite.style.height = document.body.scrollHeight;	
	}
	
	// variable to track which screen shot is first in the sequence
	var oFirstPic = null;
	// variable to track which screen shot is currently visible -- zero-based number
	var nCurrentPicNo = 1;
	// variable to track how many pictures are available in slide show
	var nHowManyPix = 0;
	
	function OpenSlideShow()
	{
	    TrackPopup("SlideShow=1");
	
		// Check browser version and determine correct "display" css value
	    var sDisplayCSSValue = "table";
		if (navigator.appName == "Microsoft Internet Explorer")
		{
		    sDisplayCSSValue = "block";        }
        
        var SlideShowTable = document.getElementById("SlideShowTable");

		// un-hide table for slide show
		SlideShowTable.style.display = sDisplayCSSValue;
		// Position slide show box so it lands in center of scrolled window
		SlideShowTable.style.top = (document.body.scrollTop);

		// Copy images from web part into slide show div
		var SlideShowPictureDiv = document.getElementById("SlideShowPictureDiv");
		SlideShowPictureDiv.innerHTML = sSlideShowImages;
		// determine number of pictures	
		try
		{
			// valid in IE but not in other browsers:
			nHowManyPix = (SlideShowPictureDiv.children.length);
		}
		catch(e)
		{
			// valid in other browsers (and not IE):
			nHowManyPix = (SlideShowPictureDiv.childNodes.length);
		}
		
		// if there are no pictures, quit function
		if(nHowManyPix == 0)
		{
		    return;
		}
		
		if (nHowManyPix > 1)
		{
			// Show "Next" button
			 document.getElementById("NextBtn").style.visibility = "visible";
		}
		// show first pic		
		
		try
		{
			// valid in IE but not in other browsers:
			oFirstPic = SlideShowPictureDiv.children(0);
		}
		catch(e)
		{
			// valid in other browsers (and not IE):
			oFirstPic = SlideShowPictureDiv.childNodes[0];
						
		}
		
		// Show first picture in Slide Show window
		oFirstPic.style.display = "block";

		//Show semi-transparent white background
		var backgroundWhite = document.getElementById("backgroundWhite");
		backgroundWhite.style.display = "block";
		backgroundWhite.style.height = document.body.scrollHeight;
		// Show Slide Show window
		document.getElementById("SlideShowDiv1").style.display = sDisplayCSSValue;
		// update caption
		document.getElementById("SlideShowCaptionDiv").innerHTML = oFirstPic.alt;
		// update counter UI info
		document.getElementById("PicCounterSpan").innerHTML = nCurrentPicNo + " of " + nHowManyPix;
	}
	
	function FlipSlideShow(sNextOrPrev)
	{
		// first, hide all pix
		for (i=0; i<(nHowManyPix); i++)
		{
			try
			{
				// valid in IE but not in other browsers:
				var oTemp = SlideShowPictureDiv.children(i);
			}
			catch(e)
			{
				// valid in other browsers (and not IE):
				var oTemp = document.getElementById("SlideShowPictureDiv").childNodes[i];						
			}
			oTemp.style.display = "none";	
		}


		// update current pic number
		if(sNextOrPrev == "Previous" && nCurrentPicNo >= 2)
		{
			// Decrement current pic no.
			nCurrentPicNo = nCurrentPicNo - 1;
		}	
		if(sNextOrPrev == "Next" && nCurrentPicNo < nHowManyPix)
		{
			// Increment current pic no.
			nCurrentPicNo = nCurrentPicNo + 1;
		}
		// Show new picture
		try
		{
			// valid in IE, but not other browsers:
			var oNewPic = SlideShowPictureDiv.children(nCurrentPicNo - 1);
		}
		catch(e)
		{
			// valid in other browsers (and not IE):
			var oNewPic = SlideShowPictureDiv.childNodes[nCurrentPicNo - 1];
		}
		oNewPic.style.display = "block";
		// adjust Next and Provious buttons
		if (nCurrentPicNo >= 2)
		{
			// Show Previous button
			PreviousBtn.style.visibility = "visible";
		}
		else
		{
			// Hide Previous button
			PreviousBtn.style.visibility = "hidden";
		}
		if (nCurrentPicNo < nHowManyPix)
		{
			// Show Next button
			NextBtn.style.visibility = "visible";
		}
		else
		{
			// Hide Next button
			NextBtn.style.visibility = "hidden";
		}
		// update caption
		SlideShowCaptionDiv.innerHTML = oNewPic.alt
		// update counter UI info
		PicCounterSpan.innerHTML = nCurrentPicNo + " of " + nHowManyPix;
	}
	
	function CloseSlideShow()
	{
		//Hide semi-transparent white background
		backgroundWhite.style.display = "none";
		// Hide Slide Show Span
		SlideShowDiv1.style.display = "none";
		// Hide slide show table
		SlideShowTable.style.display = "none";
		// Reset variables
		oFirstPic = null;
		nCurrentPicNo = 1;
		// Reset Next and Previous buttons
		NextBtn.style.visibility = "hidden";
		PreviousBtn.style.visibility = "hidden";
		SlideShowPictureDiv.innerHTML = "";
	}