// remove click-to-activate
// version 1.0
// see http://www.howtocreate.co.uk/operaStuff/userJavaScript.html for details

//run the script as soon as possible, before the page has loaded - this is in order to try to avoid
//interupting loading of the plugin, since that may cause an unwanted flicker, and restart the download
document.addEventListener('DOMContentLoaded',function (e) {

//Set this to false if the script causes some Java applets not to appear
var doJava = true;

if( !document.body && !document.documentElement ) { return; }

//UserJS is run as part of the page (unfortuate, since they are an external script file)
//so, create a script element, and give it a data URI, so it is treated as an external script
var foo = document.createElement('script');

//the script creates a copy of each object, and replaces the original with it - it is possible this could
//occasionally break something, if a page is listening for mutation events - chances of this happening 0.0001%
foo.setAttribute('src','data:text/javascript,'+escape(

'(function () {'+

'var allTypes = [\'embed\',\'object\''+(doJava?',\'applet\'':'')+'], newOb;'+
'for( var j = 0; j < allTypes.length; j++ ) {'+
	'var allObj = document.getElementsByTagName(allTypes[j]), newOb;'+
	'for( var i = 0; i < allObj.length; i++ ) {'+
		'newOb = allObj[i].cloneNode(true);'+
		'allObj[i].parentNode.replaceChild(newOb,allObj[i]);'+
	'}'+
'}'+

'})();'));

//append the script so it runs, then immediately remove it, so it does not leave any alterations in the markup
//again, this may fire mutation events, but I doubt any page will have any problems
(document.body?document.body:document.documentElement).appendChild(foo);
(document.body?document.body:document.documentElement).removeChild(foo);

e.target.removeEventListener(e.type,arguments.callee,false);

},false);