function FlashedImageItem(DefaultImage, FlashedImage)
{
  this.Default     = new Image ();
  this.Default.src = DefaultImage;
  this.Flashed     = new Image ();
  this.Flashed.src = FlashedImage;
  return this;
}

var RightMenuFlashedImages = new Array();

function SetPointer(theRow, thePointerStyle)
{
  if(thePointerStyle == '' || 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++)
  {
    theCells[c].className = thePointerStyle;
  }

  return true;
}

/*
  theAction - [over|out]
*/

function RightMenuSetPointer(theRow, theAction, theMenuItemID)
{
  var thePointerStyle;
  var MenuItemImage   = 'RightMenuItem' + theMenuItemID + 'Image';
  var MenuItemLink    = 'RightMenuItem' + theMenuItemID + 'Link';
  var theMenuItemLink = document.getElementById(MenuItemLink);

  if(thePointerStyle == '' || 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;

  if(theAction == 'over')
  {
    thePointerStyle = 'right_menu_item_dark';
    
    if(theMenuItemLink)
      theMenuItemLink.className = 'right_menu_link_a';

    if(document.images)
      document.images[MenuItemImage].src = RightMenuFlashedImages[MenuItemImage].Flashed.src;
  }
  else
  {
    thePointerStyle = 'right_menu_item_light';
    
    if(theMenuItemLink)
      theMenuItemLink.className = 'right_menu_link';

    if(document.images)
      document.images[MenuItemImage].src = RightMenuFlashedImages[MenuItemImage].Default.src;
  }

  for(var c = 0; c < rowCellsCnt; c++)
  {
    theCells[c].className = thePointerStyle;
  }

  return true;
}

function RightMenuClick(theLink)
{
  document.location.href = theLink;
  return true;
}

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=100,left=150");
  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=100,left=150");
  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 SearchInputAction(theInput, theAction)
{
  if(theAction == 'focused')
  {
    theInput.className = 'top_search_line_a';

    if(theInput.value == 'поиск по сайту')
    {
      theInput.value     = '';
    }
  }
  else if(theAction == 'blur')
  {
    if(theInput.value == '')
    {
      theInput.className = 'top_search_line';
      theInput.value     = 'поиск по сайту';
    }    
  }
}

function SearchFormSubmit(theForm)
{
  var RS = theForm.elements['RequestString'];
  if(RS && (RS.value == 'поиск по сайту'))
    RS.value = '';
}
