/*
  Dog Biscuit's "Yes & Led Zeppelin Trading Pages"
  Common Utility Functions
  Rev. 1.032 : 19 November 2004
  Copyright (C) 2001-2004 by JMK
  All rights reserved worldwide

  NOTES
  =====
*/

optBandPix     = 0x00000002;
optTourPix     = 0x00000004;
optTours       = 0x00000008;
optTitlePix    = 0x00000010;
optTitles      = 0x00000020;
optCatNumbers  = 0x00000040;
optDetails     = 0x00000080;
optAdverts     = 0x00000100;
optSortByCat   = 0x00000200;
optSilent      = 0x80000000;

optMask        = 0x800003FE;
optSystem      = optSilent;
optUser        = optMask & ~optSystem;

optContent     = optTours | optTitles;
optHomePage    = optBandPix | optTourPix | optAdverts;
optDefault     = optUser & ~(optCatNumbers | optSortByCat);
optFullText    = optDefault & ~optTitlePix;
optListPage    = (optFullText | optCatNumbers) & ~optDetails;
optThumbnails  = optHomePage | optTours | optTitlePix;
optCatalog     = optBandPix | optTitles | optSortByCat;

optExpandTitle = optTitlePix | optDetails;
optExpandTour  = optContent | optExpandTitle | optCatNumbers;

any = '-- Any --';

var params;
var adsFormat = 0;

function Band(aName, aLogo, anIcon, aWebsite)
{
  this.name = aName;
  this.logo = aLogo;
  this.icon = anIcon;
  this.website = aWebsite;
}

function consolidate_params()
{
  if (params.opt == null)
    params.opt = optDefault - 0;
}

function get_link(aBand, aTour)
{
  return aBand + (aTour ? '_' + aTour : '') + '.htm';
}

function get_path(aFileName, aResolution)
{
  var result = 'images/';
  if (aResolution)
    result += 'thumbs/' + aResolution + '/';
  result += aFileName > '' ? aFileName : 'CoverUnderConstruction.gif';
  if (result.indexOf('.') < 0)
    result += '.jpg';
  return result;
}

function new_ads()
{
  function new_amazon_com(anAlign)
  {
    return '<A target=_blank HREF="http://www.amazon.com/exec/obidos/redirect-home/yesmanstradin-20">\r\n' +
      '<IMG SRC="images/amazon_com_muan120.gif" BORDER="0"\r\n' +
      'alt="In Association with Amazon.com" align="' + anAlign + '" hspace="0" width="120" height="60"></A>\r\n';
  }
  function new_amazon_co_uk(anAlign)
  {
    return '<a target=_blank href="http://www.amazon.co.uk/exec/obidos/redirect-home?tag=yesmanstradin-21&site=amazon">\r\n' +
      '<img border="0" src="images/amazon_co_uk_multi_button6.gif" align="' + anAlign + '" hspace="0"\r\n' +
      'alt="In Association with Amazon.co.uk" width="120" height="60"></a>\r\n';
  }
  adsFormat = 1 - adsFormat;
  if (params.opt & optAdverts)
    if (adsFormat != 0)
      return new_amazon_com('left') + new_amazon_co_uk('right');
    else
      return new_amazon_co_uk('left') + new_amazon_com('right');
  else
    return '';
};

function new_counter()
{
  return '<div align="center"><a href="http://www.amazingcounters.com" target="_top">' +
    '<img border="0" src="http://www.amazingcounters.com/counter.php?i=34073&c=102532" alt="Hit Counter"></a><br>' +
    '<small><a href="http://www.ezisp.info/high-speed/sbc-yahoo-dsl.html" target="_top"><font color="#999999">SBC Yahoo DSL</font></a></small></div>';
}

