function closeText()  {
  $(this).next().slideUp();
}
function openText()  {
  $(this).next().slideDown();
}

function hideLevel2(){
  $(this).hide();
}

function showLevel2(){
  $(this).show();
}

// global timeout func
window.actMenuFunc = 0;
window.actMenu = null;

$(document).ready(function(){
    $('#mainmenu .level1.act > .level2').each(showLevel2);
/*    $('#mainmenu ul.level2').css({position: 'absolute'});*/
    $('#mainmenu .level1').hover(
    function(e){
      $(this).children('ul').show();
      var actMenu = $('#mainmenu .level1.act').eq(0);
      if ($(e.target).parents().index(actMenu) != -1) return;
      if ($(e.target).index(actMenu) != -1) return;
      $('#mainmenu .level1.act > .level2').eq(0).hide();
    },
      
    function(e){
      $(this).children('ul').hide();
      $('#mainmenu .level1.act > .level2').each(showLevel2); 
    }
    );
  
    $('#content-middle .faq .csc-header:not(.csc-header-n1)').each(closeText);
    $('#content-middle .faq .csc-header:not(.csc-header-n1)').css({ cursor: 'pointer', overflow: 'hidden'});
    $('#content-middle .faq .csc-header:not(.csc-header-n1)').toggle(
        openText,
        closeText
    );
    
    $('#mainmenu .level1 [href=medical/]').addClass('medical');  
    $('#mainmenu .level1 [href=medical/]').parent().addClass('medical');  

    $('#pensumlogo a img').hover(
    function (e){
      var s = this.src
      this.src = s.substr(0, s.lastIndexOf('/'))+'/logo_pensum_gruen.gif';
    },
    function (e){
      this.src = this.src.substr(0, this.src.lastIndexOf('/'))+'/logo_pensum_grau.gif';
    }
    )

  });


function openGallery() {
  var height=screen.height;
  var width=screen.width;
  var baseNode = document.getElementsByTagName('base')[0];
  var base = baseNode.getAttribute('href');
  openPic(base +'fileadmin/templates/auranote/simpleviewer/index.html', 'Gallerie', 'width='+width+',height='+height+',menubar=no,status=no,toolbar=no,location=no')
}
