/*******************************************************************************/
/*                                                                             */
/* ehssc_common.js - Common Javascript                                         */
/*                                                                             */
/* (C) Copyright 2003, Keropac.  All right reserved.                           */
/* Last updated: 29th October 2003                                             */
/*                                                                             */
/* Provides common javascript code for the EHSSC 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>');
}

// ---------------------------------------------------------------------------
// 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';
  }
}

// ---------------------------------------------------------------------------
// Output footer.
// ---------------------------------------------------------------------------

function outputFooter(dirLevel)

{
  var footerHTML = '';
  var dirText = '';

  if (dirLevel != "root")
    dirText = '../';

  footerHTML = '<DIV ALIGN=CENTER>' +
               '<TABLE CLASS="siteFooterText" HEIGHT="25" WIDTH="450" VALIGN="MIDDLE">' +
               '<TR>' +
               '<TD>' +
               '<IMG SRC="' + dirText + 'images/gray_pixel.gif" WIDTH="510" HEIGHT="1" ALT="" BORDER="0">' +
               '</TD>' + 
               '</TR>' +
               '</TABLE>' +

               '<TABLE CLASS="siteFooterText" VALIGN="MIDDLE">' + 
               '<TR HEIGHT="12" WIDTH="450">' +
               '<TD CLASS="siteFooterText">' +
               'East Harling Sports and Social Club, Church Road, East Harling, Norfolk NR16 2NA' +
               '</TD>' + 
               '</TR>' +

               '<TR HEIGHT="12" WIDTH="450">' +
               '<TD CLASS="siteFooterText">' +
               'Telephone: 01953 718251&nbsp;&nbsp;' +
               '<IMG SRC="' + dirText + 'images/gray_pixel.gif" WIDTH="5" HEIGHT="5" ALT="" BORDER="0">&nbsp;&nbsp;' +
               'Fax: 01953 717727&nbsp;&nbsp;' +
               '<IMG SRC="' + dirText + 'images/gray_pixel.gif" WIDTH="5" HEIGHT="5" ALT="" BORDER="0">&nbsp;&nbsp;' +
               '<SCRIPT LANGUAGE="Javascript">outputMailTo(\'enquiries\', \'ehssc.org.uk\');</SCRIPT>' +
               '</TD>' + 
               '</TR>' +

               '<TR HEIGHT="30" WIDTH="450">' +
               '<TD CLASS="siteFooterText">' +
               '<A HREF="' + dirText + 'social_club/contact_us.html" TARGET="main_frame">Contact Us</A>&nbsp;&nbsp;' + 
               '<IMG SRC="' + dirText + 'images/gray_pixel.gif" WIDTH="5" HEIGHT="5" ALT="" BORDER="0">&nbsp;&nbsp;' +
               '<A HREF="#" onClick="createWindow(\'' + dirText + 'general/terms_of_use.html\', 400, 500, \'yes\'); return false;">' + 
               'Terms of Use</A>&nbsp;&nbsp;' +
               '<IMG SRC="' + dirText + 'images/gray_pixel.gif" WIDTH="5" HEIGHT="5" ALT="" BORDER="0">&nbsp;&nbsp;' +
               '<A HREF="#" onClick="createWindow(\'' + dirText + 'general/privacy_policy.html\', 400, 500, \'yes\'); return false;">' +
               'Privacy Policy</A>&nbsp;&nbsp;' +
               '<IMG SRC="' + dirText + 'images/gray_pixel.gif" WIDTH="5" HEIGHT="5" ALT="" BORDER="0">&nbsp;&nbsp;' +
               '<A HREF="' + dirText + 'general/help.html" TARGET="main_frame">Help</A>' + 
               '</TD>' + 
               '</TR>' +

               '<TR HEIGHT="20" WIDTH="450">' +
               '<TD CLASS="siteFooterText">' +
               '(C) 2003 - 2006, <A HREF="#" onClick="createWindow(\'' + dirText + 'general/copyright.html\', 500, 425, \'yes\'); return false;">' +
               'Copyright</A> East Harling Sports and Social Club. All rights reserved.' +
               '</TD>' + 
               '</TR>' +

               '</TABLE>' +
               '</DIV>'

  document.write(footerHTML);
}

// ---------------------------------------------------------------------------
// Process and handle event information.
// ---------------------------------------------------------------------------

var eventDate = new Array();
var eventDateText = new Array();
var eventText = new Array();

function eventListOutput()

{
  var eventsHTML = '';

  for (i = 0; i < eventDate.length; i++)
  {
    if (eventDate[i] >= dateValue())
    {
      eventsHTML = eventsHTML + '<DIV CLASS="woHeader">' +  
                                eventDateText[i] + 
                                '</DIV>' +
                                '<DIv CLASS="woDetail">' + 
                                eventText[i] + 
                                '</DIV>';

    }
  }

  document.write(eventsHTML);
}

function eventAdd(eDate, eDateText, eText)

{
  eventDate[eventDate.length] = eDate;
  eventDateText[eventDateText.length] = eDateText;
  eventText[eventText.length] = eText;
}

eventAdd(20070928, "Friday 28th September", "Young Bands Charity Fundraiser Night");
eventAdd(20071006, "Saturday 6th October", "The Planks");
eventAdd(20071020, "Saturday 20th October", "Jellystone");
eventAdd(20071027, "Saturday 27th October", "Hallowe'en Party with Sub Sonic Sounds");
eventAdd(20071103, "Saturday 3rd November", "Bonfire Night Disco with Sub Sonic Sounds");
eventAdd(20071110, "Saturday 10th November", "The Mellotones on tour from Holland");
eventAdd(20071124, "Saturday 24th November", "Roadhouse");
eventAdd(20071208, "Saturday 8th December", "Stella - 3 - Wheeler");
eventAdd(20071222, "Saturday 22nd December", "Christmas Party with Soul Agents");
eventAdd(20071231, "Monday 31st December", "New Years Eve Party with The Usual Suspects");

// End -->
