/*
  flash_write function added by rsw 10/23/2006
*/

//Uses the same random number for the call
var ran_number= Math.random() * 12;

//Makes the flash call be random to prevent caching issues
function randomize(theFile) {
	
	//Regular Expression: Determine if the file has a querystring already on it
	var querystringRegExp = /.swf\?/;
	var matchFound = theFile.search(querystringRegExp);
	
	//Now determine how we add the variable on to the file
	if (matchFound != -1) {
		//Match was found, so append to the querystring
		theFile = theFile + "&theRandomizer=" + ran_number;
	}
	else {
		//No match was found, create the querystring element
		theFile = theFile + "?theRandomizer=" + ran_number;
	}
	
	//for testing
	//alert(theFile);
	
	//Return the new value for the file
	return theFile;
}

function flash_write(file, width, height) {
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ' +
               'width="'+width+'" ' +
               'height="'+height+'" ' +
               'id="movie" >' +
               '<param name="movie" value="'+ randomize(file) +'" />' +
               '<param name="wmode" value="transparent" />' +
               '<param name="menu" value="false" />' +
               '<!--[if !IE]>' +
               '  <--> ' +
               '  <object type="application/x-shockwave-flash" data="'+ randomize(file) +'" width="'+width+'" height="'+height+'"></object>' +
               '  <!--> ' +
               '<![endif]-->' +
               '</object>');
}

