function showvs(){
    var oben = (screen.height - 150)  / 2;
    var unten = (screen.width - 550)  / 2;

    var aussehen = "width=550,height=150,left=0,top=0,resizable=no,scrollbars=no,top=" + oben;

    aussehen = aussehen + "," + "left=" + unten;

         window.open("vs.html",
                     "Verkaufsstellen",
                     aussehen);
}
function mailorder(){
    var oben = (screen.height - 550)  / 2;
    var unten = (screen.width - 600)  / 2;

    var aussehen = "width=600,height=500,left=0,top=0,resizable=no,scrollbars=no,top=" + oben;

    aussehen = aussehen + "," + "left=" + unten;
         window.close();
         window.open("mailorder.html",
                     "Mailorder",
                     aussehen);
}

function showbestellung(){
    var bestellung = document.cookie.split(";");
    var oben = (screen.height - 300)  / 2;
    var unten = (screen.width - 600)  / 2;
    var aussehen = "width=600,height=300,left=0,top=0,resizable=no,scrollbars=no,top=" + oben;
    if (bestellung[0] == "") {bestellung.pop();}

    if (bestellung.length == 0)
    {
      alert("Der Warenkorb ist leer.");
    }
    else
    {
      aussehen = aussehen + "," + "left=" + unten;

      window.open("bestellung.html",
                  "Bestellung",
                  aussehen);
    }
}

function showcookie(){
    var oben = (screen.height - 600)  / 2;
    var unten = (screen.width - 800)  / 2;

    var aussehen = "width=800,height=600,left=0,top=0,resizable=no,scrollbars=yes,top=" + oben;

    aussehen = aussehen + "," + "left=" + unten;

         window.open("cookies.html",
                     "Cookie",
                     aussehen);
}

function showimp(){
    var oben = (screen.height - 600)  / 2;
    var unten = (screen.width - 800)  / 2;

    var aussehen = "width=800,height=600,left=0,top=0,resizable=no,scrollbars=yes,top=" + oben;

    aussehen = aussehen + "," + "left=" + unten;

         window.open("zeitschnur_impressum.html",
                     "Impressum",
                     aussehen);
}

function selectbook(book, count)
{
   for(var i = 1; i <= count; i++)
   {
     switch(i) {
       case book:
         document.getElementById('select' + i).style.backgroundColor = 'red';
         document.getElementById('select' + i).style.border = 'red solid 1px';
         break;
       default:
         if (document.getElementById('contenttext' + i).style.visibility != 'visible')
         {
           document.getElementById('select' + i).style.backgroundColor = 'yellow';
           document.getElementById('select' + i).style.border = 'gray solid 1px';
         }
         break;
     }
   }
}
function showbook(book, count)
{
   for(var i = 1; i <= count; i++)
   {
     switch(i) {
       case book:
         document.getElementById('contenttext' + i).style.visibility = 'visible';
         document.getElementById('contenttopright' + i).style.visibility = 'visible';
         document.getElementById('contentbottom' + i).style.visibility = 'visible';
         document.getElementById('contentimg' + i).style.visibility = 'visible';
         break;
       default:
         document.getElementById('contenttext' + i).style.visibility = 'hidden';
         document.getElementById('contenttopright' + i).style.visibility = 'hidden';
         document.getElementById('contentbottom' + i).style.visibility = 'hidden';
         document.getElementById('contentimg' + i).style.visibility = 'hidden';
         break;
     }
   }
   selectbook(book, count);
}

function addbook(count)
{

      document.cookie = 'bestellung' + count + '=' + count + '|1;';
  showbestellung();
}

function screen_center()
{
  if (self.innerHeight) // all except Explorer
  {
        x = self.innerWidth;
        y = self.innerHeight;
  }
  else if (document.documentElement && document.documentElement.clientHeight)
        // Explorer 6 Strict Mode
  {
        x = document.documentElement.clientWidth;
        y = document.documentElement.clientHeight;
  }
  else if (document.body) // other Explorers
  {
        x = document.body.clientWidth;
        y = document.body.clientHeight;
  }
  var top = (y - 600) / 2;
  if (top < 0) {top = 0;}
  var left = (x - 970) / 2;
  if (left < 0) {left = 0;}
  document.getElementById("container").style.top = top + "px";
  document.getElementById("container").style.left = left + "px";
}
function showsub(nr)
{
   document.getElementById("submenu" + nr).style.display = "block";
}
function hidesub(nr)
{
   document.getElementById("submenu" + nr).style.display = "none";
}
function grafik(){
  if (document.getElementById("ct1").style.display == "block")
  {
    document.getElementById("ct1").style.display = "none";
    document.getElementById("ct2").style.display = "block";
    document.getElementById("ct3").style.display = "none";
  }
  else if (document.getElementById("ct2").style.display == "block")
  {
    document.getElementById("ct1").style.display = "none";
    document.getElementById("ct2").style.display = "none";
    document.getElementById("ct3").style.display = "block";
  }
  else if (document.getElementById("ct3").style.display == "block")
  {
    document.getElementById("ct1").style.display = "block";
    document.getElementById("ct2").style.display = "none";
    document.getElementById("ct3").style.display = "none";
  }
}

function vorwaerts(count){
  for(var i = 1; i <= count; i++)
  {
    if (document.getElementById("ct" + i).style.display == "block")
    {
      next = i+1;
      if (next > count)
      {
        next = 1;
      }
    }
  }

  for(var i = 1; i <= count; i++)
  {
    if (i == next)
    {
      document.getElementById("ct" + i).style.display = "block";
    }
    else
    {
      document.getElementById("ct" + i).style.display = "none";
    }
  }
}

function rueckwaerts(count){
  for(var i = 1; i <= count; i++)
  {
    if (document.getElementById("ct" + i).style.display == "block")
    {
      next = i-1;
      if (next == 0)
      {
        next = 6;
      }
    }
  }

  for(var i = 1; i <= count; i++)
  {
    if (i == next)
    {
      document.getElementById("ct" + i).style.display = "block";
    }
    else
    {
      document.getElementById("ct" + i).style.display = "none";
    }
  }
}
