/*
Format for HTML:
<script language="Javascript" type="text/javascript">
writeFlash('path/to/flash.swf',width,height,'<img src="alernate/static/img.jpg">');
</script>
*/

function writeFlash(fpath,w,h,alt) {
	
	var alternateContent = alt ? alt : 'Some content on this page requires the latest <a href=\"http://www.macromedia.com/go/getflashplayer\">Flash Player</a>.';

	var fpath = fpath.replace(/.swf/,'');
	var fname = fpath.split('/').pop();

	if (AC_FL_RunContent == 0 || DetectFlashVer == 0) {
		alert("This page requires AC_RunActiveContent.js.");
	} else {
		var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
		if(hasRightVersion) {  // if we've detected an acceptable version
			// embed the flash movie
			AC_FL_RunContent(
				'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+ requiredMajorVersion + ',0,0,0',
				'width', w,
				'height', h,
				'src', fpath,
				'quality', 'high',
				'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
				'align', 'middle',
				'play', 'true',
				'loop', 'true',
				'scale', 'showall',
				'wmode', 'transparent',
				'devicefont', 'false',
				'id', fname,
				'bgcolor', '#ffffff',
				'name', fname,
				'menu', 'true',
				'allowScriptAccess','sameDomain',
				'allowFullScreen','false',
				'movie', fpath,
				'salign', ''
				); //end AC code
		} else {  // flash is too old or we can't detect the plugin
			document.write(alternateContent);  // insert non-flash content
		}
	}



}

