function getLeft(element)
{
  result = element.offsetLeft;
  if (element.offsetParent) result += getLeft(element.offsetParent);
  return result;
}

function getTop(element)
{
  result = element.offsetTop;
  if (element.offsetParent) result += getTop(element.offsetParent);
  return result;
}

function FormSubmit(sFormId, sSubmit, Par1, Par2, Par3)
{
  if (document.all(sFormId))
  {
    if (document.all(sFormId + "InputSubmit")) document.all(sFormId + "InputSubmit").value = sSubmit;
    if (document.all(sFormId + "InputPar1"))   document.all(sFormId + "InputPar1").value   = Par1;
    if (document.all(sFormId + "InputPar2"))   document.all(sFormId + "InputPar2").value   = Par2;
    if (document.all(sFormId + "InputPar3"))   document.all(sFormId + "InputPar3").value   = Par3;
    document.all(sFormId).submit();
  }
}

function FormEditSubmit(sSubmit, Par1, Par2, Par3)
{
  FormSubmit("FormEdit", sSubmit, Par1, Par2, Par3);
}

function FormSubmitConfirm(sMessage, sFormId, sSubmit, Par1, Par2, Par3)
{
  if (confirm(sMessage))
    FormSubmit(sFormId, sSubmit, Par1, Par2, Par3);
}

function FormEditSubmitConfirm(sMessage, sSubmit, Par1, Par2, Par3)
{
  FormSubmitConfirm(sMessage, "FormEdit", sSubmit, Par1, Par2, Par3);
}

// Проверяет целое число или нет
function CheckStrIsInt(strCheck)
{
  str = new String(strCheck);
  reNotInt = new RegExp("[^0123456789]","");
  if (str.match(reNotInt)) return 0;
  else return 1;
}

function RefreshWindow()
{
  nHeight1 = document.getElementById('Main').clientHeight;
  if (oObj = document.getElementById('Body'))
    nHeight2 = getTop(oObj) + oObj.clientHeight; else nHeight2 = 0;
  if (oObj = document.getElementById('Menu'))
    nHeight3 = getTop(oObj) + oObj.clientHeight; else nHeight3 = 0;
  nHeight = nHeight1;
  if (nHeight2 > nHeight) nHeight = nHeight2;
  if (nHeight3 > nHeight) nHeight = nHeight3;
  document.getElementById('Footer').style.top = nHeight - 80;
  document.getElementById('Footer').id = "FooterBlock";
}
