var scripts = document.getElementsByTagName('script');
var myScript = scripts[ scripts.length - 1 ];
var queryString = myScript.src.replace(/^[^\?]+\??/,'');

function parseQuery ( query ) {
   var Params = new Object ();
   if ( ! query ) return Params; // return empty object
   var Pairs = query.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) continue;
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
}

// GET string
var o_query = parseQuery(queryString);

var swf_url = o_query['SWF'];
var swf_w = o_query['W'];
var swf_h = o_query['H'];
var swf_flasvars = o_query['FLASHVARS'];

document.write("<OBJECT class='BSFlashAd' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH='"+swf_w+"' HEIGHT='"+swf_h+"'>");
document.write("<PARAM NAME=wmode value='Window'>");
document.write("<PARAM NAME=movie VALUE='"+swf_url+"'>");
document.write("<PARAM NAME=quality VALUE=high>");
document.write("<PARAM NAME=flashvars VALUE='"+swf_flasvars+"'>");
document.write("<EMBED class='BSFlashAd' wmode='Window' src='"+swf_url+"' quality=high WIDTH='"+swf_w+"' HEIGHT='"+swf_h+"' FLASHVARS='"+swf_flasvars+"' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/shockwave/download/index.cgi?P1_ProVersion=ShockwaveFlash'>");
document.write("</EMBED>");
document.write("</OBJECT>");
