var flashInstalled = false;
var isIE = (navigator.userAgent.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.userAgent.indexOf("Win") != -1) ? true : false;

if (navigator.plugins && navigator.plugins.length){
	var x = navigator.plugins["Shockwave Flash"];
	if (x){
		if (x.description){
			y = x.description;
			var flashVersion = y.charAt(y.indexOf('.')-1); //checks flash version
			if (flashVersion>=6){ //checks for version 6 and above.\
				flashInstalled = true;
			}
		}
	}
}

if(isIE && isWin){ //can't read from plugins array on ie pc...
	document.write('<scr' + 'ipt language=VBScript> \n');
	document.write('on error resume next \n');
	document.write('flashInstalled = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
	document.write('flashInstalled = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
	document.write('flashInstalled = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');
	document.write('<\/scr' + 'ipt> \n');
}


function flashfix() {
	theObjects = document.getElementsByTagName("object");
	for (var i = 0; i < theObjects.length; i++) {
		theObjects[i].outerHTML = theObjects[i].outerHTML;
	}
}

function writeflash(moviename,path,width,height,backcolor,windowmode,align) {
	  document.write("      <object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"" + width +"\" height=\"" + height +"\" id=\"top\" align=\"middle\">\n");
	  document.write("        <param name=\"allowScriptAccess\" value=\"sameDomain\" />\n");
	  document.write("        <param name=\"movie\" value=\"" + path +"\" />\n");
	  document.write("        <param name=\"quality\" value=\"high\" />\n");
	  document.write("        <param name=\"bgcolor\" value=\"" + backcolor +"\" />\n");
	  document.write("        <embed src=\"" + path +"\" quality=\"high\" bgcolor=\"" + backcolor +"\" width=\"" + width +"\" height=\"" + height +"\" name=\"" + moviename +"\" align=\"" + align +"\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />\n");
          document.write("      </object>\n");
}