/*<%--Ask whether to delete or not?--%>*/
function AskDelete()
{
    if(confirm("Are you sure you want to delete?"))
    {
        return true;
    }
    else
    {
        return false;
    }
}
/*<%--Allow numbers entry--%>*/
function ValidateNumberOnly(e)  
{
    var keyNum, keyChar, numCheck;
    if(window.event) // IE
    {
        keyNum = e.keyCode;
    }
    else if(e.which) // Netscape/Firefox/Opera 
    {
        keyNum = e.which;
    }
    keyChar = String.fromCharCode(keyNum);
    numCheck = /[a-zA-Z]/;
    
    return !numCheck.test(keyChar);
}
/*<%--Select all check boxes of same group name--%>*/
function selectAll(ckBoxes, select)
{
    if(ckBoxes != null
        && select != null)
    {
        if(ckBoxes.length != null)
        {
            for(i = 0; i < ckBoxes.length; i++)
            {
                if(!ckBoxes[i].disabled)
                {
                    ckBoxes[i].checked = select;
                }
            }
        }
        else
        {
            if(!ckBoxes.disabled)
            {
                ckBoxes.checked = select;
            }
        }
    }
}
/*<%--when focus is on textbox and enter key is pressed then this method would be call to handle event--%>*/
function clickButton(e, buttonid)
{
  var evt = e ? e : window.event;
  var bt = document.getElementById(buttonid);
  if (bt)
  {
      if (evt.keyCode == 13)
      {
            bt.click();
            return false;
      }
  }
}
function openPopup(url, width, height)
{
    /*<%--To display a javascript popup, left and top are set to display it in the center of the screen,
        popup.focus() make the focus to the poped up window--%>*/
    popup = window.open(url, 'Nothing', 'height=' + height +'px, width=' + width + 'px, top=' + ((screen.height - height) / 2) +
                'px,left=' + ((screen.width - width) / 2) + 'px, scrollbars=yes, status=yes', false);
    if (window.focus) popup.focus();
    return false;
}

var onceClicked = false;
function Submitted(ValidationGroup)
{
    if(onceClicked)
    {
        return false;
    }
    if(Page_ClientValidate(ValidationGroup))
    {
        onceClicked = true;
    }
    else
    {
        return false;
    }
}

    if (window.event)
      document.captureEvents(Event.MOUSEUP);

    function nocontextmenu() {
//      event.cancelBubble = true, event.returnValue = false;

      return false;
    } 

    function norightclick(e) {
      if (window.event) {
        if (event.button == 2 || event.button == 3) return false;
      }
      else if (e.which == 2 || e.which == 3) {
        e.cancelBubble = true, e.returnValue = false;
        return false;
      }
    }

    if (document.layers)
      document.captureEvents(Event.MOUSEDOWN);

    document.oncontextmenu = nocontextmenu;
    document.onmousedown = norightclick;
    document.onmouseup = norightclick;