/* Eolas ActiveX fix.
 * This only affects MSIE 5+.
 * The mime-type of this script is <code>text/jscript</code>.
 * This ensures that only MSIE will execute it. 
 * Note that for some reason the <param> tags don't actually 
 * exist when using innerHTML and outerHTML.
 * Otherwise we could just do:
 *    var o = document.getElementsByTagName('object');
 *    o[i].outerHTML = o[i].outerHTML;
 * Unfortunately Node.cloneNode copies the inactive state of the 
 * object too, thus we can't do this:
 *    var o = document.getElementsByTagName('object');
 *    o[i].parentNode.replaceChild( o[i], o[i].cloneNode(true) );
 * 
 * This only works on W3C compliant object tags that do not nest.
 */
function eolas(id) {
	var o = document.getElementById(id);
	var e = document.createElement(o.tagName);
	// clone PARAMs
	for(var i=0; i<o.childNodes.length; i++) {
		if (o.childNodes[i].tagName == 'PARAM') {
			e.appendChild(o.childNodes[i].cloneNode(true));
		}
	}
	e.altHTML = o.altHTML;
	// clone attributes 
	// type (or classid) must be set last
	if (o.getAttributeNode("id")) e.setAttribute("id", o.getAttribute("id"));
	if (o.getAttributeNode("width")) e.setAttribute("width", o.getAttribute("width"));
	if (o.getAttributeNode("height")) e.setAttribute("height", o.getAttribute("height"));
	if (o.getAttributeNode("wmode")) e.setAttribute("wmode", o.getAttribute("wmode"));
	//if (o.getAttribute("data")) e.setAttribute("data", o.getAttribute("data"));
	if (o.getAttributeNode("type")) e.setAttribute("type", o.getAttribute("type"));
	if (o.getAttributeNode("classid")) e.setAttribute("classid", o.getAttribute("classid"));
	o.replaceNode(e);
	e = null;
	o = null;
	return false;
}

/* Adobe Flash 9 and IE6 ExternalInterface fix */
function unloadFlash(event) {
	window.onunload = null;
}

