function FOD_createControl(divId, flashUrl, width, height, opt_clickTagUrl) {
  var d = document.getElementById(divId);
  if (opt_clickTagUrl) {
    flashUrl = cdUtils.updateUrlWithParam(flashUrl, "clickTAG",
        cdUtils.makeUrlAbsolute(opt_clickTagUrl));
  }
  d.innerHTML =
  '<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 + '>'
      + '<param name="movie" value="' + flashUrl + '"/>'
      + '<param name="quality" value="high"/>'
      + '<embed src=' + flashUrl
      + ' width=' + width
      + ' height=' + height
      + ' type="application/x-shockwave-flash"'
      + ' pluginspage="http://www.macromedia.com/go/getflashplayer">'
      + '</embed>'
      + '</object>';
}
function cdUtils(){};
cdUtils.updateUrlWithParam = function(oldUrl, name, value) {
  value = encodeURIComponent(value);
  name = encodeURIComponent(name);
  var nameValue = name + "=" + value;
  var nameIndex = 0;
  var oldUrlAndFragment = oldUrl.split('#');
  var oldPathAndArgs = oldUrlAndFragment[0].split('?');
  var oldUrlBase = oldPathAndArgs[0];
  var newArgs;
  if (oldPathAndArgs.length == 1) {
    newArgs = new Array();
  } else {
    newArgs = oldPathAndArgs[1].split('&');
    for (var i = 0; i < newArgs.length; i++) {
      if (newArgs[i].split('=')[0] == name) break;
    }
    nameIndex = i;
  }
  newArgs[nameIndex] = nameValue;


  var newUrl = oldUrlBase;

  for (var i = 0; i < newArgs.length; i++) {
    newUrl += ((i == 0) ? '?' : '&');
    newUrl += newArgs[i];
  }

  if (oldUrlAndFragment[1]) {
    newUrl += "#" + oldUrlAndFragment[1];
  }
  return newUrl;
};

cdUtils.makeUrlAbsolute = function(relativeUrl, opt_fakeLocation) {
  var location = opt_fakeLocation ? opt_fakeLocation : window.location;

  var start = location.protocol + "//" + location.host;
  var path = location.pathname;

  if (relativeUrl.indexOf("://") != -1) {
    return relativeUrl;
  }

  if (location.port) {
    start += ":" + location.port;
  }

  if (relativeUrl.indexOf("/") == 0) {
    return start + relativeUrl;
  }

  if (relativeUrl.indexOf("?") == 0) {
    return start + path + relativeUrl;
  }

  var relativePath = path.substring(0, path.lastIndexOf("/") + 1);

  return start + relativePath + relativeUrl;
};

