var
  HasImages = document.images;

function OldImg()
{
  if (document.ImgObj != null)
    document.ImgObj.src = document.ImgStore;
}

function PreCache()
{
  if (HasImages)
  {
    var imgFiles = PreCache.arguments;
    if (document.preloadArray==null)
      document.preloadArray = new Array();
    var i = document.preloadArray.length;
    with (document)
      for (var j=0; j<imgFiles.length; j++)
        if (imgFiles[j].charAt(0)!="#")
        {
          preloadArray[i] = new Image;
          preloadArray[i++].src = imgFiles[j];
        }
  }
}

function NewImg(ImgObj,ImgFile)
{
  var
   swapObj,swapImg,
   oldObj=document.ImgObj,
   oldImg=document.ImgStore;

  swapObj = eval('document.'+ImgObj);
  swapImg = (oldObj==null || oldObj!=swapObj)?swapObj.src:oldImg;

  // Now set the actual image
  swapObj.src = ImgFile;

  document.ImgObj = swapObj;
  document.ImgStore = swapImg;
}

function NoLink()
{
  alert("Link not yet implemented. Sorry!");
}


    function StartGigs()
    {
       document.write('<table width="100%">');  
    }

    function GigTitle(sCaption)
    {
       document.write('<td><h3>'+sCaption+'</h3></td>');
    }

    function CellText(sCaption)
    {
       document.write('<td>'+sCaption+'</td>');
    }

    function BlankCell()
    {
       document.write('<td></td>');
    }
     
    function Row()
    {
       document.write('<tr>');
    }
     
    function EndRow()
    {
       document.write('</tr>');
    }

    function AddGig(sDate,sVenue,sTime,sAddress,sBlurb)
    {
       Row();
         GigTitle('When:');
         CellText(sDate);
       EndRow();
    
       Row();
         GigTitle('Where:');
         CellText(sVenue);
       EndRow();

       Row();
         GigTitle('On Stage:');
         CellText(sTime);
       EndRow();

       Row();
         GigTitle('Location:');
         CellText(sAddress);
       EndRow();

       Row();
         BlankCell();
         CellText('<i>'+sBlurb+'</i>');
       EndRow();

       Row();
         document.write('<td colspan=2><hr width="80%"></td>');  
       EndRow();
    }

    function EndGigs()
    {
       document.write('</table>');  
    }

    function StartLinkSection(sTitle)
    {
       document.write('<H2>'+sTitle+'</H2>');  
       document.write('<ul>');
    }

    function AddLink(sTitle,sURL,sDescription)
    {
       document.write('<li><a href="'+sURL+'" ');
       document.write('class=inline>'+sTitle+'</a>');  
       document.write('&nbsp; '+sDescription);
    }

    function AddDoubleLink(sTitle,sLocal,sRemote,sDescription)
    {
       document.write('<li><a href="'+sLocal+'" ');
       document.write('class=inline>'+sTitle+'</a>');  
       document.write('&nbsp; '+sDescription);
       if (sRemote != null)
         document.write(' <a href="'+sRemote+'" class=inline>(website)</a>');
    }

    function EndLinkSection()
    {
       document.write('</ul>');
       document.write('<P>');  
    }
