function FocusControl(ctrlID)
{
    var ctrl = document.getElementById(ctrlID); 
    if(ctrl!=null)
        ctrl.focus();
}

function ShowCalendar(ctrlID, appPath)
{
    var ctrl = document.getElementById(ctrlID);
    if (ctrl==null)
	    return;
	    
	var retVal = window.showModalDialog(appPath + 'Calendar.aspx?date='+ctrl.value,null,'dialogWidth:206px;dialogHeight:212px;dialogLeft:'+event.screenX+';dialogTop:'+event.screenY+';help:0;status:0;resizeable:0;scroll:0;');
	if(retVal!=null)
		ctrl.value = retVal;
}

function ShowPopUp(pageURL,pageName, width, height)
{	
	window.open("http://results.tokudabolnica.bg/Reports/ActivityGraph.aspx", pageName, "height="+height+"px width="+width+"px location=0 menubar=0 resizable=1 scrollbars=1 toolbar=0 status=0 left=100 top = 50");
	return false;
}
function Cover(bottom, top, ignoreSize) {
    var location = Sys.UI.DomElement.getLocation(bottom);
    top.style.position = 'absolute';
    top.style.top = location.y + 'px';
    top.style.left = location.x + 'px';
    if (!ignoreSize) {
        top.style.height = bottom.offsetHeight + 'px';
        top.style.width = bottom.offsetWidth + 'px';
    }
}
function ErrorMsg() {
    return 'Сървърът е натоварен. Опитайте след няколко минути.'
}

/*
function Abort(){
    if(Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()){
        //  abort the postback
        Sys.WebForms.PageRequestManager.getInstance().abortPostBack();
    }
}

var prm = Sys.WebForms.PageRequestManager.getInstance()
prm.add_beginRequest(onBeginRequest);

function onBeginRequest(sender, args) {
  setTimeout("Abort();",30000);
}
*/
/*
var pbControl = null;
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_beginRequest(BeginRequestHandler);
prm.add_endRequest(EndRequestHandler);
function BeginRequestHandler(sender, args) {
    pbControl = args.get_postBackElement();  //the control causing the postback
    pbControl.disabled = true;
}
function EndRequestHandler(sender, args) {
    pbControl.disabled = false;
    pbControl = null;
}*/