// IE Flash Error Workaround, not external JS to make sure its loader right away
if(window.attachEvent) {
  window.attachEvent("onbeforeunload",ubRemoveFlash);
  function ubRemoveFlash() {
    var arr = document.all.tags("object");
    if (arr && arr.length) {
      for (var i=arr.length-1; 0<=i; i--) {
        arr[i].removeNode(true);
      }
    }
  }
}

// Better support for CMS Flash Embed in IE
function writeFlash(p) {
  if(document.writeFlashId == undefined) document.writeFlashId = 0;
  document.writeFlashId += 1;
  id = "writeFlash_" + document.writeFlashId;
  document.write("<span><div id='" + id + "'><p><strong>Please install Flash&reg; and turn on Javascript.</strong></p></div></span>");
  attrs = {};
	flashvars = {};
	options = {};
  // split out attributes that should go on the object tag itself
  ['base', 'name', 'id', 'align','hspace','vspace'].each(function(k) {
    if(p[k] != undefined) {
      attrs[k] = p[k]
      delete p[k]
    }
  });
	['width', 'height', 'src'].each(function(k) {
		options[k] = p[k]
		delete p[k]
	});
  swfobject.embedSWF(options.src, id, options.width, options.height, "9", null, flashvars, p, attrs );
}

function openWindow(openThis, widthThis, heightThis, labelThis, ResizeYesOrNo){
   var windowW = widthThis;
   var windowH = heightThis;

   var url = openThis;

   options = "scrollbars=yes,resizable="+ResizeYesOrNo+",width="+windowW+",height="+windowH;

   info = window.open(url, labelThis, options);

   info.focus();
}
