var tmrHide = new Array();

var rgMenus = new Array();



if ( navigator.appName.toLowerCase().indexOf('explorer') != -1 && navigator.userAgent.toLowerCase().indexOf('mac') != -1 ) var undefined="undefined";



/******************************************************************

*  LFCMenu : The top-level menu object (news, mobile, etc.)       *

*                                                                 *

*  Parameters:                                                    *

*  name - The top level drop-down menu title                      *

*  x    - The x co-ordinate of this drop-down                     *

*         (0 being the left-most point of the horizontal menu-bar *

*  est  - Boolean representing whether this drop-down consists    *

*         of e-Season items                                       *

*                                                                 *

*  Functions:                                                     *

*  addItem - Adds an LFCMenuItem to the drop-down list            *

*  create  - Generates the HTML for this menu                     *

*  show    - Displays the drop-down list on-screen                *

*  hide    - Hides the drop-down list from view                   *

*                                                                 *

******************************************************************/

function LFCMenu(name,x, est)

{



  this.x=x;

  this.id = rgMenus.length;

  this.name = name;

  this.eSeason = (est == null ? false : est);

  this.items = new Array();

  this.activeMenu = false;

  this.activeItem = false;



  this.addItem = function()

  {

    this.items[this.items.length] = new LFCMenuItem(this,arguments[0],arguments[1],this.items.length,arguments[2]);

  };



  this.create = function()

  {

    document.writeln('<div id="'+this.name+'" style="position:absolute;visibility:hidden;height:1px;z-index:5">');

    document.writeln('<table style="border-top:solid 1px;border-right:solid 2px;border-left:solid 2px;border-bottom:solid 2px;border-color:#ffffff" cellspacing=0 cellpadding=2>\n');

    for ( i = 0; i < this.items.length; i++ )

        document.writeln('<tr>'+this.items[i].getHTML()+'</tr>');

    document.writeln('</table>');

    document.writeln('</div>');

  };



  this.show = function()

  {

    if ( document.all )

    {

      table = document.all['menutable'];

      bar = document.all['menubar'];

      menu = document.all[this.name];

      tableLeft = table.offsetLeft;

      lmargin = 3;

    }

    else if ( document.getElementById )

    {

      table = document.getElementById('menutable');

      bar = document.getElementById('menubar');

      menu = document.getElementById(this.name);

      tableLeft = (window.innerWidth - table.width) / 2;

      lmargin = 11;

    }

    if ( this.eSeason == true )

      menu.style.left = (tableLeft+bar.offsetLeft+this.x-menu.offsetWidth-lmargin)+"px";

    else

      menu.style.left = (tableLeft+bar.offsetLeft+this.x-lmargin)+"px";

    menu.style.top = (table.offsetHeight-4)+"px";

    this.activeMenu = true;

    menu.style.visibility = 'visible';

    for ( i = 0; i < rgMenus.length; i++ )

    {

      if ( rgMenus[i].id != this.id )

        rgMenus[i].hide(true,true);

    }

  };



  this.hide = function(active,hideItems)

  {

    if ( document.all )

      menu = document.all[this.name];

    else if ( document.getElementById )

      menu = document.getElementById(this.name);

    

    if ( active == null )

    {

      this.activeMenu = false;

      if ( !tmrHide[this.id] )

        tmrHide[this.id] = setInterval(this.name+".hide(true)",500);

      return ;

    }

    if ( hideItems != null )

      this.activeItem == false;

    if ( this.activeMenu == false && this.activeItem == false )

    {

      menu.style.visibility = 'hidden';

      if ( tmrHide[this.id] )

      {

        clearInterval(tmrHide[this.id]);

        tmrHide[this.id] = null;

      }

      return ;

    }

    if ( !tmrHide[this.id] )

      tmrHide[this.id] = setInterval(this.name+".hide(true)",500);

  };



  rgMenus[rgMenus.length] = this;



}



/******************************************************************

*  LFCMenuItem : The links underneath each top-level menu         *

*                                                                 *

*  Parameters:                                                    *

*  owner  - The top-level menu to which this belongs              *

*  name   - The link title                                        *

*  url    - The URL for this item                                 *

*  pos    - The item's position within the drop-down list         *

*                                                                 *

*  Optional Parameters:                                           *

*  win    - If the link is to open in a new pop-up window this is *

*           the window's associated name                          *

*           If "_blank" is supplied, use default parameters,      *

*           unless some are supplied                              *

*  params - If the link is to open in a new pop-up window these   *

*           are the parameters for that window                    *

*                                                                 *

*  Functions:                                                     *

*  getHTML - Produces the HTML for this link                      *

*                                                                 *

******************************************************************/

