// Please leave this comment in place
// Created by: Randy Drisgill
// 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();
}	


// This code will fix the edit in datasheet view problem that can happen with custom mp's
// http://blog.drisgill.com/2009/06/edit-in-datasheet-causes-ie-to-crash.html

function GCComputeSizing(GCObject) 
{ 
if (TestGCObject(GCObject)) 
{ 
  var fBIDI=(document.documentElement.currentStyle.direction=="rtl"); 
  var lGCWindowWidth=document.documentElement.scrollWidth; 
  var lGCWindowHeight=(document.documentElement.scrollHeight>document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.documentElement.scrollHeight;

  var lGCObjectOffsetLeft=0; 
  var lGCObjectOffsetTop=0; 
  if (fBIDI) 
   { 
   lGCObjectOffsetLeft=-180; 
   lGCObjectOffsetTop=120; 
   } 
  else 
   { 
   lGCObjectOffsetLeft=32; 
   lGCObjectOffsetTop=-2; 
   } 
  var lGCObjectWalker=GCObject.parentElement; 
  while (lGCObjectWalker !=document.body) 
  { 
   lGCObjectOffsetLeft+=lGCObjectWalker.offsetLeft; 
   lGCObjectOffsetTop+=lGCObjectWalker.offsetTop; 
   lGCObjectWalker=lGCObjectWalker.offsetParent; 
   if (fBIDI) 
    if (lGCObjectWalker.offsetLeft > 0) 
     break; 
  } 
  lGCObjectOffsetLeft+=GCObject.parentElement.offsetLeft; 
  lGCObjectOffsetTop+=GCObject.parentElement.offsetTop; 
  glGCObjectHeight=lGCWindowHeight - lGCObjectOffsetTop; 
  if (glGCObjectHeight > lGCWindowHeight) 
   glGCObjectHeight=lGCWindowHeight 
  if (glGCObjectHeight < cGCMinimumHeight)f 
   glGCObjectHeight=cGCMinimumHeight; 
  if (fBIDI) 
   { 
   glGCObjectWidth=lGCWindowWidth+lGCObjectOffsetLeft; 
   } 
  else 
   glGCObjectWidth=lGCWindowWidth - lGCObjectOffsetLeft; 
  if (glGCObjectWidth > lGCWindowWidth) 
    glGCObjectWidth=lGCWindowWidth; 
  if (glGCObjectWidth < cGCMinimumWidth) 
   glGCObjectWidth=cGCMinimumWidth; 
} 
}
