	window.addEvent('domready', function() {

		findvideolinks();
		
		$$('.temp').each(function(temp) {
			temp.set('tempHtml', temp.get('html'));
			temp.set('html', '');
		});
		
		var blueBox = new Accordion('.relateditem', '.relatedcontent', {
			duration: 400, 
			transition: Fx.Transitions.Sine.easeOut, 			
			display: -1,
			alwaysHide: true,
			onActive: function(t, c) { t.addClass('selectedRelatedItem'); },
			onBackground: function(t, c) { t.removeClass('selectedRelatedItem'); }	
		});

	});

	function findvideolinks ()
{
$$('a.videoswap').each(function(a) {

			a.addEvent('click', function() {
				var _this = this;
				$$('a.videoswapselected').each(function(sel) { sel.removeClass('videoswapselected');sel.addClass('videoswap');});

				_this.removeClass('videoswap');
				_this.addClass('videoswapselected');

				var blurb = $('video_description');
				blurb.origHeight = blurb.offsetHeight;
				if (!blurb.animated) {

					blurb.animIn = new Fx.Morph(blurb, {duration: 'short', transition:Fx.Transitions.Quad.easeOut});
					blurb.animIn.addEvent('complete', function() {showVideo(_this);});

					blurb.animIn.start({opacity: [1,0], height: 277});
					blurb.animated = true;
				}
				else {
					showVideo(_this);
				}

				return false;
			});
		});
}	
	function displayModalVideo(containerID, playerID, channelid, storyid, resizeLevels, videoheight, videowidth) {
		$$('#' + containerID + ' .temp').each(function(temp) {
			temp.set('html', temp.get('tempHtml'));
		});
		
		var cont = $(containerID);
		cont.addClass('modalVisible');
		cont.removeClass('modalHidden');
		
		if (resizeLevels > 0) {
			var parent = cont.getParent();
			for (var i = 0; i < resizeLevels; i++) { parent = parent.getParent(); }
			parent.setProperty('defaultHeight', parent.getCoordinates().height);
			var newHeight = cont.getCoordinates().height + cont.getCoordinates(parent).top;
			if (newHeight > parent.getCoordinates().height) { parent.setStyle('height', newHeight); }
						
			var so = new FlashObject ("http://leggmason.pb.feedroom.com/pb-comp/leggmason/custom1/player.swf", "player", videowidth, videoheight, "8", "#FFFFFF");

			so.addVariable ("SkinName", "custom1");

			so.addVariable ("SiteID", "leggmason");

			so.addVariable ("SiteName", "leggmason");		

			so.addVariable ("ChannelID", channelid);

			so.addVariable ("StoryID", storyid);

			so.addVariable ("Volume", ".5");

			so.addParam ("quality", "high");

			so.addParam ("allowFullScreen", "true");

			so.addParam ("allowScriptAccess", "always");

			so.addParam ("menu", "false");

			so.addParam ("wmode", "transparent");
			
			so.write ("flashcontent");
			
			var parentcol = $$(".columntwo463");
			var colHeight = parentcol[0].getCoordinates().height;
			var newcolHeight = colHeight + 100;
			parentcol[0].setStyle('height', newcolHeight);
		}
		
	}
	
	function closeModalVideo(containerID, playerID, resizeLevels) {
		$$('#' + containerID + ' .temp').each(function(temp) {
			temp.set('html', '');
		});
		
		var cont = $(containerID);
		cont.addClass('modalHidden');
		cont.removeClass('modalVisible');
		
		if (resizeLevels > 0) {
			var parent = cont.getParent();
			for (var i = 0; i < resizeLevels; i++) { parent = parent.getParent(); }
			parent.setStyle('height', parent.getProperty('defaultHeight'));
			
			var parentcol = $$(".columntwo463");
			var colHeight = parentcol[0].getCoordinates().height;
			var newcolHeight = colHeight - 100;
			parentcol[0].setStyle('height', newcolHeight);
		}
		
		
		
	}
	
	var videoHeight;
	function showVideo(link) {
		var cont = $('video_container');
		cont.setStyle('display', 'block');
		var frcont = $('flashcontent');
		frcont.empty();
		var defaultHeight = 277;
		if (videoHeight) { defaultHeight = videoHeight; }

			var so = new FlashObject ("http://leggmason.pb.feedroom.com/pb-comp/leggmason/custom1/player.swf", "player", "442", defaultHeight, "8", "#FFFFFF");

			so.addVariable ("SkinName", "custom1");

			so.addVariable ("SiteID", "leggmason");

			so.addVariable ("SiteName", "leggmason");		

			so.addVariable ("ChannelID", videochannel);

			so.addVariable ("StoryID", link.rel);

			so.addVariable ("Volume", ".5");

			so.addParam ("quality", "high");

			so.addParam ("allowFullScreen", "true");

			so.addParam ("allowScriptAccess", "always");

			so.addParam ("menu", "false");

			so.addParam ("wmode", "transparent");
			
			so.write ("flashcontent");

		//cont.set('html', embed);
	}

	function closeVideos() {

		$$('a.videoswapselected').each(function(sel) { sel.removeClass('videoswapselected');sel.addClass('videoswap');});

		var blurb = $('video_description');
	if (blurb.animated) {
		var cont = $('video_container');
		cont.setStyle('display', 'none');
		cont.set('html', '');

		blurb.animOut = new Fx.Morph(blurb, {duration: 'short', transition:Fx.Transitions.Quad.easeOut});
		blurb.animOut.start({opacity: 1, height: blurb.origHeight + 20});
		blurb.animated = false;
	}
	}

	function onDisclaimerPopup() {
		closeVideos();
	}

	//-->