function LFCMenuItem(owner,name, url, pos, win, params)

{



  this.owner = owner;

  this.name = name;

  this.url = url;

  this.pos = pos;

  this.css = "menu";



  this.win = win;

  this.params = params;

  if ( this.params == null )

  {

    if ( this.win == "_blank" )

      this.params = ",'menubar=yes,resizable=yes,scrollbars=yes,location=yes,status=yes,toolbar=yes'";

    else

      this.params = "";

  }

  if ( this.owner.eSeason )

  {

    this.css = "est";

    if ( this.win != "this" )

    {

      this.win = "console";

      this.params = ",'width=778,height=548,scrollbars=no'";

    }

  }

  if ( this.win == "this" )

    this.win = null;



  this.getHTML = function()

  {

    if ( this.win != null )

      return '<td id="menu'+this.owner.id+'-'+this.pos+'" class="'+this.css+'Out" onMouseOver="this.className=\''+this.css+'Over\';'+this.owner.name+'.activeItem=true;" onMouseOut="this.className=\''+this.css+'Out\';'+this.owner.name+'.activeItem=false;" onMouseUp="window.open(\''+this.url+'\',\''+this.win+'\''+this.params+');"><div class="menuLink">'+this.name+'</div></td>\n';

    else

      return '<td id="menu'+this.owner.id+'-'+this.pos+'" class="'+this.css+'Out" onMouseOver="this.className=\''+this.css+'Over\';'+this.owner.name+'.activeItem=true;" onMouseOut="this.className=\''+this.css+'Out\';'+this.owner.name+'.activeItem=false;" onMouseUp="location.href=\''+this.url+'\';"><div class="menuLink">'+this.name+'</div></td>\n';

  }



}



function initMenuBar()

