/*
 * createFlash() by Gedi v1.3
 * @author Gedi <gedi@e-clipse.org>
 * @copyright Gedi 2007
 */

function createFlash(movie, wdth, hght, bgnd, wmode, qlty, idName, target, fVars, altImg)
{
	if (obj_setFlash = document.getElementById(target))
	{
		bgColor   = bgnd ? bgnd.replace(/#/, '0x') : "0x000000";
		flashVars = "&bgColor="+bgColor+(altImg ? "&altImg="+altImg : "")+(fVars ? "&"+fVars : "");
		if (typeof HTMLElement != "undefined")
		{
			obj = document.createElement("object");
			obj.setAttribute("data", movie);
			obj.setAttribute("type", "application/x-shockwave-flash");
			obj.setAttribute("width", wdth);
			obj.setAttribute("height", hght);
			obj.setAttribute("id", idName);
			par = document.createElement("param");
			par.setAttribute("name", "bgcolor");
			par.setAttribute("value", bgnd ? bgnd : "#000000");
			obj.appendChild(par);
			par = document.createElement("param");
			par.setAttribute("name", "wmode");
			par.setAttribute("value", wmode ? wmode : "window");
			obj.appendChild(par);
			par = document.createElement("param");
			par.setAttribute("name", "quality");
			par.setAttribute("value", qlty ? qlty : "best");
			obj.appendChild(par);
			par = document.createElement("param");
			par.setAttribute("name", "menu");
			par.setAttribute("value", "false");
			obj.appendChild(par);
			par = document.createElement("param");
			par.setAttribute("name", "scale");
			par.setAttribute("value", "noscale");
			obj.appendChild(par);
			par = document.createElement("param");
			par.setAttribute("name", "swliveconnect");
			par.setAttribute("value", "true");
			obj.appendChild(par);
			par = document.createElement("param");
			par.setAttribute("name", "FlashVars");
			par.setAttribute("value", flashVars);
			obj.appendChild(par);
			if (altImg)
			{
				par = document.createElement("img");
				par.setAttribute("src", altImg);
				par.setAttribute("alt", idName ? idName : "FlashMovie");
				par.setAttribute("title", "");
				obj.appendChild(par);
			}
			else
			{
				par = document.createTextNode(idName ? idName : "FlashMovie");
				obj.appendChild(par);
			}
			obj_setFlash.appendChild(obj);
		}
		else
		{
			objTag   = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='"+wdth+"' height='"+hght+"' id='"+idName+"'>";
			objTag2  = "<object data='"+movie+"' type='application/x-shockwave-flash' width='"+wdth+"' height='"+hght+"' id='"+idName+"'>";
			paramTag = "<param name='movie' value='"+movie+"' />"
			+"<param name='bgcolor' value='"+(bgnd ? bgnd : "#000000")+"' />"
			+"<param name='wmode' value='"+(wmode ? wmode : "window")+"' />"
			+"<param name='quality' value='"+(qlty ? qlty : "high")+"' />"
			+"<param name='menu' value='false' />"
			+"<param name='scale' value='noscale' />"
			+"<param name='swliveconnect' value='true' />"
			+"<param name='FlashVars' value='"+flashVars+"' />"
			+(altImg ? "<img src='"+altImg+"' alt='"+idName+"' title='' />" : (idName ? idName : "FlashMovie"))
			+"</object>";
			if (document.all && !window.opera) obj_setFlash.insertAdjacentHTML('beforeEnd',objTag+paramTag);
			else obj_setFlash.write(objTag+paramTag2);
		}
	}
	return;
}
