function OpenWindow(width, height, path)
{
  contact = open(path, "popup_window", "location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width="+width+",height="+height+",top=10,left=10");
  contact.focus();
}

function OpenWindowWSB(width, height, path)
{
  contact = open(path, "popup_window", "location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width="+width+",height="+height+",top=10,left=10");
  contact.focus();
}

function OpenWindowWSB2(width, height, path)
{
  contact = open(path, "popup_window", "location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width="+width+",height="+height+",top=0,left=0");
  contact.focus();
}

function DisableSubmitButton(Form)
{
  Form.elements['SubmitButton'].disabled       = true;
  document.all.divDataLoading.style.visibility = 'visible';
  document.all.divDataLoading.style.display    = 'block';
  document.all.divDataForm.style.visibility    = 'hidden';
  document.all.divDataForm.style.display       = 'none';
}

function SetPointer(theRow, thePointerColor)
{
    if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        var theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        var theCells = theRow.cells;
    }
    else {
        return false;
    }

    var rowCellsCnt  = theCells.length;
    for (var c = 0; c < rowCellsCnt; c++)
    {
      if(theCells[c].id != 'dc')
        theCells[c].style.backgroundColor = thePointerColor;
    }

    return true;
}

function ConfirmDelete(theLink, theName)
{
  ConfirmMsg = 'Вы действительно желаете удалить: ';

  var IsConfirmed = confirm(ConfirmMsg + theName + '?');
  
  if(IsConfirmed)
    theLink.href += '&IsConfirmed=1';

  return IsConfirmed;
}

function AdjustWindowToImageSize(ImageWidth, ImageHeight)
{
  var NS = (navigator.appName == "Netscape") ? true : false;
  iWidth  = (NS) ? window.innerWidth  : document.body.clientWidth; 
  iHeight = (NS) ? window.innerHeight : document.body.clientHeight; 
  
  if(ImageWidth && ImageHeight)
  {
    Width  = ImageWidth - iWidth;
    Height = ImageHeight - iHeight;
  }
  else
  {
    if(document.images[0])
    {
      Width  = document.images[0].width - iWidth;
      Height = document.images[0].height - iHeight;
    }
  }
  
  window.resizeBy(Width, Height);

  return true;
}

function OpenSplashWindow(URL, Width, Height, isMenuBar, isScrollBars, isResizable)
{
  Width = Width > 0 ? Width : 100;
  Height = Height > 0 ? Height : 100;
  Window = open(URL, "SplashWindow", "location=0,directories=0,status=0,menubar="+(isMenuBar?1:0)+",scrollbars="+(isScrollBars?1:0)+",resizable="+(isResizable?1:0)+",width="+Width+",height="+Height+",top=10,left=10");
  Window.focus();
  
}

function OpenSplashWindowAdjustedToImageSize(ImageURL, WindowCaption)
{
  WindowCaption = WindowCaption ? WindowCaption : '';
  OpenSplashWindow("/utils/splashwindowresizedbyimage/?ImageURL="+ImageURL+"&WindowCaption="+WindowCaption);
}


function OpenSplashWindowAdjustedToImageSizeP(ImageURL, WindowCaption)
{
  WindowCaption = WindowCaption ? WindowCaption : '';
  Window = open("/utils/splashwindowresizedbyimage/?ImageURL="+ImageURL+"&WindowCaption="+WindowCaption, "SplashWindow", "location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width=100,height=100,top=10,left=10");
  Window.focus();
}

