function FlashedImageItem(DefaultImage, FlashedImage)
{
  this.Default     = new Image ();
  this.Default.src = DefaultImage;
  this.Flashed     = new Image ();
  this.Flashed.src = FlashedImage;
  return this;
}

var CoursesMenuFlashedImages = new Array();
var RightMenuFlashedImages   = new Array();

function CoursesMenuSetPointer(theCourseID, theAction)
{
  try
  {
    var MenuItemImageName = 'CoursesMenuItem' + theCourseID + 'Image';
    var MenuItemImage     = document.getElementById(MenuItemImageName);
    var MenuItemRowName   = 'CoursesMenuItem' + theCourseID + 'Row';
    var MenuItemRow       = document.getElementById(MenuItemRowName);
    var theRowStyle       = 'td_pixel_00';

    if(document.images && MenuItemImage)
    {
      if(theAction == 'over')
      {
        theRowStyle       = 'td_pixel_04';
        theLinkStyle      = 'alt_link0';
        MenuItemImage.src = CoursesMenuFlashedImages[MenuItemImageName].Flashed.src;
      }
      else
      {
        MenuItemImage.src = CoursesMenuFlashedImages[MenuItemImageName].Default.src;
      }
    }

    if(MenuItemRow)
    {
      var theCells = null;

      if(typeof(document.getElementsByTagName) != 'undefined')
      {
        var theCells = MenuItemRow.getElementsByTagName('td');
      }
      else if(typeof(MenuItemRow.cells) != 'undefined')
      {
        var theCells = MenuItemRow.cells;
      }
      
      if(theCells)
      {
        var rowCellsCnt = theCells.length;

        for(var c = 0; c < rowCellsCnt; c++)
        {
          theCells[c].className = theRowStyle;
        }
      }
    }
  }
  catch(e)
  {
  }

  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 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 DisableSubmitButtonOnly(Form)
{
  Form.elements['SubmitButton'].disabled       = 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 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);
}