function new_footer(aShowFind)
{
  return new_menu(aShowFind) +
    '<IMG BORDER=0 SRC="http://www.yesring.org/ringlogo3.jpg" USEMAP="#yesring2" width="393" height="98">\r\n' +
    '<MAP NAME="yesring2"><AREA SHAPE="RECT" ALT="The Yes WebRing" COORDS="14,6,132,65" HREF="http://yeswebring.home.att.net"\r\n' +
    'TARGET=_blank><AREA SHAPE="RECT" ALT="Join the Yes WebRing" COORDS="139,6,382,62" HREF="http://www.yestalk.org/cgi-bin/ringlink/newsite.pl?ringid=yesring"\r\n' +
    'TARGET=_blank><AREA SHAPE="RECT" ALT="Previous Site" COORDS="98,66,165,94" HREF="http://www.yestalk.org/cgi-bin/ringlink/prev.pl?ringid=yesring;siteid=yesring"\r\n' +
    'TARGET=_blank><AREA SHAPE="RECT" ALT="Next Site" COORDS="166,66,206,94" HREF="http://www.yestalk.org/cgi-bin/ringlink/next.pl?ringid=yesring;siteid=yesring"\r\n' +
    'TARGET=_blank><AREA SHAPE="RECT" ALT="Skip Next" COORDS="207,66,239,94" HREF="http://www.yestalk.org/cgi-bin/ringlink/skipnext.pl?ringid=yesring;siteid=yesring"\r\n' +
    'TARGET=_blank><AREA SHAPE="RECT" ALT="Next 5 Sites" COORDS="240,66,289,94" HREF="http://www.yestalk.org/cgi-bin/ringlink/next5.pl?ringid=yesring;siteid=yesring"\r\n' +
    'TARGET=_blank><AREA SHAPE="RECT" ALT="Visit a Random Site" COORDS="290,66,352,94" HREF="http://www.yestalk.org/cgi-bin/ringlink/rand.pl?ringid=yesring;siteid=yesring"\r\n' +
    'TARGET=_blank><AREA SHAPE="RECT" ALT="List Sites" COORDS="353,66,389,94" HREF="http://www.yestalk.org/cgi-bin/ringlink/list.pl?ringid=yesring;siteid=yesring"\r\n' +
    'TARGET=_blank><AREA SHAPE="DEFAULT" NOHREF></MAP>\r\n' +
    '<p><font size="4">More Yes Trading Sites...</font><p><table border="0" cellspacing="10" width="100%" id="Links">\r\n' +
      '<tr>\r\n' +
        '<td width="33%" align="center"><a target=_blank href="http://www.yesshows.cjb.net"><img border="0" src="images/yesspin.gif"><p>Bootbeast\'s<br>Yes Shows</a></td>\r\n' +
        '<td width="33%" align="center"><a target=_blank href="http://www.yesshows.de"><img border="0" src="images/YesSmurf.gif"><p>Matze\'s<br>Yes Shows</a></td>\r\n' +
        '<td width="33%" align="center"><a target=_blank href="http://www.topographicoceans.com"><img border="0" src="images/tales2.jpg"><p>Ruud\'s<br>www.topographicoceans.com</a></td>\r\n' +
      '</tr>\r\n' +
    '</table>\r\n' +
    '<hr><div align="justify"><FONT size=1>Yes logos and graphics designed by / © Yes, Peter Banks, Roger Dean, Martyn Dean, Peter Max, Garry Mouat / Assorted Images,\r\n' +
    'Bob Cesca, Hipgnosis, Atlantic Records, Atco Records, Arista Records, Victory Records, Purple Pyramid Records, Beyond Records, and Yes Records.<br>\r\n' +
    'Led Zeppelin logos and graphics designed by / © Atlantic Records.<br>\r\n' +
    '<!Begin Link to Flag Page-->\r\nFlags courtesy of <a href="http://www.immigration-usa.com/ita.html" target=_blank>ITA</a>\'s ' +
    '<a href="http://www.theodora.com/flags" target=_blank>Flags of All Countries</a> used with permission.<br>\r\n<!End Flag Link-->' +
    'Smileys by <a href="http://cybergifs.com/">CyberGifs.com Free Web Graphics</a>.' +
    '</FONT></div></div>\r\n' + new_counter();
}

function new_header(aShowFind)
{
  return '<div align="center">\r\n' + new_menu(aShowFind) +
    '<font size="4">Dog Biscuit\'s<br>Yes & Led Zeppelin Trading Pages</font><br>\r\n' +
    '<font size="2"><br><strong><i><span style="color:red">' +
    'Nothing is for sale. Official releases and other studio recordings are not traded.\r\n' +
    'See my <a href="TradingTerms.htm">Trading Terms</a>.</span></i></strong></font><br><br>\r\n';
}

function new_menu(aShowFind)
{
  var result = '';
  for (var band in bands)
    if (band)
      result = '<a title="My ' + bands[band].name + ' Collection" href="' + get_link(band) +
        '"><img border="0" src="images/icons/' + bands[band].icon + '" align="right" height="24"></a>\r\n' +
        result;
  if (aShowFind /* && !(params.opt & optSilent) */ )
    result = '<a title="Search for Recording Titles" href="find.htm?band:' + params.band + '"><img border="0" src="images/icons/Find.gif" align="left" width="24" height="24"></a>\r\n' +
      result;
  result = '<a title="Back to Home Page" href="index.htm?opt:' + optHomePage + '"><img border="0" src="images/icons/Home.gif" align="left" width="24" height="24"></a>\r\n' +
    '<a title="My Full Trade List" href="My_Full_Trade_List.htm"><img border="0" src="images/icons/List.gif" align="left" width="24" height="24"></a>\r\n' +
    '<a title="Trading Terms / email me" href="TradingTerms.htm"><img border="0" src="images/icons/Mail.gif" align="left" width="24" height="24"></a>\r\n' +
    result;
  return result;
}

var bands = new Array;

bands[''     ] = new Band(any);
bands['Yes'  ] = new Band('Yes & Yes-Related', 'yesdram.gif', 'yeslogo4_10483.gif', 'yesworld.com');
bands['Zep'  ] = new Band('Led Zeppelin & Related', 'zep2inside', 'zoso02_27029.gif', 'led-zeppelin.com');
bands['other'] = new Band('Other Bands', 'dt', 'Majesty24.gif');

