﻿// JScript File

//**************  Allow flash to work without requiring the "Click to Activate" for active X" ****************
var strBrowser = navigator.userAgent.toLowerCase(); 

//For IE Browsers as that is the only one that needs the fix
if(strBrowser.indexOf("msie") > -1 && strBrowser.indexOf("mac") < 0)
{  
    //look for object tags
    var theObjects = document.getElementsByTagName('object');  
    var theObjectsLen = theObjects.length;  
    
    var flashVars = new Array(theObjectsLen);
    
    // this doesn't seem to get only the Param in the current object
    //var theParams = theObjects[i].getElementsByTagName("param");
    var theParams = document.getElementsByTagName("param");
    var theParamsLength = theParams.length;

    var k = 0;

    for (var j = 0; j < theParamsLength; j++)  
    {    
        if(theParams[j].name.toLowerCase() == 'flashvars')
        {  
            flashVars[k] = theParams[j].value;
            k++;
        }    
    }    
    
    for (var i = 0; i < theObjectsLen; i++) 
    {   
        if(theObjects[i].outerHTML)
        {    
            if(theObjects[i].data)
            {     
                theObjects[i].removeAttribute('data');
            }    

            var theOuterHTML = theObjects[i].outerHTML;   
            var theFlashVars = flashVars[i];   
            var re = /<param name="FlashVars" value="">/ig;    
            theOuterHTML = theOuterHTML.replace(re, "<param name='FlashVars' value='" + theFlashVars + "'>");
            theObjects[i].outerHTML = theOuterHTML;   
        } 
    } 
}


//look for embed tags
theEmbed = document.getElementsByTagName("embed");

for (var i = 0; i < theEmbed.length; i++) {
    theEmbed[i].outerHTML = theEmbed[i].outerHTML;
}


window.onunload = function() 
{ 
    if (document.getElementsByTagName) 
    {  
        var objs = document.getElementsByTagName("object");  
        for (i=0; i<objs.length; i++) 
        {   
            objs[i].outerHTML = "";  
        }
    }
}