function OpenWindow(szDoc, szName, nWidth, nHeight)
{
  var pLoad;
  var szConfig;

  szConfig =  'scrollbars=no,menubar=no,resizable=yes,toolbar=no,location=no,status=no,';
  szConfig += 'width=' + nWidth + ',height=' + nHeight;

  pLoad    =  window.open(szDoc, szName, szConfig);
}

function OpenPicture(szPic, szDesc, szName, nWidth, nHeight)
{
  var pWin;
  var szConfig;

  szConfig =  'scrollbars=no,menubar=no,resizable=yes,toolbar=no,location=no,status=no,';
  szConfig += 'width=' + (nWidth + 20) + ',height=' + (nHeight + 80);

  pWin    =  window.open('', szName, szConfig);
  pWin.document.write("<HTML>");
  pWin.document.write("<HEAD>");
  pWin.document.write("<link rel='stylesheet' type='text/css' href='/styles/style.css' />");
  pWin.document.write("<TITLE>" + szDesc + " - (" + szPic + ")</TITLE>");
  pWin.document.write("</HEAD>");
  pWin.document.write("<BODY>");
  pWin.document.write("<DIV ALIGN='CENTER'>");
  pWin.document.write("<IMG SRC='" + szPic + "' BORDER='0' ALT='" + szDesc + "' WIDTH=" + nWidth + " />");
  pWin.document.write("<BR />" + szDesc);
  pWin.document.write("</DIV>");
  pWin.document.write("<FORM>");
  pWin.document.write("<TABLE CLASS='linktable' WIDTH='100%'><TR><TD ALIGN='LEFT' WIDTH='30%'>");
  pWin.document.write("Copyright &copy; 2009 - 2011.<br />All Rights Reserved.");
  pWin.document.write("</TD>");
  pWin.document.write("<TD ALIGN='CENTER' WIDTH='40%'>");
  pWin.document.write("<INPUT TYPE='BUTTON' VALUE=' Close Window ' onClick='window.close()' />");
  pWin.document.write("</TD>");
  pWin.document.write("<TD ALIGN='RIGHT' WIDTH='30%'>");
  pWin.document.write("<IMG BORDER='0' SRC='/images/Logotiny.png' />");
  pWin.document.write("</TD></TR></TABLE>");
  pWin.document.write("</FORM>");
  pWin.document.write("</BODY>");
  pWin.document.write("</HTML>");
  pWin.document.close();

  if (window.focus)
  {
    pWin.focus()
  }
}

var bFadeIn   = true;
var nQuote    = 0;
var aszQuotes = [
  "That was a great gig at Noctor's in Maidenhead on Saturday October 8th at Noctor's in Maidenhead. Thanks for coming!",
  "Fantastic gig at PlugnPlay in Reading on Friday July 1st. Hope to perform there again soon.",
  "Excellent comments after first gig with Ryan on drums on Sunday May 15th at The Swan Inn in Arborfield!",
  "\"I really enjoyed that. You can come back!\"<br /><i>Comments from the audience on Sunday May 15th at The Swan Inn in Arborfield</i>",
  "\"A good evening and I will come out to see them again!\"<br /><i>Music fan</i>, <a href='http://www.lemonrock.com/circlesofconfusion?page=reviews'>Lemonrock Review</a>",
  "\"A 3 piece rock band who are both entertaining and brilliant to listen to.\"<br /><i>Liz</i>, <a href='http://www.lemonrock.com/circlesofconfusion?page=reviews'>Lemonrock Review</a>",
  "\"A really great night and can't wait for the next gig. I'm now a Circles Of Confusion fan :D\"<br /><i>Darcey-Louise Harrington</i>, <a href='http://www.lemonrock.com/circlesofconfusion?page=applause'>Lemonrock Applause</a>",
  "Have you seen us play somewhere? Please add your review to <a href='http://www.lemonrock.com/reviewband.php?id=25035'>Lemonrock</a>.",
  null ];

function setOpacity(eID, opacityLevel)
{
  var eStyle = document.getElementById(eID).style;
  eStyle.opacity = opacityLevel / 100;
  eStyle.filter = 'alpha(opacity='+opacityLevel+')';
}

function fade(eID, startOpacity, stopOpacity, duration) {
  var speed = Math.round(duration / 100);
  var timer = 0;
  if (startOpacity < stopOpacity){ // fade in
    for (var i=startOpacity; i<=stopOpacity; i++) {
      setTimeout("setOpacity('"+eID+"',"+i+")", timer * speed);
      timer++;
    } return;
  }
  for (var i=startOpacity; i>=stopOpacity; i--) { // fade out
    setTimeout("setOpacity('"+eID+"',"+i+")", timer * speed);
    timer++;
  }
}

function updateQuote()
{
  if (bFadeIn)
  {
    bFadeIn = false;
    setOpacity('quotes', 0);
    document.getElementById('quotes').innerHTML = aszQuotes[nQuote];
    if (aszQuotes[++nQuote] == null)
      nQuote = 0;
    fade('quotes', 0, 100, 1000);
  }
  else
  {
    bFadeIn = true;
    fade('quotes', 100, 0, 1000);
  }
}

function onTimeOut()
{
  updateQuote();
  if (bFadeIn)
    setTimeout(onTimeOut, 1000);
  else
    setTimeout(onTimeOut, 6000);
}

