// SWF Writer
// Anti-Eolas Active Content Writer for Flash Content
// (C) 2005 Nebulus Designs
// All rights Reserved
// www.nebulus.org

// usage:
// In the <HEAD>, include this script:
// <script language="javascript" type="text/javascript" src="path/to/js/swfWriters.js"></script>
//
// In the <BODY>, call writeSWF with any number of parameters
// <script language="javascript" type="text/javascript">
// writeSWF('foo.swf',100,200,'myFlash','#ffffff','false','middle','Transparent','sameDomain','7,0,0,0','var1=val1&var2=val2');
// </script>

function writeSWF(mov,w,h,id,bg,mnu,aln,wm,axs,ver,fv){
	// NOTE : All paths and flashvars must be escaped!
	// mov  : url or path to the SWF
	// w, h : width/height of the content
	// id   : name of the object within the html document.
	// bg   : background color of the content
	// mnu  : menu display - true/false
	// aln  : alignment
	// axs  : script access: sameDomain, always, never
	// ver  : version info. needs to be in the format: '6,0,0,0'
	// fv   : FlashVars in url encoded name/value pairs.

	ac  = '<object \n';
	ac += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" \n';
	ac += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + ver + '" \n';
	ac += 'width="'  + w   + '" \n';
	ac += 'height="' + h   + '" \n';
	ac += 'id="'     + id  + '" \n';
	ac += 'align="'  + aln + '">\n';
	ac += '<param name="movie" value="' + mov + '" />\n';
	if(fv != null){
		ac += '<param name="FlashVars" value="' + fv + '" />\n';
	}
	ac += '<param name="allowScriptAccess" value="' + axs + '" />\n';
	ac += '<param name="quality" value="high" />\n';
	ac += '<param name="bgcolor" value="' + bg  + '" />\n';
	if(wm != ''){
		ac += '<param name="wmode" value="transparent" />\n';
	}
	ac += '<param name="menu" value="' + mnu + '" />\n';
	ac += '<embed \n';
	ac += 'src="' + mov + '" \n';
	if(fv != null){
		ac += 'FlashVars="' + fv + '" \n';
	}
	ac += 'quality="high" \n';
	ac += 'bgcolor="'           + bg  + '" \n';
	ac += 'width="'             + w   + '" \n';
	ac += 'height="'            + h   + '" \n';
	ac += 'name="'              + id  + '" \n';
	ac += 'align="'             + aln + '" \n';
	ac += 'menu="'              + mnu + '" \n';
	ac += 'allowScriptAccess="' + axs + '" \n';
	ac += 'type="application/x-shockwave-flash" \n';
	ac += 'pluginspage="http://www.macromedia.com/go/getflashplayer" />\n';
	ac += '</object>\n';
	document.write(ac);
}