i'm embedding some flash in a webpage - but it's a template based system and the different swf files will need to be shown at different sizes on different pages.

The file names will be like: monkey_dance_150_100.swf

so I wrote the following javascript as a test:
HTML Code:
	function getDimension(filename, dimension) {
		var file_array = filename.split("_");
		if (dimension = 'W') {
			alert(file_array[file_array.length - 2]);
		} else if (dimension = 'H') {
			alert(file_array[file_array.length - 1]);		
		}
	}
and attempted to use it such ({section.image} is just the file name - it gets parsed by the template language first):
HTML Code:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="javascript:getDimension('{section.image}', 'W')" height="javascript:getDimension('{section.image}', 'H')">
	<param name=movie value="{section.image}">
	<param name=quality value=high>
	<param name=wmode value=transparent>
	<embed src="{section.image}" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="javascript:getDimension('{section.image}', 'W')" height="javascript:getDimension('{section.image}', 'H')">
	</embed>
</object>
that didn't do anything. i just want it to show the parsed values at the moment (i know it wasn't returning anything)

presumably that didn't work because there isn't an event triggering the code to run - so how should i go about this?