var flash = 0;
var flashversion = 0;
var version = 0;

//------------Determine if FF has Flash------------\\
if (navigator.plugins && navigator.plugins.length)
{
	x = navigator.plugins["Shockwave Flash"];
  
	if (x) {
		flash = 2;
		if (x.description) {
			y = x.description;
			flashversion = y.charAt(y.indexOf('.')-1);
		}
	} else {
		flash = 1;
  }

	if (navigator.plugins["Shockwave Flash 2.0"]) {
		flash = 2;
		flashversion = 2;
	}
} else if (navigator.mimeTypes && navigator.mimeTypes.length) {
	x = navigator.mimeTypes['application/x-shockwave-flash'];
  
	if (x && x.enabledPlugin)
		flash = 2;
	else
		flash = 1;
}

//-----------Determine if browser is IE------------\\
if (navigator.appVersion.indexOf("MSIE") != -1) {
  temp = navigator.appVersion.split("MSIE");
  version = parseFloat(temp[1]);
}

if (version >= 5.5) {
  flash = 2;
}

//--------Insert media based on browser/Flash--------\\
function media(swf, bg, x, y, img, alt) {
  if (flash == 2) {
    document.write('<script type="text/javascript">');
    document.write('VM_EmbedFlash ( \'allowScriptAccess\', \'sameDomain\', \'menu\', \'true\', \'wmode\', \'transparent\', \'codebase\', \'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\', \'width\', \''+x+'\', \'height\', \''+y+'\', \'src\', \''+swf+'\', \'quality\', \'high\', \'name\', \''+alt+'\', \'pluginspage\', \'http://www.macromedia.com/go/getflashplayer\')');
    document.write('</script>');
  } else {
    document.write('<img src="'+img+'" alt="'+alt+'"');
  } 
}
