// Please leave this comment in place
// Created by: Randy Drisgill (The Mossman)
// August 17, 2007
//
// THIS OVERRIDES THE OOTB SHAREPOINT FUNCTION WHICH CAUSES ACTIVEX INSTALL ISSUES
//
// Essentially it overrides the ootb sharepoint function which calls the activex object
// See http://support.microsoft.com/default.aspx/kb/931509 for info on the issue
//
// To use in masterpage use this syntax in the <head>:
//  	<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server"/>
//   	<script type="text/javascript" src="/_catalogs/masterpage/custom_activex_override.js"></script>


	function ProcessDefaultOnLoad(onLoadFunctionNames)
	{
		//** Uncomment this to see when this runs
		//alert('Fixing the Issue');
		
		ProcessPNGImages();
		UpdateAccessibilityUI();
		
		//** We comment out the offending ootb function
		//** and leave the rest of the functions as they were
		//ProcessImn();
		for (var i=0; i < onLoadFunctionNames.length; i++)
		{
			var expr="if(typeof("+onLoadFunctionNames[i]+")=='function'){"+onLoadFunctionNames[i]+"();}";
			eval(expr);
		}
		if (typeof(_spUseDefaultFocus)!="undefined")
			DefaultFocus();
	}

	function SearchIfEnterPressed(e, strUrl) {
	    var Ucode = e.keyCode ? e.keyCode : e.charCode;
	    if (Ucode == 13) {
	        var obj = document.getElementById("GoSearch");
	        GoSearch(strUrl);
	        return false;
	    }
	    return true;
	}

	function GoSearch(strUrl) {
	    var searchText = document.getElementById("SearchString").value;
	    searchText = searchText.replace(/\s*$/, '');
	    if (searchText == '') {
	        alert('Please enter one or more search words.');
	        if (null != event) {
	            event.returnValue = false;
	            return false;
	        }
	        else return;
	    }
	    strUrl = strUrl + "?k=" + encodeURIComponent(searchText);
	    window.location = strUrl;
	    try { if (null != event) event.returnValue = false; } catch (err) { }
	    return; 

	}

	function gotosearchpage(url) {
	    if (url == null || url.length <= 0)
	        return;
	    var F = document.forms[0];
	    F.action = url;
	    F.method = 'post';
	    F.onsubmit = function() { };
	    F.submit();
	}
