var flashcontent2Html = "";
var vidWidth = 342;
var vidHeight = 500;

function loadVideo(vidId){

	var htmlStr = '';
	if(flashcontent2Html == ""){
		flashcontent2Html = document.getElementById('flashcontent2').innerHTML;		//Store only if first time
	}	
	
	htmlStr += '<div id="youTubeAreaOuter" onMouseOver="displayCloseButton(\'on\');" onMouseOut="displayCloseButton(\'off\');">';
	htmlStr += '<div id="youTubeCloseBut">';
	htmlStr += '<a href="javascript:void(0);" onClick="closeVid();"><img alt="close" height="34" src="/images/interface/closeVideo.gif" width="343" /></a>';
	htmlStr += '</div>'; 			
	htmlStr += '<div id="youTubeArea">';
	htmlStr += '<object width="' + vidWidth + '" height="' + vidHeight + '">';
	htmlStr += '<param name="movie" value="http://www.youtube.com/v/' + vidId + '&hl=en_US&fs=1&rel=0"></param>';
	htmlStr += '<param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>';
	htmlStr += '<embed src="http://www.youtube.com/v/' + vidId + '&autoplay=1&hl=en_US&fs=1&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="' + vidWidth + '" height="' + vidHeight + '" wmode="transparent"></embed>';
	htmlStr += '</object>';
	htmlStr += '</div>';
	htmlStr += '</div>';

	document.getElementById('flashcontent2').innerHTML = htmlStr;
	scroll(0,0);
}
function displayCloseButton(state){
	switch(state){
		case 'on':
			document.getElementById('youTubeCloseBut').style.visibility = 'visible';
			break;
		case 'off':
			document.getElementById('youTubeCloseBut').style.visibility = 'visible';
			break;
		default:
			document.getElementById('youTubeCloseBut').style.visibility = 'visible';
	}
}
function closeVid(){
	document.getElementById('flashcontent2').innerHTML = window.flashcontent2Html;
	
	
			var sspXmlFile = '/xml/content/slideShowProduct_floFormGalvanizedSteelDeckFrameComponents.xml';
			
			onerror = handleErrors
			function handleErrors(){return true;}
			var flashFile = '/flash/slideShowProducts.swf';
			var flashWidth = '342';
			var flashHeight = '500';
			var flashMin = '7';
			var flashBackground = '#ffffff';
			var ExternalFileVal = 'include/Content_Include/DynamicContentXml_' + 7402 + '.inc';
			var so = new SWFObject(flashFile,"flashFileID",flashWidth,flashHeight,flashMin,flashBackground);
			so.addParam("wmode", "transparent");
			so.addVariable("xmlfile", sspXmlFile);
			so.addVariable("ExternalFile",ExternalFileVal);
			so.write("flashcontent2");	
	
	
}

