var count = 0;
function writeFlash(values){
    if(values.src.indexOf("flv") != -1 || values.src.indexOf("mov") != -1){
        writeFLV(values);    
    }else if(values.src.indexOf("swf") != -1){
        writeSWF(values);
    }
}
function writeSWF(values){
    //this just writes SWF stuff
    document.writeln('<object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">');
    document.writeln('<param value="' + values.src + '" name="movie"/>');
    document.writeln('<param value="best" name="quality"/>');
    document.writeln('<param value="true" name="play"/>');
    document.writeln('<embed height="' + values.height + '" width="' + values.width + '" play="true" quality="best" type="application/x-shockwave-flash" src="' + values.src + '" pluginspage="http://www.macromedia.com/go/getflashplayer"/>');
    document.writeln('</object>');
}
function writeFLV(values){
    document.write('<div class="center"><div id="flash_'+ count + '"></div></div>');
    
    //from here and down is writing flash video
	
			var stageW = 500;
			var stageH = 300;
			
			var flashvars = {};
			var params = {};
			
			params.bgcolor = "#000000";
			params.allowfullscreen = "true";
			
			// note if you use this line, there are issues in IE7 (Microsoft...)
			//params.wmode = "transparent";
			
			flashvars.stageW = stageW;
			flashvars.stageH = stageH;
			
			flashvars.imagePath = "flash/thumb.jpg";
			flashvars.videoPath = values.src;
			
			// you can also play h264 files, including .mov
			// make sure you comment the line above
			//flashvars.videoPath = "video.mov";
			
			flashvars.autoStart = "false";
			flashvars.autoHide = "false";
			flashvars.autoHideTime = "3";
			flashvars.hideLogo = "true";
			flashvars.volAudio = "60";
			flashvars.disableMiddleButton = "false";
			flashvars.playSounds = "true";
			flashvars.soundBarColor = "0x32694c";
			flashvars.barColor = "0x32694c";
			flashvars.barShadowColor = "0x4a9c71";
			flashvars.subbarColor = "0xffffff";
			flashvars.extendVideo = "true";
			
			swfobject.embedSWF("flash/flvPlayer.swf", "flash_" + count, stageW, stageH, "9.0.0", "js/expressInstall.swf", flashvars, params);

	//Old Code
    
    //var flashvars = {
		//allowscriptaccess: "always",
		//allowfullscreen: 'true',
		//flashvars: '&file=' + values.src + '&controlbar=none'
	//};
	//var params = {};
	//var attributes = {};
	
	//End Old Code
	
	//make sure the id reads  <  "flash_" count  > this is so we get the correct element ID 
	//swfobject.embedSWF("flash/flvPlayer.swf", "flash_" + count, values.width, values.height, "9.0.0", false, flashvars, params, attributes);
	count++;
}
