//
//Write-Flash Include - version 2.0
//By: Joey Fowler
//
//Using a javascript call, you can display a flash file inside a div of your choice!
//If the user doesn't have flash, or a more recent version, this include will attemp
//to automatically update their flash (if expressInstall is true), and if anything
//else, it will simply display what is currently in the div tag!


<!--
	// if this variable is true, it will allow the website to 'auto-update' a users
	// flash without leaving the site; false obviously will not, and it may not display
	// on older versions, so setting to true is reccommended
	var expressInstall = new Boolean(true);
	// the path to the express install file
	var expressInstallPath = new String('expressinstall.swf');
	// redirect to this page after updated
	// leave blank/commented out to remain on current page
	// also, it MUST be an absolute link (ex: 'http://www.example.com/upgradecomplete.php')
	var expressInstallRedirect = new String('');
	
	
	// function to replace the specified div with the specified flash file using code from SWFObject()
	// required: flash_file, width, height
	// optional: div_id, flash_id, version, bg_color, quality, wmode, align, salign, scale, menu, swliveconnect, arVariables
	//
	// for a complete list of attributes: http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_12701&sliceId=1
	function write_flash(flash_file, width, height, div_id, flash_id, version, bg_color, quality, wmode, align, salign, scale, menu, swliveconnect, arVariables) {
		if ((flash_file == null) || ((width == null) || (width == 0)) || ((height == null) || (height == 0)))
			alert('Cannot write flash! Invalid parameters passed.');
		else {
			if ((div_id == null) || (div_id == ''))
				div_id = 'flashcontent';
			if ((flash_id == null) || (flash_id == ''))
				flash_id = 'flash_object';
			if ((version == null) || (version == ''))
				version = '';
			if ((quality == null) || (quality == ''))
				quality = 'high';
			
			var flash_obj = new SWFObject(flash_file, flash_id, width, height, version, bg_color);
			
			flash_obj.addParam("quality", quality);
			if (wmode != null)
				flash_obj.addParam("wmode", wmode);
			if (align != null)
				flash_obj.addParam("align", align);
			if (salign != null)
				flash_obj.addParam("salign", salign);
			if (scale != null)
				flash_obj.addParam("scale", scale);
			if (menu != null)
				flash_obj.addParam("menu", menu);
			if (swliveconnect != null)
				flash_obj.addParam("swliveconnect", swliveconnect);
			
			if (expressInstall)
				flash_obj.useExpressInstall(expressInstallPath);
			if (expressInstallRedirect != '')
				flash_obj.setAttribute('xiRedirectUrl', expressInstallRedirect);
				
			if (arVariables != null) {
				for (i=0; i < arVariables.length; i++) {
					// loops thru the array of passed variables and adds them to the flash file
					// [i][0] = Variable Name
					// [i][1] = Variable Value
					flash_obj.addVariable(arVariables[i][0], arVariables[i][1]);
				}
			}				

			flash_obj.write(div_id);
		}
	}
//-->
