/*
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 at the end of your html document using the following...
	<script language="JScript" type="text/jscript" src="activateActiveX.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 (C) 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
*/

/*
//Determine browser, we only need this for Internet Explorer
if (navigator.appName == "Microsoft Internet Explorer") {
	
	//Array of elements to be replaced
	var arrElements = new Array(3);
	arrElements[0] = "object";
	arrElements[1] = "embed";
	arrElements[2] = "applet";

	
	//Loop over element types
	//alert(arrElements.length);
	
	for (n = 0; n < arrElements.length; n++) {
	    //alert(arrElements[n]);
		//set object for brevity
		replaceObj = document.getElementsByTagName(arrElements[n]);
		
		
		//loop over element objects returned
		for (i = 0; i < replaceObj.length; i++ ) {
		
			//set parent object for brevity
			parentObj = replaceObj[i].parentNode;
			
			//grab the html inside of the element before removing it from the DOM
			newHTML = parentObj.innerHTML;
			
			//remove element from the DOM
			parentObj.removeChild(replaceObj[i]);
			
			//stick the element right back in, but as a new object
			parentObj.innerHTML = newHTML;
		
			}
			
		}
	}
	
window.onunload = function()
{ 
 if (document.getElementsByTagName)
 {  
    var objs = document.getElementsByTagName("object"); 
    for (i=0; i<objs.length; i++)
    {  
    objs[i].outerHTML = "";
    }
 }
}
*/


//function ieupdate()
//    {
    var strBrowser = navigator.userAgent.toLowerCase(); 
    if(strBrowser.indexOf("msie") > -1 && strBrowser.indexOf("mac") < 0)
        {  
        //alert(strBrowser);
        
        //Array of elements to be replaced
	var arrElements = new Array(3);
	arrElements[0] = "object";
	arrElements[1] = "embed";
	arrElements[2] = "applet";

	
	//Loop over element types
	//alert(arrElements.length);
	
	for (n = 0; n < arrElements.length; n++) 
	    {
	    //alert(arrElements[n]);
		//set object for brevity
		//replaceObj = document.getElementsByTagName(arrElements[n]);
        
            var theObjects = document.getElementsByTagName(arrElements[n]);
            var theObjectsLen = theObjects.length;  
            for (var i = 0; i < theObjectsLen; i++) 
            {   
		var ElementID = theObjects[i].id.toLowerCase();
		if(theObjects[i].outerHTML && ElementID.substring(0,6) != "viewer")
                {    
                    if(theObjects[i].data)
                        {     
                            theObjects[i].removeAttribute('data'); 
                        }    
                    var theParams = theObjects[i].getElementsByTagName("param"); 
                    var theParamsLength = theParams.length;   
                    for (var j = 0; j < theParamsLength; j++) 
                    {    
                        if(theParams[j].name.toLowerCase() == 'flashvars')
                            {
                                var theFlashVars = theParams[j].value;   
                            }  
                    }  
                    var theOuterHTML = theObjects[i].outerHTML;  
                    var re = /<param name="FlashVars" value="">/ig;  
                    theOuterHTML = theOuterHTML.replace(re,"<param name='FlashVars' value='" + theFlashVars + "'>");   
                    theObjects[i].outerHTML = theOuterHTML;  
                } 
            } 
        }
        }
//    }
                
window.onunload = function()
{
    if (document.getElementsByTagName)
        {  
            var objs = document.getElementsByTagName("object");
            for (i=0; i<objs.length; i++)
                { 
                    objs[i].outerHTML = ""; 
                }
        }
}

function ResizeMainToolbar()
{
if (document.getElementById("PageMainToolbar"))
    {
    var x,y;
    var scrollbarwidth = 0;
    if (self.innerHeight) // all except Explorer
    {
    	x = self.innerWidth;
    	y = self.innerHeight;
    	if (document.body.scrollHeight > document.body.clientHeight) { scrollbarwidth = 16; } else { scrollbarwidth = 0; } 
    }
    else if (document.documentElement && document.documentElement.clientHeight)
    	// Explorer 6 Strict Mode
    {
    	x = document.documentElement.clientWidth;
    	y = document.documentElement.clientHeight;
    }
    else if (document.body) // other Explorers
    {
    	x = document.body.clientWidth;
    	y = document.body.clientHeight;
    }
    var vscroll = document.body.scrollTop;
    document.getElementById("PageMainToolbar").style.position = "absolute";
    document.getElementById("PageMainToolbar").style.left=0;
    document.getElementById("PageMainToolbar").style.width = x -  scrollbarwidth;  
    document.getElementById("PageMainToolbar").style.top = y - 63 + vscroll;
    }
}


function ShowWorkFlowHolder(object)
{
object.style.zindex=500;
}

function HideWorkFlowHolder(object)
{
object.style.zindex=100;
}

ResizeMainToolbar();

function HideMainToolbar()
{
document.getElementById("PageMainToolbar").style.visibility = "hidden";
alert("hide");
}
function ShowMainToolbar()
{
document.getElementById("PageMainToolbar").style.visibility = "visible";
alert("show");
}
