﻿var isIE=window.ActiveXObject?true:false;

function addFlash(path,w,h,id,alt)
{
	if(flashver<8)
	{
		code=alt;
	} else
	{
		var args=addFlash.arguments,p,pos;
		var code=isIE?'<div id="flash"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" width="'+w+'" height="'+h+'" id="'+id+'"><param name="movie" value="'+path+'" />':'<div id="flash"><object type="application/x-shockwave-flash" data="'+path+'" width="'+w+'" height="'+h+'" id="'+id+'">';
		for(var x=args.length-1;x>4;x--)
		{
			p=args[x];
			pos=p.indexOf('=');
			code+='<param name="'+p.substr(0,pos)+'" value="'+p.substr(pos+1)+'" />';
		}
		code+=(alt?alt:'')+'</object></div>';
	}
	document.write(code);
}

function getFlashVer()
{
	if(isIE)
	{
		try
		{
			var fl=new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
			fl.AllowScriptAccess = 'always';
			var ver=fl.GetVariable('$version');
			if(ver)
			{
				return ver.split(' ')[1].split(',')[0];
			}
		} catch(e)
		{
		}
	} else
	{
		if (x = navigator.plugins['Shockwave Flash'])
		{
			if (y = x.description)
			{
				var p=y.indexOf('.')-1;
				var ver = y.charAt(p);
				if(parseInt(y.charAt(p-1)))
				{
					ver+=parseInt(y.charAt(p-1))*10;
				}
				return ver;
			}
		}
	}
	return 0;
}
var flashver = getFlashVer();


