var outimg = "../images/button-bw.gif";
var inimg = "../images/button-cl.gif";
var selimg = "../images/button-bwcl.gif";
var curbid = 0;
var fid = 1;
var lid = 6;

if (!document._rotateimages) 
{
  document._rotateimages  = new Array();
}

var bannerno = -1;
document._rotateimages  = new Array();
document._rotate_no = 0;
var wright = 860;
var wleft = 50;
var wdown = 530;

function bannertimer(bt)
{document._rotate_interval = bt*1000;}

function bannerinit(imagename, imagewidth, imageheight, imageurl, imagereftrgt)
{ bannerno++;
  document._rotateimages[bannerno] = new Array();
  document._rotateimages[bannerno][0] = '../set_up/banner_images/'+imagename;
  document._rotateimages[bannerno][1] = imagewidth;
  document._rotateimages[bannerno][2] = imageheight;
  document._rotateimages[bannerno][3] = imageurl;
  document._rotateimages[bannerno][4] = imagereftrgt;
}

function banner()
{
  document.getElementById('bannerimage').src = document._rotateimages[document._rotate_no][0];
  //document.getElementById('bannerstyle').style.left = wright-document._rotateimages[document._rotate_no][1];
  //document.getElementById('bannerstyle').style.left = wleft;
  //document.getElementById('bannerstyle').style.top = wdown-document._rotateimages[document._rotate_no][2];
  //document.getElementById('bannerstyle').style.bottom = 15;
  document.getElementById('bannerimage').style.width = document._rotateimages[document._rotate_no][1];
  document.getElementById('bannerimage').style.height = document._rotateimages[document._rotate_no][2];
  document.getElementById('bannerref').href = document._rotateimages[document._rotate_no][3];
  document.getElementById('bannerref').target = document._rotateimages[document._rotate_no][4];
  document._rotate_no++;
}

function bannerdo(adfirst)
{
  document._rotate_no = adfirst;
  banner();
  setInterval("bannerrotate()", document._rotate_interval);
}

function bannerrotate()
{
  if (document._rotate_no > bannerno)
  {
   document._rotate_no = 0;
  }
  banner();
}


function setbt(idn, action)
{

  var tmpSrc = document.getElementById(idn).src;

  switch(action)
  {
  case "in":
    if (idn != curbid) {document.getElementById(idn).src = inimg;}
    break;
  case "out":
    if (idn != curbid) {document.getElementById(idn).src = outimg;}
    break;
  case "click":
    // delay (href style)
    for (var i = fid; i <= lid; i++)
    {
      if (idn == i) {document.getElementById(i).src = selimg; curbid = i;}
      else {document.getElementById(i).src = outimg;}
    }
    if (action == "click") {
     //window.open(url,wdw);
    }
    break;    
  default:
  }
}


function shopinfo()
{
  window.open('./shopinfo.php','shopinfo',"left=10,top=10,width=400,height=300,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no");
}

function open_window( url, windowname)
{
  window.open(url,windowname,"location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes");
}


function open_program( url, windowname)
{
  progwdw = window.open(url,windowname,"location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes");
  progwdw.document.bgColor = "#DDF1FF";
}


function open_info( url, windowname)
{
  window.open(url,windowname,"width=720,height=300,resizable=yes,scrollbars=yes");
}



function news_paper(sel)
{
  var index = sel.selectedIndex;
  if (sel.options[index].value != '0000') {
      sdcwindow = open_window('../pdf/'+sel.options[index].value+'.pdf', 'sdcpaper');
      sdcwindow.focus();
  }
}


function mailsdc(id)
{
  window.open('./mail-sdc.php?mailid='+id, 'sdcmail',"location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no");
}



function mailsdcupd(id)
{
  window.open('../main/mail-sdc.php?mailid='+id, 'sdcmail');
}


function mailad()
{ 
  window.open('./mail-ad.php?mailid=0', 'sdcmail',"location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no");
}


function open_welcome()
{
  window.open('./main/welcome.php', 'sdcinfo', 'width=225,height=415,left=100,top=100');
}

function translate_info(kapitel)
{
  if ( kapitel != "-" )
  {
  trslwdw = window.open ("../main/trsl-" + kapitel + ".pdf","sdcinfo");
  }
}


function open_main_window(cookset)
{
  if (cookset > 0)
  {
    mainwdw = window.open("../", "sdcmain","location=yes,menubar=yes,resizable=yes,status=yes,toolbar=yes");
  }
  else
  {
    mainwdw = window.open("../?v=1", "sdcmain","location=yes,menubar=yes,resizable=yes,status=yes,toolbar=yes");
  }
  self.close();
  mainwdw.focus();
  
}



function back_to_main()
{
 open_window('home.htm', 'sdcdetail');
 open_window('content.htm', 'sdccontent');
}


