var width       = 800;
var height      = 600;
var blockertext = "Sie verwenden einen Popup-Blocker.\n"+
                  "Dieser verhindert leider, dass die Microsite angezeigt wird.\n\n"+
                  "Sie können die Popup-Blocker Schaltfläche nicht erreichen?\n"+
                  "Klicken Sie den Startlink mit der rechten Maustaste und wählen Sie \"Link in neuem Fenster öffnen\".";
var options     = "toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no,directories=no,hotkeys=no,status=no";
var maxunter    = 0;

function forceHttps () {
  if (   document.location.href.search('dev.local') == -1         // wenn man nicht auf dem lokalen System ist
      && document.location.href.search('babybonus.dm-aktion.de') == -1      // und nicht auf dem Vorschauserver
      && document.location.protocol == 'http:'
  ) {
    document.location.replace('https://dm-babybonus.de'+document.location.pathname+document.location.search);
  }
}

function aufklapp_haupt (nr) {
  showDivObj('open_'+nr);
  hideDivObj('close_'+nr);
}
function zuklapp_haupt (nr) {
  for (i=1; i<=maxunter; i++) zuklapp_unter (nr, i);
  hideDivObj('open_'+nr);
  showDivObj('close_'+nr);
}
function aufklapp_unter (hauptnr, unternr) {
  if (maxunter<unternr) maxunter=unternr;
  showDivObj('open_'+hauptnr+'_'+unternr);
  hideDivObj('close_'+hauptnr+'_'+unternr);
}
function zuklapp_unter (hauptnr, unternr) {
  if (maxunter<unternr) maxunter=unternr;
  hideDivObj('open_'+hauptnr+'_'+unternr);
  showDivObj('close_'+hauptnr+'_'+unternr);
}

function showMenu(id,img,color) {
  document.getElementById(id).style.background='url(images/'+img+'_1.gif) top left no-repeat';
  document.getElementById(id).style.color=color;
}
function hideMenu(id,img,color) {
  document.getElementById(id).style.background='url(images/'+img+'.gif) top left no-repeat';
  document.getElementById(id).style.color=color;
}

function drucken (url) {
  popup('print', url, width, height);
}

function popup(name,url,width,height) {
  openWindow(
    name,
    width, height,
    'toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=no,directories=no,hotkeys=no,status=no',
    url,
    blockertext
  );
}

function openExternalPopup(name,url,width,height) {
  popup(name, url, width, height);
}

function checkTelefonnummer(vorwahl,nummer) {
  if ((vorwahl != 'X' && vorwahl != '') || nummer != '') {
    document.DATEN['check_telefonnummer'].value = 1;
  }
  else {
    document.DATEN['check_telefonnummer'].value = 0;
  }
  checkField(document.DATEN['check_telefonnummer'],1)
}

function checkHandynummer(vorwahl,nummer) {
  if ((vorwahl != 'X' && vorwahl != '') || nummer != '') {
    document.DATEN['check_handynummer'].value = 1;
  }
  else {
    document.DATEN['check_handynummer'].value = 0;
  }
  checkField(document.DATEN['check_handynummer'],1)
}

function kaefergewinnspiel() {
  popup('babybonus_200908', 'http://www.dm-aktionen.de/babybonus_200908/cgi-bin/index.pl', 645, 500);
}
