﻿// JScript File
var nav4 = window.Event ? true : false;

function DisableStartButton(e)
{
	var elm;

	if (nav4) {
	    if (e.currentTarget) {
	        elm = e.currentTarget
	    }
	    else {
	     	elm = e.target
	    }
	} else {
		elm = event.srcElement
	}
    
    elm.style.visibility="hidden";
    
    var pleaseWaitDiv = document.createElement("div");

    
	pleaseWaitDiv.setAttribute("id","pleasewaitsplash");
	pleaseWaitDiv.innerHTML = "Please wait...";
	
	var elm_y = findPosY(elm);
	var elm_x = findPosX(elm);
	pleaseWaitDiv.style.position = 'absolute';
	pleaseWaitDiv.style.backgroundColor = 'White';
	
	var pleaseWait_x = Math.floor(elm_x + ((elm.clientWidth - 54) / 2));
	var pleaseWait_y = Math.floor(elm_y + ((elm.clientHeight - 55) / 2));
	pleaseWaitDiv.style.top = pleaseWait_y.toString() + 'px';
	pleaseWaitDiv.style.left = pleaseWait_x.toString() + 'px';
	
	document.body.appendChild(pleaseWaitDiv);

}

function runPleaseWaitPop(e, popupWidth, popupHeight) {
	DisableStartButton(e);
}

function openXtraWindow(Address,wname,HeightWidth) 
{ 
	newWin = window.open(Address,wname,HeightWidth);
}

function windowOpen(win) {
    newWin = window.open(win, "popupwin", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=550,height=500,left=15,top=15");
    newWin.focus();
}	

function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x) {
		curleft += obj.x;
	}
	return curleft;
}

function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y) {
		curtop += obj.y;
	}
	return curtop;
}

function IsInAjaxPostback() {
    if (Sys && Sys.WebForms && Sys.WebForms.PageRequestManager) {
        return Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack();
    }
    return false;
}