/*  Dr. Parschau
 *  File:       parschau.js
 *  Abstract:   javascript for http://dr-parschau.de/
 *  Version:    1.0
 *  (CC):       Marc Wright | Team Tejat Hamburg 2011
 
*/



$(function() {
  $('#images a, a[rel*=lightbox]').lightBox({fixedNavigation:true});
  //$('a[@rel*=lightbox]').lightBox({fixedNavigation:true});
  
});
  
  
$(document).ready(function(){
  
    /* init tipsy */
    $('.tip').tipsy({html: true, gravity: 'n', fade: true, delayIn: 200, delayOut: 900});
    
    /* open all external links in a new window  */
    $("a.ext", this).click(function(){
      window.open(this.href);
      return false;
    });
    
    
     /* intro bg */
      $(function(){  
        $.fn.supersized.options = {  
            startwidth: 1440,
            startheight: 900,
            slideshow: 0      // 1 = slideshow on, anything else = off
        };
        $('#supersize').supersized();  
      });
    
    /* count elemets; >2 init cycle */
    numImages = $('#inner_home_header_rotation').children().size();
      if(numImages >= 1 ){
              /* init cycle */
              $('#inner_home_header_rotation').each(function() {

                  $(this)
                    .cycle({ 
                     fx: 'fade',
                        delay:              5000,       // additional delay (in ms) for first transition (hint: can be negative)
                        speed:              1500,
                        timeout:            7000,
                        pause:              0,          // true to enable "pause on hover" 
                        pauseOnPagerHover:  0,          // true to pause when hovering over pager link 
                        pager:              '#pager',
                        next:               '.next',
                        prev:               '.prev',
                        fastOnEvent:        1
              });
            });
      } // end if
});

/* the key bindings */
$(document).keydown(function (e) {
      
      /* right */
      if (e.which == 39) {
        $(".next").trigger('click');
        $('#home_header').cycle('pause');
      /* left */
      } 
       if (e.which == 37) {
        $(".prev").trigger('click');
        $('#home_header').cycle('pause');
      }
});
