/*
objects = document.getElementsByTagName("object");
for (var i = 0; i < objects.length; i++)
{
    objects[i].outerHTML = objects[i].outerHTML;
}
*/


// ieupdate fixed: passing FlashVars to flash does not appear from outerHTML, so need to be accessed from childnode (rather than getElementByTagName at the original version).
// the idea is the same as  rewriting objects[i].outerHTML, but if there is FlashVars, the value is rewritten.

function ieupdate()
{
	var re = /<param name="FlashVars" value="">/ig;    
	var strBrowser = navigator.userAgent.toLowerCase(); 
	if(strBrowser.indexOf("msie") > -1 && strBrowser.indexOf("mac") < 0)
	{
		var theObjects = document.getElementsByTagName("object");  
		var theObjectsLen = theObjects.length;  
		for (var i = 0; i < theObjectsLen; i++) 
		{   
			var childs = theObjects[i].childNodes;
			var childLen = childs.length;
			var theFlashVars=null;
			for (var k = 0; k < childLen; k++) 
			{
				if(childs[k].name.toLowerCase() == 'flashvars')
				{        
					var theFlashVars = childs[k].value;
				}    
			}
			var theOuterHTML = theObjects[i].outerHTML;
			if (theFlashVars)
			{
				theOuterHTML = theOuterHTML.replace(re,"<param name=\"FlashVars\" value=\"" + theFlashVars + "\">");
			}
			theObjects[i].outerHTML = theOuterHTML;  
		} 
	}
	else if(strBrowser.indexOf("opera") > -1 )
	{
		//opera browser similar to ie (got activation block and can be eliminated with the same solution), but returns FlashVars in the outerHTML - so just simply use the old code.
		//cannot reuse the above block, since opera did not recognize .name and .value of childnodes.
		objects = document.getElementsByTagName("object");
		for (var i = 0; i < objects.length; i++)
		{
			objects[i].outerHTML = objects[i].outerHTML;
		}
	}
}

/*
window.onunload = function() 
{ 
	if (document.getElementsByTagName) 
	{  
		var objs = document.getElementsByTagName("object");  
		for (i=0; i<objs.length; i++) 
		{   
			objs[i].outerHTML = "";  
		} 
	}
}*/
