/*
ieSecurityFix
---------------
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="http://www.surepost.org.net/ieSecurityFix.js"></script>

Since this script is in response to a software patent lawsuit, I feel it necessary to state the following...	

License:
The original activateActiveX component is Copyright (C) 2006 Jason Baker (therippa AT gmail.com). It is available as open source code from:
http://therippa.blogspot.com

The modified ieSecurityFix component is Copyright (C) 2006 Michael Scott - IGD Technologies. It is available as open source:
http://www.surepost.org/ieSecurityFix.js

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
*/

var curLoadFunction = window.onload;

window.onload = new Function()
{
	if(navigator.appName == "Microsoft Internet Explorer")
	{
		//List of tags that need to be dynamically loaded.
		var replaceTags = new Array("object", "embed", "applet"); //Replace JAVA Applets as well
		
		//Loop through replacement tags
		for(var n = 0; n < replaceTags.length; n++) 
		{
			//Get the list of all tags of this type on the page
			matchedTagList = document.getElementsByTagName(replaceTags[n]);
			
			//Loop through the list of matched tags
			for(var i = 0; i < matchedTagList.length; i++)
			{
				//Retrieve the tag that contains the html for the matched tag
				parentTag = matchedTagList[i].parentNode;
				
				//Retrieve the parent tag's HTML so that we can return the code to its original state
				var parentHTML = parentTag.innerHTML;
				
				//Remove the matched tag from the page because the tag has to be dynamically loaded
				//to overcome the IE 6/7 security issue.
				parentTag.removeChild(matchedTagList[i]);
				
				//Replace the HTML that no longer contains the matched tag with the original html
				parentTag.innerHTML = parentHTML;
			}
		}
	}
	
	if(curLoadFunction != null) curLoadFunction();
}