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=10,left=10");
  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 CategoriesMenuSetPointer(CategoryID, Action)
{
  try
  {
    var MenuItemImageName = 'LACategory' + CategoryID;
    var MenuItemImage     = document.getElementById(MenuItemImageName);
    var MenuItemRowName   = 'RCategory' + CategoryID;
    var MenuItemRow       = document.getElementById(MenuItemRowName);
    var RowStyle          = 'cm_inactive';
    var LAStyle           = 'la_inactive';

    if(document.images && MenuItemImage)
    {
      if(Action == 'over')
      {
        RowStyle = 'cm_active';
        LAStyle  = 'la_active';
      }

      MenuItemImage.className = LAStyle;
    }

    if(MenuItemRow)
    {
      MenuItemRow.className = RowStyle;
    }
  }
  catch(e)
  {
  }

  return true;
}

function SearchInputAction(theInput, theAction)
{
  if(theAction == 'focused')
  {
    theInput.className = 'search_input_a';

    if(theInput.value == 'поиск по каталогу')
    {
      theInput.value     = '';
    }
  }
  else if(theAction == 'blur')
  {
    if(theInput.value == '')
    {
      theInput.className = 'search_input';
      theInput.value     = 'поиск по каталогу';
    }    
  }
}

function SearchFormSubmit(theForm)
{
  var RS = theForm.elements['RequestString'];
  if(RS && (RS.value == 'поиск по каталогу'))
    RS.value = '';
}


function CheckQnt(Name)
{
  var FindDig = new RegExp("[^0-9]", "g");
  var Str = Name.value;
  Str = Str.replace(FindDig, "");
  Name.value = Str;
}

