﻿jQuery.fn.centerInClient = function (options) { var opt = { forceAbsolute: false, container: window, completeHandler: null }; jQuery.extend(opt, options); return this.each(function (i) { var el = jQuery(this), jWin = jQuery(opt.container), isWin = opt.container == window; if (opt.forceAbsolute) if (isWin) el.remove().appendTo("body"); else el.remove().appendTo(jWin.get(0)); el.css("position", "absolute"); var heightFudge = isWin ? 2 : 1.8, x = (isWin ? jWin.width() : jWin.outerWidth()) / 2 - el.outerWidth() / 2, y = (isWin ? jWin.height() : jWin.outerHeight()) / heightFudge - el.outerHeight() / 2; el.css("left", x + jWin.scrollLeft()); el.css("top", y + jWin.scrollTop()); opt.completeHandler && opt.completeHandler(this) }) }; function waitForPostBack() { jQuery("#siteContent").append("<div id='waitForPostBackPanel' class='ModalPopupBackground'><div id='anidiv'><img src='' id='pleaseWaitAnimation' alt='please wait'/><br>Please Wait...</div></div>"); jQuery("#waitForPostBackPanel").fadeTo(100, .4); jQuery("#waitForPostBackPanel").css("height", jQuery(window).height()); jQuery("#waitForPostBackPanel").css("width", jQuery(window).width()); jQuery("#waitForPostBackPanel").css("top", jQuery(window).scrollTop()); jQuery("#waitForPostBackPanel").css("z-index", 2e3); jQuery("#anidiv").centerInClient(); setTimeout("jQuery('#pleaseWaitAnimation').attr('src', '/images/ajax-loader.gif');", 10) }
