/* Seiten-ID: 12 - letzte Publizierung: 08.02.2012 00:01 */
var popupcounter = 0;
$(document).ready(function() {
  $("div.mdl-tabs ul li").mouseenter(function() {
    $("div.mdl-tabs ul li").removeClass("active");
    $("div.mdl-tabs div").hide();
    $(this).addClass("active");
    $("div.mdl-tabs div#"+$(this).attr("id")+"-container").show();
  });
  
  // Popup
  $('a.popup').click( function(e) {
    openPopup($(this));
    e.preventDefault();
  });
  
  // Popup schließen
  $("a#lnk-popup-close").click(function(e) {
    window.close();
    e.preventDefault();
  });

  // toggle faq-module
  $("li.question a").click(function(e){
    var headline = $(this).html();
    if($(this).parent("li").hasClass("open")) {
      wiredminds.trackEvent('FAQ/'+headline+'/schließen');
      $(this).parent("li").removeClass("open");
      $(this).parent("li").next("li").slideToggle();
    } else {
      wiredminds.trackEvent('FAQ/'+headline+'/öffnen');
      $(this).parent("li").addClass("open");
      $(this).parent("li").next("li").slideToggle();
    }
    e.preventDefault();
  }); 
  
});
function openPopup(elem) {
    var size = elem.attr("rel");
    sizeparts = size.split(",");
    var w = sizeparts[0];
    var h = sizeparts[1];
    var x=0, y=0;
    if (w < screen.availWidth || h < screen.availHeight) {
      x = (screen.availWidth - w - 12) / 2;
      y = (screen.availHeight - h - 104) / 2;
      if (window.opera) y = 0; // Opera positioniert unter den Symbolleisten
      if (x<0 || y<0) { x=0; y=0; }
    }
    var windowid = new Array("a","b","c","d","e","f","g","h","i","j","k","l"); 
    window.open( elem.attr('href'),windowid[popupcounter],'resizeable=no,scrollbars=1,status=no,toolbar=no,location=no,left='+x+',top='+y+',width='+w+',height='+h+'' );
    popupcounter++;
}
