
function Flash(url, v, w, h, b, m, q){ this.url=url; this.width=w; this.height=h; this.version=v; this.quality=q || "high"; this.background=b || "#ffffff"; this.wmode=m || 0; this.vars=""; this.id=url.substr(0, url.indexOf(".swf")); }

Flash.prototype.createVar=function(v, vl){ var newVar=v+"="+escape(vl); this.vars=(this.vars=="")? newVar : this.vars+"&"+newVar; }
Flash.prototype.generate=function(){ var wM=["", "opaque", "transparent"]; var comLine="<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+this.version+",0,0,0\" width=\""+this.width+"\" height=\""+this.height+"\" id=\""+this.id+"\" align=\"middle\">"; comLine+="<param name=\"allowScriptAccess\" value=\"sameDomain\" />"; if(this.vars!=""){ comLine+="<param name=\"FlashVars\" value=\""+this.vars+"\" />"; } comLine+="<param name=\"movie\" value=\""+this.url+"\" />"; comLine+="<param name=\"quality\" value=\""+this.quality+"\" />"; if(this.wmode>0){ comLine+="<param name=\"wmode\" value=\""+wM[this.wmode]+"\" />"; } comLine+="<param name=\"bgcolor\" value=\""+this.background+"\" />"; comLine+="<embed src=\""+this.url+"\" quality=\""+this.quality+"\""+((this.wmode>0)? " wmode=\""+wM[this.wmode]+"\"" : "")+" bgcolor=\""+this.background+"\" width=\""+this.width+"\" height=\""+this.height+"\" name=\""+this.id+"\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />"; comLine+="</object>"; document.write(comLine); }




/** @ignore */
String.prototype.REGEXP_FORMAT_METHOD = /\{(?:([\w_-]+)(?:\:([\w_-]+))?)\}/gim;
/**	@id compono_stringFormat */
String.prototype.format = function(args){
	var a=args||arguments;
	return this.replace(this.REGEXP_FORMAT_METHOD, function(str,parentesis1,parentesis2,index,allstr){
		var x = a[parentesis1];
		switch(parentesis2){
			case "Q":
				var v="",s="";for(var i in x){v+=s+i+"="+x[i];s="&"};x=v;
				break;
		}
		return x||"";
	});
};

function Flash(id,src,width,height,vars,allowScriptAccess,wmode,scale,salign){
	this.id=id||"Flash";
	this.src=src;
	this.width=width;
	this.height=height;
	this.vars=vars;
	this.wmode=wmode||"transparent";
	this.allowScriptAccess=allowScriptAccess||"always";
	this.scale=scale||"noscale";
	this.salign=salign||"LT";
}

Flash.prototype={
	toString:function(){return "Flash " + this.id;},
	swf:"<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"//fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"{width}\" height=\"{height}\" id=\"{id}\"><param name=\"allowScriptAccess\" value=\"{allowScriptAccess}\" /><param name=\"movie\" value=\"{src}?{vars:Q}\" /><param name=\"wmode\" value=\"{wmode}\" /><param name=\"scale\" value=\"{scale}\" /><param name=\"salign\" value=\"{salign}\" /><param name=\"quality\" value=\"high\" /><embed src=\"{src}?{vars:Q}\" quality=\"high\" width=\"{width}\" height=\"{height}\" wmode=\"{wmode}\" name=\"{id}\" allowScriptAccess=\"{allowScriptAccess}\" type=\"application/x-shockwave-flash\" pluginspage=\"//www.macromedia.com/go/getflashplayer\" scale=\"{scale}\" salign=\"{salign}\" /></object>",
	render:function(c){
		var s = this.swf.format(this);
		if(c){
			if(typeof(c)=="string")c=document.getElementById(c);
			c.innerHTML = s;
		}
		document.write(s);
	}
}



