//
/// Repositions the UpdateProgress panel over the element that initiated an asynchronous post back.
///
function asyncPostBack_Begin(sender, args) {
// Find the position of the active element
var obj = document.activeElement;
var coors = findPosition(obj);
// Position the update progress panel near the active element
$get("UpdateProgress").style.top = coors[1] + 'px';
$get("UpdateProgress").style.left = coors[0] + 'px';
}
///
/// Intercepts and prevents duplicate form submissions.
///
function catchDuplicatePostBacks(sender, message) {
if (sender.value == message) {
alert('The server is already working on your previous request.\n\nPlease wait for the server to respond.');
sender.disabled = true;
return false;
}
else {
sender.value = message;
return true;
}
}
///
/// Closes the window and sets the windows return value to the passed value.
///
function closeWindow(value) {
window.returnValue = value;
window.close();
}
///
/// Prompts the user before closing the window.
///
function closeWindowWithConfirmation(prompt, value) {
if (confirm(prompt)) {
closeWindow(value);
}
}
///
/// Copies the passed value to the clipboard.
///
function copyToClipboard(value) {
var helper = document.createElement("textarea");
helper.appendChild(document.createTextNode(value));
var range = helper.createTextRange()
range.execCommand("Copy");
}
///
/// Returns the co-ordinates of the passed object.
///
function findPosition(obj) {
var curleft = curtop = 0;
if (obj) {
if (obj.offsetParent) {
curleft = obj.offsetLeft;
curtop = obj.offsetTop;
while (obj = obj.offsetParent) {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
}
}
return [curleft, curtop];
}
else
return [0, 0];
}
///
/// Navigates to the specified url.
///
function navigateTo(url) {
window.location = url;
}
///
/// Opens a modal pop-up window to the specified url.
///
function showModalPopup(url) {
return __showModalPopup(url, __dialogHeight, __dialogWidth);
}
///
/// Opens a pop-up window to the specification url.
///
function showPopup(url) {
return __showPopup(url, __dialogHeight, __dialogWidth);
}
/* #End Region */
//]]>