function SetVerticalMiddle(element)
{
//Derived from http://www.asp.net/AJAX/AjaxControlToolkit/Samples/AlwaysVisibleControl/AlwaysVisibleControl.aspx AjaxControlToolkit.VerticalSide.Middle
var y = 0;
// Compute the width and height of the client
// var CommonToolkitScripts = new AjaxControlToolkit._CommonToolkitScripts();
// var clientBounds = CommonToolkitScripts.getClientBounds();
// debugger;
// var width = clientBounds.width;
var height = getClientHeight();//clientBounds.height;
if (document.documentElement && document.documentElement.scrollTop) {
// x = document.documentElement.scrollLeft;
y = document.documentElement.scrollTop;
}
else {
// x = document.body.scrollLeft;
y = document.body.scrollTop;
}
// Compute the coordinates
// x = Math.max(0, Math.floor(x + width / 2.0 - element.offsetWidth / 2.0 ));
y = Math.max(0, Math.floor(y + height / 2.0 - element.offsetHeight / 2.0 ));
// element.style.left = x + 'px';
element.style.top = y + 'px';
}
//copied from AjaxControlToolkit\Common\Common.js, fix from http://forums.asp.net/p/1002123/1323677.aspx#1323677
function getClientHeight() {
/// <summary>
/// Gets the height of the browser client window (excluding scrollbars)
/// </summary>
/// Browser's client height
/// </returns>
// var clientWidth;
var clientHeight;
switch(Sys.Browser.agent) {
case Sys.Browser.InternetExplorer:
// if (document.documentElement && document.documentElement.clientWidth)
// clientWidth = document.documentElement.clientWidth;
// else if (document.body)
// clientWidth = document.body.clientWidth;
if (document.documentElement && document.documentElement.clientHeight)
clientHeight = document.documentElement.clientHeight;
else if (document.body)
clientHeight = document.body.clientHeight;
break;
// clientWidth = document.documentElement.clientWidth;
clientHeight = document.documentElement.clientHeight;
break;
case Sys.Browser.Safari:
// clientWidth = window.innerWidth;
clientHeight = window.innerHeight;
break;
case Sys.Browser.Opera:
// clientWidth = Math.min(window.innerWidth, document.body.clientWidth);
clientHeight = Math.min(window.innerHeight, document.body.clientHeight);
break;
default: // Sys.Browser.Firefox, etc.
// clientWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);
clientHeight = Math.min(window.innerHeight, document.documentElement.clientHeight);
break;
}
return clientHeight;//new Sys.UI.Bounds(0, 0, clientWidth, clientHeight);
}