var BackupLink;
var BackupLink2;

function SetBackupLink()
{
  var index;
  var query;

  query = window.location.search;
  index = query.indexOf("bu=");
  if (index != -1)
  {
    BackupLink = query.substr(index + 3);
    index = BackupLink.indexOf("&");
    if (index != -1)
      BackupLink = BackupLink.substr(0, index);
  }
  else
    BackupLink = "";

  index = query.indexOf("bu2=");
  if (index != -1)
  {
    BackupLink2 = query.substr(index + 4);
    index = BackupLink2.indexOf("&");
    if (index != -1)
      BackupLink2 = BackupLink2.substr(0, index);
  }
  else
    BackupLink2 = "";
}

function Back()
{
  if (BackupLink == undefined)
    BackupLink = "";
  if (BackupLink2 == undefined)
    BackupLink2 = "";
  if ((BackupLink != "") && (BackupLink2 != ""))
    window.open("../" + BackupLink + ".htm?bu2=" + BackupLink2, "_self");
  else if (BackupLink != "")
    window.open("../" + BackupLink + ".htm", "_self");
  else if (BackupLink2 != "")
    window.open("../" + BackupLink2 + ".htm", "_self");
  else
    window.open("../index.htm", "_self");
}

function Next(ForwardLink)
{
  var Index;
  var Index2;

  if (BackupLink == undefined)
    BackupLink = "";
  if (BackupLink2 == undefined)
    BackupLInk2 = "";
  Index = ForwardLink.indexOf("bu=");
  Index2 = ForwardLink.indexOf("bu2=");

  if ((BackupLink != "") && (BackupLink2 != "") && (Index == -1) && (Index2 == -1))
    window.open(ForwardLink + "?bu=" + BackupLink + "&bu2=" + BackupLink2, "_self");
  else if ((BackupLink != "") && (BackupLink2 != "") && (Index == -1) && (Index2 != -1))
    window.open(ForwardLink + "&bu=" + BackupLink, "_self");
  else if ((BackupLink != "") && (BackupLink2 != "") && (Index != -1) && (Index2 == -1))
    window.open(ForwardLink + "&bu2=" + BackupLink2, "_self");
  else if ((BackupLink != "") && (BackupLink2 == "") && (Index == -1) && (Index2 == -1))
    window.open(ForwardLink + "?bu=" + BackupLink, "_self");
  else if ((BackupLink == "") && (BackupLink2 != "") && (Index == -1) && (Index2 == -1))
    window.open(ForwardLink + "?bu2=" + BackupLink2, "_self");
  else if ((BackupLink == "") && (BackupLink2 != "") && (Index != -1) && (Index2 == -1))
    window.open(ForwardLink + "&bu2=" + BackupLink2, "_self");
  else if ((BackupLink == "") && (BackupLink2 != "") && (Index == -1) && (Index2 != -1))
    window.open(ForwardLink + "?bu2=" + BackupLink2, "_self");
  else
    window.open(ForwardLink, "_self");
}
