Flash MX Actionscript-Javascript Question

I’m trying to get a new window to pop using existing javascipt handler which is used for all the pop-ups on a particular website. I got the window to pop using the _blank. But now I need to access the existing jscript for the pop ups.

Existing Code is:

		<script type="text/javascript" language="javascript">
	<!--
		/* simple banner rotation */
		var banners = ['GreatRate_banner.swf']
		var ix = GetCookie('SMB_BANNER_IX')
		if ( !ix || (ix >= banners.length) ) {
			ix = Math.floor(Math.random()*banners.length)
		}
		ix = parseInt(ix) // make sure ix is a number
		var banner = banners[ix]
		SetCookie('SMB_BANNER_IX', ++ix)
		if (banner) {
			var bannerHTML = '<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="352" height="52"> \
				<param name="movie" value="media/flash/' + banner + '"> \
				<param name="quality" value="high"> \
				<embed src="media/flash/' + banner + '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="352" height="52"> \
				<\/embed> \
			  <\/object>';
		}
		else {
			var bannerHTML = '<img src="images/gui/default_banner.gif" alt="" width="352" height="52" vspace="5" border="0">'
		}
		document.write(bannerHTML)
	//-->
	</script>

I need to integrate this code:

<a href=“https://www.stmarysbank.com/forms/form_begin.asp” onclick=“return popUp(‘depositAppWin’, this.href)” title=“Apply Now!” onmouseover=“roll_over(‘applyIcn’)” onmouseout=“roll_out(‘applyIcn’)” target=“depositAppWin”><img src="…/images/icons/apply.gif" alt=“Apply Now” width=“30” height=“30” align=“middle” hspace=“2” vspace=“2” name=“applyIcn” border=“0”>Apply Now!</a><br>