var cookieName = "ShowSongList";

function setCookie(name, value, expires)
{
    document.cookie = name + "=" + escape(value) +
        ((expires) ? ";expires=" + expires : "");
}

function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

function isListHidden()
{
  var a = getCookie(cookieName);
  if (!a) return false;
  if (a == "false") return false;
  return true;
}

function changeHiddenValue()
{
  var a = getCookie(cookieName);
  var rtn = "true";
  if (!a) rtn = "true";
  else if (a == "false") rtn = "true";
  else if (a == "true") rtn = "false";
  
  var now = new Date();
  now.setTime(now.getTime() + 1000 * 60 * 60);
  setCookie(cookieName, rtn, now);
  return true;
}

function createContactForm()
{
  document.write("              <center><br>");
  document.write("              <a class='textbox' href='mailto:info@azira");
  document.write("phal.com' title='Send a message to Aziraphal' OnMouseOver='self.status=(\"Send a message to Aziraphal\");return true;' OnMouseOut='self.status=(\"\");return true;'><img src='images/addy.png' width='218' height='26'></a>");
  document.write("              <br><br></center>");
}

function createSoftwareContactLink(linkText, caption)
{
  if (linkText == null)
	linkText = 'Contact';
  if (caption == null)
    caption = 'Send a message to Aziraphal';
	
  document.write("              <a class='textbox' href='mailto:info@azira");
  document.write("phal.com' title='");
  document.write(caption);
  document.write("' OnMouseOver='self.status=(\"");
  document.write(caption);
  document.write("\");return true;' OnMouseOut='self.status=(\"\");return true;'>");
  document.write(linkText);
  document.write("</a>");
}