{

  document.writeln('<a href="javascript:;" onclick="window.open(\'/estc/premium/kickoff/\',\'new\',\'width=778,height=548\');"><img id="estlink" src="/nimages/eseasonlink.gif" width=45 height=57 style="border:0px;position:absolute;text-align:right;z-index:12;visibility:hidden" align=right></a>');

 

  menuNews = new LFCMenu("menuNews",2);

  menuNews.addItem("Latest News","/news/");

  menuNews.addItem("Features","/news/features/");

  menuNews.addItem("LFC Media Watch","/mediawatch/");

  menuNews.addItem("Views From The Kop","/news/kop_views/");

  menuNews.addItem("New Stadium","/newstadium/");

  menuNews.addItem("News Archive","/news/archivedirs/");

  menuNews.create();



  menuMatch = new LFCMenu("menuMatch",40);

  menuMatch.addItem("Fixtures &amp; Results","/match/season/");

  menuMatch.addItem("Last Match Stats","/match/last_match/");

  menuMatch.addItem("Final Whistle Report","/match/last_match/match_report/");

  menuMatch.addItem("Official Match Analysis","/match/last_match/match_analysis/");

  menuMatch.addItem("Detailed Match Stats","/match/last_match/detailedstats.htm");

  menuMatch.addItem("League Tables","/match/season/tables/");

  menuMatch.addItem("Next Match","/match/next/");

  menuMatch.addItem("Premiership Match Stats","/match/stats/premier/");

  menuMatch.addItem("Audio Commentary","/match/acommentary/");

  menuMatch.addItem("Official Magazine &amp; Programme","/match/magazine/");

  menuMatch.create();



  menuShop = new LFCMenu("menuShop",86);

  menuShop.addItem("Official Online Store","http://store.liverpoolfc.tv", "_blank");

  menuShop.addItem("New Home Kit","/newkit/");

  menuShop.addItem("New Away Kit","/newawaykit/");

  menuShop.addItem("Download e-Catalogue","/newkit/download.php3");

  menuShop.addItem("Buy e-Season Ticket","/preview/");

  menuShop.addItem("Buy Mobile Services","/mobilezone/");

  menuShop.addItem("How Low Will It Go?","/mobile/auction/");

  menuShop.addItem("LFC Internet ISP","/lfcinternet/");

  menuShop.addItem("Club Credit Card","/club/credit_card/");

  menuShop.addItem("Getty Photos","/shop/link2.htm","_blank");

  menuShop.addItem("Personalised Cards","http://www.real-print.com/ver2/index.mv?uN=liverpool","_blank");

  menuShop.addItem("e-Season Ticket Vouchers","/eseasonvoucher/");

  menuShop.addItem("LFC Savings Accounts","http://www.britannia.co.uk/lfc/nav.html", "_blank");

  menuShop.create();



  menuBetting = new LFCMenu("menuBetting",124);

  menuBetting.addItem("Ladbrokes Home","/betting/link1.htm","_blank");

  menuBetting.addItem("Football","/betting/link2.htm","_blank");

  menuBetting.addItem("Racing","/betting/link3.htm","_blank");

  menuBetting.addItem("Greyhounds","/betting/link6.htm","_blank");

  menuBetting.addItem("Casino","/betting/link5.htm","_blank");

  menuBetting.addItem('<img src="/nimages/canton1.gif" width="38" height="12" border="0">',"/betting/link4.htm","_blank");

  menuBetting.create();



  menuInteractive = new LFCMenu("menuInteractive",178);

  menuInteractive.addItem("Message Boards","/interact/message/");

  menuInteractive.addItem("Games","/interact/games/");

  menuInteractive.addItem("Wallpapers","/interact/downloads/wallpapers/");

  menuInteractive.addItem("Fans Gallery","/interact/gallery/");

  menuInteractive.addItem("Screensavers","/interact/downloads/screensavers/");

  menuInteractive.addItem("Virtual Tours","/interact/virtualtour/");

  menuInteractive.addItem("Voting","/interact/results/");

  menuInteractive.addItem("Competitions","/interact/competitions/");

  menuInteractive.addItem("Register To Win","/interact/competitions/register/");

  menuInteractive.addItem("Songs to Learn and Sing","/interact/songs/");

  menuInteractive.addItem("LFC Mail","http://www.lfcmail.co.uk","_blank");

  menuInteractive.create();



  menuMobile = new LFCMenu("menuMobile",249);

  menuMobile.addItem("Get Live Text Updates","/mobile/");

  menuMobile.addItem("Play LFC Txt Manager","/mobile/txtmanager/");

  menuMobile.addItem("LFC Mobile Zone","/mobilezone/");

  menuMobile.addItem("How Low Will It Go?","/mobile/auction/");

  menuMobile.addItem("Get Ringtones","/mobilezone/ringtonesindex.htm");

  menuMobile.addItem("Get Realtones","/mobilezone/ringtonesindex.htm#realtones");

  menuMobile.addItem("Get Colour Backgrounds","/mobilezone/backgroundsindex.htm");

  menuMobile.addItem("Get Operator Logos","/mobilezone/iconsindex.htm");

  menuMobile.addItem("Get Java Games","/mobilezone/gamesindex.htm");

  menuMobile.addItem("Get Ticket SMS Alerts","/tickets/tix.htm");

  menuMobile.create();



  menuTicket = new LFCMenu("menuTicket",296);

  menuTicket.addItem("Latest Ticket News","/tickets/info.htm");
  menuTicket.addItem("How to Apply for Tickets","/tickets/howtoapply.htm");
  menuTicket.addItem("PTS Match Tickets","/ptsonline/");
  menuTicket.addItem("e-Season Match Tickets","/tickets/sales/onlinesales.php3");
  menuTicket.addItem("The LFC Fan Card","/tickets/fancard.htm");
  menuTicket.addItem("Dates of Sale","/tickets/home_games.htm");
  menuTicket.addItem("Season Tickets","/tickets/season.htm");
  menuTicket.addItem("Getting to Anfield","/tickets/anfield.htm");
  menuTicket.addItem("Accessibility","/tickets/access.htm");   
  menuTicket.addItem("Away Travel","/tickets/away/");
  menuTicket.addItem("Development Association","/tickets/devassoc/");
  menuTicket.addItem("Hospitality","/tickets/hospitality.htm");
  menuTicket.addItem("European Travel Club","/tickets/travel_club.htm");
  menuTicket.addItem("Get Ticket SMS Alerts","/tickets/tix.htm");
  menuTicket.create();



  menuTeam = new LFCMenu("menuTeam",346);

  menuTeam.addItem("1st Team Squad Profiles","/team/squad/");

  menuTeam.addItem("1st Team Squad Stats","/team/squad/stats/");

  //menuTeam.addItem("1st Team injuries and Suspensions ","/team/absence/");

  //menuTeam.addItem("1st Team Squad Ratings","/team/squad/rate/");

  menuTeam.addItem("Youth Profiles","/team/youth/");

  menuTeam.addItem("Ladies Squad","/team/ladies/");

  menuTeam.addItem("The Academy","/team/academy/");

  menuTeam.addItem("Melwood","/team/melwood/");

  menuTeam.create();



  menuHistory = new LFCMenu("menuHistory",383);

  menuHistory.addItem("LFC Story","/lfc_story/");

  menuHistory.addItem("Hillsborough","/lfc_story/memorial/");

  menuHistory.addItem("Heysel","/lfc_story/heysel/");

  menuHistory.addItem("Honours","/lfc_story/honours/");

  menuHistory.addItem("LFC Records","/lfc_story/records/");

  menuHistory.addItem("Kop Classics","/lfc_story/classics/");

  menuHistory.addItem("Quotes","/lfc_story/quotes.htm");

  //menuHistory.addItem("Results Archive","/history/archive/index.php3");

  menuHistory.addItem("Tour and Museum","/club/tour.htm");

  menuHistory.addItem("Past Players &amp; Managers","/team/past_players/");

  menuHistory.create();



  menuClub = new LFCMenu("menuClub",427);

  menuClub.addItem("Board Of Directors","/club/board.htm");

  menuClub.addItem("Sponsors","/club/sponsors.htm");

  menuClub.addItem("Club Charter","/club/charter.htm");

  menuClub.addItem("Annual Report","/club/report.htm");

  menuClub.addItem("Anti Racism","/club/antiracism.htm");

  menuClub.addItem("Anti Hooliganism","/club/antihooliganism.htm");

  menuClub.addItem("Heathcotes at Anfield","/club/banqueting.htm");

  menuClub.addItem("Conferencing","/club/conferencing.htm");

  menuClub.addItem("Weddings","/club/weddings.htm");

  menuClub.addItem("Club Credit Card","/club/credit_card/");

  menuClub.addItem("Public Relations","/club/pr.htm");

  menuClub.addItem("LFC In the Community","/club/community.htm");

  menuClub.addItem("L'pool Disabled Supporters Assoc","/club/ldsa.htm");

  menuClub.addItem("Tour and Museum","/club/tour.htm");

  menuClub.addItem("Reduc@te","/reducate/new_reducate.htm");

  menuClub.addItem("HOLA","/reducate/");

  menuClub.addItem("Official Liverpool Supporters Club","/club/olsc.htm");

  menuClub.addItem("Association Of International Branches","/club/aib/");

  menuClub.addItem("Jobs at LFC","/club/lfcrecruitment/");

  menuClub.addItem("Soccer School","/club/soccerschool.htm");

  menuClub.addItem("HFSG","/club/hfsg.htm");

  menuClub.create();

  menuEST = new LFCMenu("menuEST",628, true);
  menuEST.addItem("Free Preview","/preview/","this");
  menuEST.addItem("Buy e-Season Ticket","/preview/","this");
  menuEST.addItem("Kick Off","/estc/premium/kickoff/");
  menuEST.addItem("Live Commentary","/estc/premium/turnstile/");
  menuEST.addItem("Turnstile Match Coverage","/estc/premium/turnstile/");
  menuEST.addItem("Turnstile Archive","/estc/premium/turnstilearchive/");
  menuEST.addItem("Webcams","/estc/premium/turnstile/");
  menuEST.addItem("Ch1: Premiership","/estc/premium/tv/channel1/");
  menuEST.addItem("Ch2: Off The Pitch","/estc/premium/tv/channel2/");
  menuEST.addItem("Ch3: Retro","/estc/premium/tv/channel3/");
  menuEST.addItem("Ch4: Dream Team","/estc/premium/tv/channel4/");
  menuEST.addItem("Ch5: Reserves and Academy","/estc/premium/tv/channel5/");
  menuEST.addItem("Ch6: Top 100's","/estc/premium/tv/channel6/");
  menuEST.addItem("Ch7: The Fans","/estc/premium/tv/channel7/");
  menuEST.addItem("e-Season Ticket Vouchers","/eseasonvoucher/","this");
  menuEST.create();
  positionEST();
}
function positionEST()
{
  if ( document.all )
  {
    table = document.all['menutable'];
    bar = document.all['menubar'];
    est = document.all['estlink'];
    est.style.left = (table.offsetLeft+590)+"px";
  }
  else if ( document.getElementById )
  {
    table = document.getElementById('menutable');
    bar = document.getElementById('menubar');
    est = document.getElementById('estlink');
    est.style.left = (((window.innerWidth - 771) / 2)+580)+"px";
  }
  est.style.top = "118px";
  est.style.visibility = "visible";
}
