/*******************************************************************************/
/*                                                                             */
/* common.js - Common Javascript                                               */
/*                                                                             */
/* (C) Copyright 2004, Keropac Computing.  All right reserved.                 */
/* Last updated: 29th October 2003                                             */
/*                                                                             */
/* Provides common javascript code for ALL websites.                           */
/*                                                                             */
/*******************************************************************************/

<!-- Begin

// ---------------------------------------------------------------------------
// Highlight an image.
// ---------------------------------------------------------------------------

function highlightImage(imageName, flag)

{
  eval('elementName = document.' + imageName);

  if (flag == 0)
    elementName.src = '../images/' + imageName + '.gif'
  else
    elementName.src = '../images/' + imageName + '_x.gif';
}

// ---------------------------------------------------------------------------
// Restrict input field length.
// ---------------------------------------------------------------------------

function checkInputLength(fieldName, maxLimit)

{
  if (fieldName.value.length >= maxLimit)
  {
    fieldName.value = fieldName.value.substring(0, maxLimit - 1);
    return false;
  }
}

// ---------------------------------------------------------------------------
// Create new window.
// ---------------------------------------------------------------------------

function createWindow(filename, width, height, scrollbars)

{
  newWindow = window.open(filename, "newWindow", "width=" + width + ",height=" + height + ",directories=no,location=no,menubar=no,scrollbars=" + scrollbars + ",status=no,toolbar=no,resizable=no");
}

// ---------------------------------------------------------------------------
// Output email address.
// ---------------------------------------------------------------------------

function outputMailTo(user, domain)

{
  document.write('<A HREF=\"mailto:' + user + '@' + domain + '\">');
  document.write(user + '@' + domain + '</A>');
}

// ---------------------------------------------------------------------------
// Check page is within frames.
// ---------------------------------------------------------------------------

function framesCheck(dirLevel)

{
  if (parent.location.href == self.location.href) 
  {
    if (dirLevel == "main")
      window.location.href = 'index.html'
    else
      window.location.href = '../index.html';
  }
}

// End -->
