/*******************************************************************************/
/*                                                                             */
/* 121chef_common.js - Common Javascript                                       */
/*                                                                             */
/* (C) Copyright 2004, Keropac Computing.  All right reserved.                 */
/* Last updated: 9th April 2008                                                */
/*                                                                             */
/* Provides common javascript code for the 1-2-1 Chef website.                 */
/*                                                                             */
/*******************************************************************************/

<!-- 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>');
}

// ---------------------------------------------------------------------------
// Process "Venue" drop-down list selection.
// ---------------------------------------------------------------------------

function doVenueSelect(optionValue)

{
  switch(optionValue)
  {
    case "Salisbury" :
      createWindow('venue_01.html', 500, 400, 'yes');
      break;
      
    case "Tithe" :
      createWindow('venue_02.html', 650, 500, 'yes');
      break;
  
    case "Arreton" :
      createWindow('venue_03.html', 600, 500, 'yes');
      break;
      
    case "Horsebridge" :
      createWindow('venue_04.html', 600, 500, 'yes');
      break;
      
    case "Combe Manor" :
      createWindow('venue_05.html', 500, 600, 'yes');
      break;
      
    case "Purbrook" :
      createWindow('venue_06.html', 600, 425, 'yes');
      break;
      
    case "Arundel" :
      createWindow('venue_07.html', 600, 425, 'yes');
      break;
      
    case "The Barn" :
      createWindow('venue_08.html', 575, 550, 'yes');
      break;
      
    case "Exbury" :
      createWindow('venue_09.html', 600, 425, 'yes');
      break;
      
    case "Water Gardens" : 
      createWindow('venue_10.html', 500, 425, 'yes');
      break;
  }
     
}

// ---------------------------------------------------------------------------
// 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 -->

