﻿var currentSwfAddress = "";

function FlashInitialise()
{

	SWFAddress.addEventListener(SWFAddressEvent.CHANGE, FlashListen);
}

function CbcFlashEmbed(divId, cx, cy, swfFilename, wMode, bgColour, flashVars)
{
	swfobject.embedSWF(swfFilename, divId, '' + cx, '' + cy, '9.0.45', '/swf/expressInstall.swf', flashVars, {bgcolor: '' + bgColour, scale: 'scale', quality: 'best', align: 'left', salign: 'tl', menu: 'false', wmode: '' + wMode, allowscriptaccess: 'always'}, {id: '' + divId});
}

function FlashEmbed(fsp)
{

	FlashEmbedEx('flashMovie', 913, 327, fsp, 'opaque');
}

function FlashEmbedEx(divId, cx, cy, fsp, wmode)
{

	swfobject.embedSWF(fsp, divId, '' + cx, '' + cy, '9.0.45', '/images/content/expressinstall.swf', {
//	homepage carousel
		xmlPath: '/xml/carouselHome.xml', 
//	showcase carousel
//	NOTE: these should be changed, and the Flash movie implemented more cleverly.
		pathSwf: '/swf/', //	 _root._url?
		pathXml: '/xml/carouselShowcase.xml?q=',
		pathImages: '/Showcase/images/'	//	this shouldn't exist at all. The XML should provide it on a per-image basis.
	}, {
		bgcolor: '#cccccc', //	why is this set to light grey? This should be an input parameter to the function.
		scale: 'scale', 
		quality: 'best', 
		align: 'left', 
		salign: 'tl', 
		menu: 'false', 
		wmode: '' + wmode, 
		allowscriptaccess: 'always'
	}, {
		id: '' + divId
	});
}

function FlashTell(val)
{

	SWFAddress.setValue(val);
}

function FlashListen(event)
{

	if (event.path) {
		if (event.path != '/') {
			if (event.path != currentSwfAddress) {
				currentSwfAddress = event.path;
				RaisePageCommand(event.path);
				location.href = "./#" + event.path;
			} //if
		} //if
	} //if
}

