    jQuery.preloadImages = function()
    {
      for(var i = 0; i<arguments.length; i++)
      {
        jQuery("<img>").attr("src", arguments[i]);
      }
    }
    
    
        VIS1 = 0; /*  Bilder Vis */
        VIS2 = 0; 
        
        T1 = 0;
        T2 = 0
    
    /* open & close  themen #2 */ 
    function themen1(){
         if(T1==0){
           /* pause slide show */
            $('#issue1').cycle('pause');
            $("#themen_1").slideDown(1000);
            $("#mitwirkende_1").slideUp(1000);
            $('#issue1_nav').fadeOut(1000);
            T2 = 0;
            T1 = 1;
         }else{
             $("#themen_1").slideUp(1000);
             /* resume slide show */
              $('#issue1').cycle('resume');
              $('#issue1_nav').fadeIn(1000);
              T1 = 0;
         }
    }         
    
    
    
    /* open & close  themen #2 */ 
    function themen2(){
         if(VIS1==0){
           /* pause slide show */
            $('#issue2').cycle('pause');
            $("#themen_2").slideDown(1000);
            $("#mitwirkende_2").slideUp(1000);
            $('#issue2_nav').fadeOut(1000);
            VIS2 = 0;
            VIS1 = 1;
         }else{
             $("#themen_2").slideUp(1000);
             /* resume slide show */
              $('#issue2').cycle('resume');
              $('#issue2_nav').fadeIn(1000);
              VIS1 = 0;
         }
    }         
    
    
    /* open & close mitarbeit #1 */
    function mitarbeit1(){
         if(T2==0){
           /* pause slide show */
           $('#issue1').cycle('pause');
           $("#mitwirkende_1").slideDown(1000);
           $("#themen_1").slideUp(1000);
           $('#issue1_nav').fadeOut(1000);
           
           T1 = 0;
           T2 = 1;
         }else{
             $("#mitwirkende_1").slideUp(1000);
              /* resume slide show */
              $('#issue1').cycle('resume');
              $('#issue1_nav').fadeIn(1000);
              T2 = 0;
         }
    }
    
    
    
    
    /* open & close mitarbeit #2 */
    function mitarbeit2(){
         if(VIS2==0){
           /* pause slide show */
           $('#issue2').cycle('pause');
           $("#mitwirkende_2").slideDown(1000);
           $("#themen_2").slideUp(1000);
           $('#issue2_nav').fadeOut(1000);
           
           VIS1 = 0;
           VIS2 = 1;
         }else{
             $("#mitwirkende_2").slideUp(1000);
              /* resume slide show */
              $('#issue2').cycle('resume');
              $('#issue2_nav').fadeIn(1000);
              
             
             VIS2 = 0;
         }
    }         
    
    
    
    
    /* themen#2 */
    $(document).ready(function(){
        $("#content_issue2").click(function () {
                 themen2();
               })
    })
    /* themen#1 */
    $(document).ready(function(){
        $("#content_issue1").click(function () {
                 themen1();
               })
    })
    
    
    /* mitwirkende#1 */
    $(document).ready(function(){
         $("#people_issue1").click(function () {
                  mitarbeit1();
                })
    })
    
    
    /* mitwirkende#2 */
    $(document).ready(function(){
         $("#people_issue2").click(function () {
                  mitarbeit2();
                })
    })
    
    
    
    /* themen mitwirkende #2 zu */
    $(document).ready(function(){
        $("#issue2-call").click(function () {
                 $("#themen_2").slideUp(500);
                 $("#mitwirkende_2").slideUp(500);
                 $("#issue2_nav").fadeIn('fast');
                 VIS1 = 0;
                 VIS2 = 0;
               })
    })
    
    
    /* haw link */
    $(document).ready(function(){
         $("#haw").click(function () {
                  window.open('http://www.design.haw-hamburg.de/');
                })
    })
    
    
    
    
    $(document).ready(function(){
      $(document).pngFix();
      
       /* proload bg */
       $.preloadImages("art/bgISSUE2.png", "art/badge_issue2.png"  );
       
       /* initiate accordion */
       $("#accordion").accordion({
          active: '.selected', 
          selectedClass: 'active',
          autoHeight: true,
          alwaysOpen: false
       });
        
       
       $("#issue2-call").click(function () {
        $('body').css( { backgroundImage: "url(art/bgISSUE2.png)"} );
        
        
        
        
       })
      
      
      /* ------- do the ajax request, read dir throug php append pictures, initiate slideshow ------ */ 
      var AX = "false";
      $('#ajax').html(AX);
      
      $("#issue1-call").click(function () {
        /* adjust background image */
        $('body').css( { backgroundImage: "url(art/bgISSUE1.gif)"} );
         $("#themen_1").slideUp(500);
         $("#mitwirkende_1").slideUp(500);
         $("#issue1_nav").fadeIn('fast');
        
         VIS1 = 0;
         VIS2 = 0;
         
        
        var ID = "1";
        
        if(AX == "false"){
          $.ajax({
             type: "POST",
             url: "function/insert_issue.php", data: "id="+ID,
             success: function(msg){
              
                /* do this */
                AX = "true";
                $('#ajax').html(AX);
              
                $('#issue1').append(msg);
              
                /* issue1 initial */
              
                $('#issue1')
                      .cycle({ 
                       fx:     'fade',
                       speed:   1000,
                       timeout: 5000,
                       pause:   1,
                       pauseOnPagerHover: 1,
                       pager:  '#issue1_nav',
                       next:   '#issue1',
                       delay:   12000      
                });
              
              } /* success done */
           })   /* ajax done*/
         }      /* done if ! false*/
         
      })        /* click done*/
      /* ------- DONE: do the ajax request, read dir throug php append pictures, initiate slideshow ------ */ 
      
    
    
    
    
    /* issue 2 initial */   
    $('#issue2')
       .cycle({ 
        fx:     'fade', 
        speed:   1000, 
        timeout: 6000, 
        pause:   1,     
        pauseOnPagerHover: 1,
        pager:  '#issue2_nav',
        next:   '#issue2',
        delay:   12000      
 });
       
})








