﻿// AH: similar exists in BD
function ShowAppVersionLink()
{
  ShowAppVersionLinkFF(event);
}

function ShowAppVersionLinkFF(event)
{
  // alert('!');
  if (!(event.altKey && event.ctrlKey && event.shiftKey))
    return;
  if (event.keyCode == 86 || event.keyCode == 118)
  {
    var aLink = document.getElementById('linkAppVer');
    aLink.style.zIndex = aLink.style.zIndex == 0 ? 11000 : 0;
    aLink.style.display = aLink.style.zIndex == 0 ? "none" : "block";
  }
}

if (document.all)
  document.attachEvent('onkeydown', ShowAppVersionLink)
// else document.addEventListener('keypress', ShowAppVersionLinkFF) // AH: doesn't work and is unnecessary - can be watched through View Source
;

function hideDevexTrialMsg()
{
  for (var i = 0; i < document.documentElement.childNodes[1].childNodes.length; ++i)
  {
    var div = document.documentElement.childNodes[1].childNodes[i];
    if (div.innerText.indexOf("TRIAL version") > -1)
    {
      div.style.display = "none";
      return;
    }
  }
}

function checkClientInfoMaxLength(src, maxChars, info)
{
  var i = maxChars - document.getElementById(src).value.length;
  document.getElementById(info).value = i < 0 ? 0 : i;
  document.getElementById(src).value = document.getElementById(src).value.substring(0, maxChars - 1);
}

function dotnetlike_format() {
    for (var i = 1; i < arguments.length; ++i)
        arguments[0] = arguments[0].replace('{' + (i - 1) + '}', arguments[i]);
    return arguments[0];
}
