/*
activateActiveX
---------------
Purpose: Dynamically replace any elements that will be affected by the new security feature in IE6/IE7 that requires a user to click certain types of elements to activate them before use.

Usage: Include this file in the <head></head> section of your html document using the following...
<script language="JScript" type="text/jscript" src="activateActiveX_onload.js"></script>


Since this script is in response to a software patent lawsuit, I feel it necessary to state the following... 

License:
activateActiveX is Copyright © 2006 Jason Baker (therippa AT gmail.com). It is available as open source code from:
http://therippa.blogspot.com

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details http://www.gnu.org/licenses/gpl.html
*/

//trap onload event
window.onload = function () {
	
	//Determina o browser pois só é necessário no internet explorer
	if (navigator.appName == "Microsoft Internet Explorer") {
		
		//Cria um array dos elementos que precisam ser trocados
		var arrElements = new Array(3);
		arrElements[0] = "object";
		arrElements[1] = "embed";
		arrElements[2] = "applet";		
		
		//Procura todos os elementos de cada tipo
		for (n = 0; n < arrElements.length; n++) {
		
			//Todos os elementos de determinado tipo
			replaceObj = document.getElementsByTagName(arrElements[n]);
			
			//Varre os elementos retornados desse tipo
			for (i = 0; i < replaceObj.length; i++ ) {
			
				//set o objeto pai para brevidade
				parentObj = replaceObj[i].parentNode;
				
				//Copio o html dentro do objeto pai antes de exclui-lo
				newHTML = parentObj.innerHTML;
				
				//Apaga-se o objeto filho(o elemento que estamos procurando)
				parentObj.removeChild(replaceObj[i]);
				
				//Insere o Html novamente, como um novo objeto
				parentObj.innerHTML = newHTML;
			
			}
			
			
		}
		
			
	}
	
}