/*
 * jQuery Reveal Plugin 1.1
 * www.ZURB.com
 * Copyright 2010, ZURB
 * Free to use under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
*/
/*globals jQuery */
(function ($) {
  'use strict';
  //
  // Global variable.
  // Helps us determine if the current modal is being queued for display.
  //
  var modalQueued = false;
  //
  // Bind the live 'click' event to all anchor elemnets with the data-reveal-id attribute.
  //
  $(document).on('click', 'a[data-reveal-id]', function ( event ) {
    //
    // Prevent default action of the event.
    //
    event.preventDefault();
    //
    // Get the clicked anchor data-reveal-id attribute value.
    //
    var modalLocation = $( this ).attr( 'data-reveal-id' );
    //
    // Find the element with that modalLocation id and call the reveal plugin.
    //
    $( '#' + modalLocation ).reveal( $( this ).data() );
  });
  /**
   * @module reveal
   * @property {Object} [options] Reveal options
   */
  $.fn.reveal = function ( options ) {
    /*
       * Cache the document object.
       */
    var $doc = $( document ),
    /*
         * Default property values.
         */
    defaults = {
      /**
           * Possible options: fade, fadeAndPop, none
           *
           * @property animation
           * @type {String}
           * @default fadeAndPop
           */
      animation: 'fadeAndPop',
      /**
           * Speed at which the reveal should show. How fast animtions are.
           *
           * @property animationSpeed
           * @type {Integer}
           * @default 300
           */
      animationSpeed: 300,
      /**
           * Should the modal close when the background is clicked?
           *
           * @property closeOnBackgroundClick
           * @type {Boolean}
           * @default true
           */
      closeOnBackgroundClick: true,
      /**
           * Specify a class name for the 'close modal' element.
           * This element will close an open modal.
           *
           @example
           <a href='#close' class='close-reveal-modal'>Close Me</a>
           *
           * @property dismissModalClass
           * @type {String}
           * @default close-reveal-modal
           */
      dismissModalClass: 'close-reveal-modal',
      /**
           * Specify a callback function that triggers 'before' the modal opens.
           *
           * @property open
           * @type {Function}
           * @default function(){}
           */
      open: $.noop,
      /**
           * Specify a callback function that triggers 'after' the modal is opened.
           *
           * @property opened
           * @type {Function}
           * @default function(){}
           */
      opened: $.noop,
      /**
           * Specify a callback function that triggers 'before' the modal prepares to close.
           *
           * @property close
           * @type {Function}
           * @default function(){}
           */
      close: $.noop,
      /**
           * Specify a callback function that triggers 'after' the modal is closed.
           *
           * @property closed
           * @type {Function}
           * @default function(){}
           */
      closed: $.noop
    }
    ;
    //
    // Extend the default options.
    // This replaces the passed in option (options) values with default values.
    //
    options = $.extend( {
    }
    , defaults, options );
    //
    // Apply the plugin functionality to each element in the jQuery collection.
    //
    return this.not('.reveal-modal.open').each( function () {
      //
      // Cache the modal element
      //
      var modal = $( this ),
      //
      // Get the current css 'top' property value in decimal format.
      //
      topMeasure = parseInt( modal.css( 'top' ), 10 ),
      //
      // Calculate the top offset.
      //
      topOffset = modal.height() + topMeasure,
      //
      // Helps determine if the modal is locked.
      // This way we keep the modal from triggering while it's in the middle of animating.
      //
      locked = false,
      //
      // Get the modal background element.
      //
      modalBg = $( '.reveal-modal-bg' ),
      //
      // Show modal properties
      //
      cssOpts = {
        //
        // Used, when we show the modal.
        //
        open : {
          //
          // Set the 'top' property to the document scroll minus the calculated top offset.
          //
          'top': 0,
          //
          // Opacity gets set to 0.
          //
          'opacity': 0,
          //
          // Show the modal
          //
          'visibility': 'visible',
          //
          // Ensure it's displayed as a block element.
          //
          'display': 'block'
        }
        ,
        //
        // Used, when we hide the modal.
        //
        close : {
          //
          // Set the default 'top' property value.
          //
          'top': topMeasure,
          //
          // Has full opacity.
          //
          'opacity': 1,
          //
          // Hide the modal
          //
          'visibility': 'hidden',
          //
          // Ensure the elment is hidden.
          //
          'display': 'none'
        }
      }
      ,
      //
      // Initial closeButton variable.
      //
      $closeButton
      ;
      //
      // Do we have a modal background element?
      //
      if ( modalBg.length === 0 ) {
        //
        // No we don't. So, let's create one.
        //
        modalBg = $( '<div />', {
          'class' : 'reveal-modal-bg'
        }
        )
        //
        // Then insert it after the modal element.
        //
        .insertAfter( modal );
        //
        // Now, fade it out a bit.
        //
        modalBg.fadeTo( 'fast', 0.8 );
      }
      //
      // Helper Methods
      //
      /**
       * Unlock the modal for animation.
       *
       * @method unlockModal
       */
      function unlockModal() {
        locked = false;
      }
      /**
       * Lock the modal to prevent further animation.
       *
       * @method lockModal
       */
      function lockModal() {
        locked = true;
      }
      /**
       * Closes all open modals.
       *
       * @method closeOpenModal
       */
      function closeOpenModals() {
        //
        // Get all reveal-modal elements with the .open class.
        //
        var $openModals = $( ".reveal-modal.open" );
        //
        // Do we have modals to close?
        //
        if ( $openModals.length === 1 ) {
          //
          // Set the modals for animation queuing.
          //
          modalQueued = true;
          //
          // Trigger the modal close event.
          //
          $openModals.trigger( "reveal:close" );
        }
      }
      /**
       * Animates the modal opening.
       * Handles the modal 'open' event.
       *
       * @method openAnimation
       */
      function openAnimation() {
        //
        // First, determine if we're in the middle of animation.
        //
        if ( !locked ) {
          //
          // We're not animating, let's lock the modal for animation.
          //
          lockModal();
          //
          // Close any opened modals.
          //
          closeOpenModals();
          //
          // Now, add the open class to this modal.
          //
          modal.addClass( "open" );
          //
          // Are we executing the 'fadeAndPop' animation?
          //
          if ( options.animation === "fadeAndPop" ) {
            //
            // Yes, we're doing the 'fadeAndPop' animation.
            // Okay, set the modal css properties.
            //
            //
            // Set the 'top' property to the document scroll minus the calculated top offset.
            //
            cssOpts.open.top = $doc.scrollTop() - topOffset;
            //
            // Flip the opacity to 0.
            //
            cssOpts.open.opacity = 0;
            //
            // Set the css options.
            //
            modal.css( cssOpts.open );
            //
            // Fade in the background element, at half the speed of the modal element.
            // So, faster than the modal element.
            //
            modalBg.fadeIn( options.animationSpeed / 2 );
            //
            // Let's delay the next animation queue.
            // We'll wait until the background element is faded in.
            //
            modal.delay( options.animationSpeed / 2 )
            //
            // Animate the following css properties.
            //
            .animate( {
              //
              // Set the 'top' property to the document scroll plus the calculated top measure.
              //
              "top": $doc.scrollTop() + topMeasure + 'px',
              //
              // Set it to full opacity.
              //
              "opacity": 1
            }
            ,
            /*
             * Fade speed.
             */
            options.animationSpeed,
            /*
             * End of animation callback.
             */
            function () {
              //
              // Trigger the modal reveal:opened event.
              // This should trigger the functions set in the options.opened property.
              //
              modal.trigger( 'reveal:opened' );
            });
            // end of animate.
          }
          // end if 'fadeAndPop'
          //
          // Are executing the 'fade' animation?
          //
          if ( options.animation === "fade" ) {
            //
            // Yes, were executing 'fade'.
            // Okay, let's set the modal properties.
            //
            cssOpts.open.top = $doc.scrollTop() + topMeasure;
            //
            // Flip the opacity to 0.
            //
            cssOpts.open.opacity = 0;
            //
            // Set the css options.
            //
            modal.css( cssOpts.open );
            //
            // Fade in the modal background at half the speed of the modal.
            // So, faster than modal.
            //
            modalBg.fadeIn( options.animationSpeed / 2 );
            //
            // Delay the modal animation.
            // Wait till the modal background is done animating.
            //
            modal.delay( options.animationSpeed / 2 )
            //
            // Now animate the modal.
            //
            .animate( {
              //
              // Set to full opacity.
              //
              "opacity": 1
            }
            ,
            /*
             * Animation speed.
             */
            options.animationSpeed,
            /*
             * End of animation callback.
             */
            function () {
              //
              // Trigger the modal reveal:opened event.
              // This should trigger the functions set in the options.opened property.
              //
              modal.trigger( 'reveal:opened' );
            });
          }
          // end if 'fade'
          //
          // Are we not animating?
          //
          if ( options.animation === "none" ) {
            //
            // We're not animating.
            // Okay, let's set the modal css properties.
            //
            //
            // Set the top property.
            //
            cssOpts.open.top = $doc.scrollTop() + topMeasure;
            //
            // Set the opacity property to full opacity, since we're not fading (animating).
            //
            cssOpts.open.opacity = 1;
            //
            // Set the css property.
            //
            modal.css( cssOpts.open );
            //
            // Show the modal Background.
            //
            modalBg.css( {
              "display": "block"
            });
            //
            // Trigger the modal opened event.
            //
            modal.trigger( 'reveal:opened' );
          }
          // end if animating 'none'
        }
        // end if !locked
      }
      // end openAnimation
      function openVideos() {
        var video = modal.find('.flex-video'),
        iframe = video.find('iframe');
        if (iframe.length > 0) {
          iframe.attr("src", iframe.data("src"));
          video.fadeIn(100);
        }
      }
      //
      // Bind the reveal 'open' event.
      // When the event is triggered, openAnimation is called
      // along with any function set in the options.open property.
      //
      modal.bind( 'reveal:open.reveal', openAnimation );
      modal.bind( 'reveal:open.reveal', openVideos);
      /**
       * Closes the modal element(s)
       * Handles the modal 'close' event.
       *
       * @method closeAnimation
       */
      function closeAnimation() {
        //
        // First, determine if we're in the middle of animation.
        //
        if ( !locked ) {
          //
          // We're not animating, let's lock the modal for animation.
          //
          lockModal();
          //
          // Clear the modal of the open class.
          //
          modal.removeClass( "open" );
          //
          // Are we using the 'fadeAndPop' animation?
          //
          if ( options.animation === "fadeAndPop" ) {
            //
            // Yes, okay, let's set the animation properties.
            //
            modal.animate( {
              //
              // Set the top property to the document scrollTop minus calculated topOffset.
              //
              "top":  $doc.scrollTop() - topOffset + 'px',
              //
              // Fade the modal out, by using the opacity property.
              //
              "opacity": 0
            }
            ,
            /*
             * Fade speed.
             */
            options.animationSpeed / 2,
            /*
             * End of animation callback.
             */
            function () {
              //
              // Set the css hidden options.
              //
              modal.css( cssOpts.close );
            });
            //
            // Is the modal animation queued?
            //
            if ( !modalQueued ) {
              //
              // Oh, the modal(s) are mid animating.
              // Let's delay the animation queue.
              //
              modalBg.delay( options.animationSpeed )
              //
              // Fade out the modal background.
              //
              .fadeOut(
              /*
               * Animation speed.
               */
              options.animationSpeed,
              /*
              * End of animation callback.
              */
              function () {
                //
                // Trigger the modal 'closed' event.
                // This should trigger any method set in the options.closed property.
                //
                modal.trigger( 'reveal:closed' );
              });
            } else {
              //
              // We're not mid queue.
              // Trigger the modal 'closed' event.
              // This should trigger any method set in the options.closed propety.
              //
              modal.trigger( 'reveal:closed' );
            }
            // end if !modalQueued
          }
          // end if animation 'fadeAndPop'
          //
          // Are we using the 'fade' animation.
          //
          if ( options.animation === "fade" ) {
            //
            // Yes, we're using the 'fade' animation.
            //
            modal.animate( {
              "opacity" : 0
            }
            ,
            /*
               * Animation speed.
               */
            options.animationSpeed,
            /*
               * End of animation callback.
               */
            function () {
              //
              // Set the css close options.
              //
              modal.css( cssOpts.close );
            });
            // end animate
            //
            // Are we mid animating the modal(s)?
            //
            if ( !modalQueued ) {
              //
              // Oh, the modal(s) are mid animating.
              // Let's delay the animation queue.
              //
              modalBg.delay( options.animationSpeed )
              //
              // Let's fade out the modal background element.
              //
              .fadeOut(
              /*
               * Animation speed.
               */
              options.animationSpeed,
              /*
                 * End of animation callback.
                 */
              function () {
                //
                // Trigger the modal 'closed' event.
                // This should trigger any method set in the options.closed propety.
                //
                modal.trigger( 'reveal:closed' );
              });
              // end fadeOut
            } else {
              //
              // We're not mid queue.
              // Trigger the modal 'closed' event.
              // This should trigger any method set in the options.closed propety.
              //
              modal.trigger( 'reveal:closed' );
            }
            // end if !modalQueued
          }
          // end if animation 'fade'
          //
          // Are we not animating?
          //
          if ( options.animation === "none" ) {
            //
            // We're not animating.
            // Set the modal close css options.
            //
            modal.css( cssOpts.close );
            //
            // Is the modal in the middle of an animation queue?
            //
            if ( !modalQueued ) {
              //
              // It's not mid queueu. Just hide it.
              //
              modalBg.css( {
                'display': 'none'
              });
            }
            //
            // Trigger the modal 'closed' event.
            // This should trigger any method set in the options.closed propety.
            //
            modal.trigger( 'reveal:closed' );
          }
          // end if not animating
          //
          // Reset the modalQueued variable.
          //
          modalQueued = false;
        }
        // end if !locked
      }
      // end closeAnimation
      /**
       * Destroys the modal and it's events.
       *
       * @method destroy
       */
      function destroy() {
        //
        // Unbind all .reveal events from the modal.
        //
        modal.unbind( '.reveal' );
        //
        // Unbind all .reveal events from the modal background.
        //
        modalBg.unbind( '.reveal' );
        //
        // Unbind all .reveal events from the modal 'close' button.
        //
        $closeButton.unbind( '.reveal' );
        //
        // Unbind all .reveal events from the body.
        //
        $( 'body' ).unbind( '.reveal' );
      }
      function closeVideos() {
        var video = modal.find('.flex-video'),
        iframe = video.find('iframe');
        if (iframe.length > 0) {
          iframe.data("src", iframe.attr("src"));
          iframe.attr("src", "");
          video.fadeOut(100);
        }
      }
      //
      // Bind the modal 'close' event
      //
      modal.bind( 'reveal:close.reveal', closeAnimation );
      modal.bind( 'reveal:closed.reveal', closeVideos );
      //
      // Bind the modal 'opened' + 'closed' event
      // Calls the unlockModal method.
      //
      modal.bind( 'reveal:opened.reveal reveal:closed.reveal', unlockModal );
      //
      // Bind the modal 'closed' event.
      // Calls the destroy method.
      //
      modal.bind( 'reveal:closed.reveal', destroy );
      //
      // Bind the modal 'open' event
      // Handled by the options.open property function.
      //
      modal.bind( 'reveal:open.reveal', options.open );
      //
      // Bind the modal 'opened' event.
      // Handled by the options.opened property function.
      //
      modal.bind( 'reveal:opened.reveal', options.opened );
      //
      // Bind the modal 'close' event.
      // Handled by the options.close property function.
      //
      modal.bind( 'reveal:close.reveal', options.close );
      //
      // Bind the modal 'closed' event.
      // Handled by the options.closed property function.
      //
      modal.bind( 'reveal:closed.reveal', options.closed );
      //
      // We're running this for the first time.
      // Trigger the modal 'open' event.
      //
      modal.trigger( 'reveal:open' );
      //
      // Get the closeButton variable element(s).
      //
      $closeButton = $( '.' + options.dismissModalClass )
      //
      // Bind the element 'click' event and handler.
      //
      .bind( 'click.reveal', function () {
        //
        // Trigger the modal 'close' event.
        //
        modal.trigger( 'reveal:close' );
      });
      //
      // Should we close the modal background on click?
      //
      if ( options.closeOnBackgroundClick ) {
        //
        // Yes, close the modal background on 'click'
        // Set the modal background css 'cursor' propety to pointer.
        // Adds a pointer symbol when you mouse over the modal background.
        //
        modalBg.css( {
          "cursor": "pointer"
        });
        //
        // Bind a 'click' event handler to the modal background.
        //
        modalBg.bind( 'click.reveal', function () {
          //
          // Trigger the modal 'close' event.
          //
          modal.trigger( 'reveal:close' );
        });
      }
      //
      // Bind keyup functions on the body element.
      // We'll want to close the modal when the 'escape' key is hit.
      //
      $( 'body' ).bind( 'keyup.reveal', function ( event ) {
        //
        // Did the escape key get triggered?
        //
        if ( event.which === 27 ) {
          // 27 is the keycode for the Escape key
          //
          // Escape key was triggered.
          // Trigger the modal 'close' event.
          //
          modal.trigger( 'reveal:close' );
        }
      });
      // end $(body)
    });
    // end this.each
  };
  // end $.fn
}
( jQuery ) );
/* Modernizr 2.6.0 (Custom Build) | MIT & BSD
 * Build: http://modernizr.com/download/#-inlinesvg-svg-svgclippaths-touch-shiv-cssclasses-teststyles-prefixes-ie8compat-load
 */
;
window.Modernizr=function(a,b,c){
  function x(a){
    j.cssText=a
  }
  function y(a,b){
    return x(m.join(a+";")+(b||""))
  }
  function z(a,b){
    return typeof a===b
  }
  function A(a,b){
    return!!~(""+a).indexOf(b)
  }
  function B(a,b,d){
    for(var e in a){
      var f=b[a[e]];
      if(f!==c)return d===!1?a[e]:z(f,"function")?f.bind(d||b):f
    }
    return!1
  }
  var d="2.6.0",e={
  }
  ,f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={
  }
  .toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n={
    svg:"http://www.w3.org/2000/svg"
  }
  ,o={
  }
  ,p={
  }
  ,q={
  }
  ,r=[],s=r.slice,t,u=function(a,c,d,e){
    var f,i,j,k=b.createElement("div"),l=b.body,m=l?l:b.createElement("body");
    if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),k.appendChild(j);
    return f=["&#173;",'<style id="s',h,'">',a,"</style>"].join(""),k.id=h,(l?k:m).innerHTML+=f,m.appendChild(k),l||(m.style.background="",g.appendChild(m)),i=c(k,a),l?k.parentNode.removeChild(k):m.parentNode.removeChild(m),!!i
  }
  ,v={
  }
  .hasOwnProperty,w;
  !z(v,"undefined")&&!z(v.call,"undefined")?w=function(a,b){
    return v.call(a,b)
  }
  :w=function(a,b){
    return b in a&&z(a.constructor.prototype[b],"undefined")
  }
  ,Function.prototype.bind||(Function.prototype.bind=function(b){
    var c=this;
    if(typeof c!="function")throw new TypeError;
    var d=s.call(arguments,1),e=function(){
      if(this instanceof e){
        var a=function(){
        };
        a.prototype=c.prototype;
        var f=new a,g=c.apply(f,d.concat(s.call(arguments)));
        return Object(g)===g?g:f
      }
      return c.apply(b,d.concat(s.call(arguments)))
    };
    return e
  }
  ),o.touch=function(){
    var c;
    return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:u(["@media (",m.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){
      c=a.offsetTop===9
    }
    ),c
  }
  ,o.svg=function(){
    return!!b.createElementNS&&!!b.createElementNS(n.svg,"svg").createSVGRect
  }
  ,o.inlinesvg=function(){
    var a=b.createElement("div");
    return a.innerHTML="<svg/>",(a.firstChild&&a.firstChild.namespaceURI)==n.svg
  }
  ,o.svgclippaths=function(){
    return!!b.createElementNS&&/SVGClipPath/.test(l.call(b.createElementNS(n.svg,"clipPath")))
  };
  for(var C in o)w(o,C)&&(t=C.toLowerCase(),e[t]=o[C](),r.push((e[t]?"":"no-")+t));
  return e.addTest=function(a,b){
    if(typeof a=="object")for(var d in a)w(a,d)&&e.addTest(d,a[d]);
    else{
      a=a.toLowerCase();
      if(e[a]!==c)return e;
      b=typeof b=="function"?b():b,f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b
    }
    return e
  }
  ,x(""),i=k=null,function(a,b){
    function k(a,b){
      var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;
      return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)
    }
    function l(){
      var a=r.elements;
      return typeof a=="string"?a.split(" "):a
    }
    function m(a){
      var b=i[a[g]];
      return b||(b={
      }
      ,h++,a[g]=h,i[h]=b),b
    }
    function n(a,c,f){
      c||(c=b);
      if(j)return c.createElement(a);
      f||(f=m(c));
      var g;
      return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g
    }
    function o(a,c){
      a||(a=b);
      if(j)return a.createDocumentFragment();
      c=c||m(a);
      var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;
      for(;e<g;e++)d.createElement(f[e]);
      return d
    }
    function p(a,b){
      b.cache||(b.cache={
      }
      ,b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){
        return r.shivMethods?n(c,a,b):b.createElem(c)
      }
      ,a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+l().join().replace(/\w+/g,function(a){
        return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'
      }
      )+");return n}")(r,b.frag)
    }
    function q(a){
      a||(a=b);
      var c=m(a);
      return r.shivCSS&&!f&&!c.hasCSS&&(c.hasCSS=!!k(a,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")),j||p(a,c),a
    }
    var c=a.html5||{
    }
    ,d=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,e=/^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i,f,g="_html5shiv",h=0,i={
    }
    ,j;
    (function(){
      try{
        var a=b.createElement("a");
        a.innerHTML="<xyz></xyz>",f="hidden"in a,j=a.childNodes.length==1||function(){
          b.createElement("a");
          var a=b.createDocumentFragment();
          return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"
        }
        ()
      } catch(c){
        f=!0,j=!0
      }
    }
    )();
    var r={
      elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o
    };
    a.html5=r,q(b)
  }
  (this,b),e._version=d,e._prefixes=m,e.testStyles=u,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+r.join(" "):""),e
}
(this,this.document),function(a,b,c){
  function d(a){
    return o.call(a)=="[object Function]"
  }
  function e(a){
    return typeof a=="string"
  }
  function f(){
  }
  function g(a){
    return!a||a=="loaded"||a=="complete"||a=="uninitialized"
  }
  function h(){
    var a=p.shift();
    q=1,a?a.t?m(function(){
      (a.t=="c"?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)
    }
    ,0):(a(),h()):q=0
  }
  function i(a,c,d,e,f,i,j){
    function k(b){
      if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){
        a!="img"&&m(function(){
          t.removeChild(l)
        }
        ,50);
        for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()
      }
    }
    var j=j||B.errorTimeout,l={
    }
    ,o=0,r=0,u={
      t:d,s:c,e:f,a:i,x:j
    };
    y[c]===1&&(r=1,y[c]=[],l=b.createElement(a)),a=="object"?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){
      k.call(this,r)
    }
    ,p.splice(e,0,u),a!="img"&&(r||y[c]===2?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))
  }
  function j(a,b,c,d,f){
    return q=0,b=b||"j",e(a)?i(b=="c"?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),p.length==1&&h()),this
  }
  function k(){
    var a=B;
    return a.loader={
      load:j,i:0
    }
    ,a
  }
  var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={
  }
  .toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&o.call(a.opera)=="[object Opera]",l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){
    return o.call(a)=="[object Array]"
  }
  ,x=[],y={
  }
  ,z={
    timeout:function(a,b){
      return b.length&&(a.timeout=b[0]),a
    }
  }
  ,A,B;
  B=function(a){
    function b(a){
      var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={
        url:c,origUrl:c,prefixes:a
      }
      ,e,f,g;
      for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));
      for(f=0;f<b;f++)c=x[f](c);
      return c
    }
    function g(a,e,f,g,i){
      var j=b(a),l=j.autoCallback;
      j.url.split(".").pop().split("?").shift(),j.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]||h),j.instead?j.instead(a,e,f,g,i):(y[j.url]?j.noexec=!0:y[j.url]=1,f.load(j.url,j.forceCSS||!j.forceJS&&"css"==j.url.split(".").pop().split("?").shift()?"c":c,j.noexec,j.attrs,j.timeout),(d(e)||d(l))&&f.load(function(){
        k(),e&&e(j.origUrl,i,g),l&&l(j.origUrl,i,g),y[j.url]=2
      }
      )))
    }
    function i(a,b){
      function c(a,c){
        if(a){
          if(e(a))c||(j=function(){
            var a=[].slice.call(arguments);
            k.apply(this,a),l()
          }
          ),g(a,j,b,0,h);
          else if(Object(a)===a)for(n in m=function(){
            var b=0,c;
            for(c in a)a.hasOwnProperty(c)&&b++;
            return b
          }
          (),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){
            var a=[].slice.call(arguments);
            k.apply(this,a),l()
          }
          :j[n]=function(a){
            return function(){
              var b=[].slice.call(arguments);
              a&&a.apply(this,b),l()
            }
          }
          (k[n])),g(a[n],j,b,n,h))
        }
        else!c&&l()
      }
      var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;
      c(h?a.yep:a.nope,!!i),i&&c(i)
    }
    var j,l,m=this.yepnope.loader;
    if(e(a))g(a,0,m,0);
    else if(w(a))for(j=0;
    j<a.length;
    j++)l=a[j],e(l)?g(l,0,m,0):w(l)?B(l):Object(l)===l&&i(l,m);
    else Object(a)===a&&i(a,m)
  }
  ,B.addPrefix=function(a,b){
    z[a]=b
  }
  ,B.addFilter=function(a){
    x.push(a)
  }
  ,B.errorTimeout=1e4,b.readyState==null&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){
    b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"
  }
  ,0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){
    var k=b.createElement("script"),l,o,e=e||B.errorTimeout;
    k.src=a;
    for(o in d)k.setAttribute(o,d[o]);
    c=j?h:c||f,k.onreadystatechange=k.onload=function(){
      !l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)
    }
    ,m(function(){
      l||(l=1,c(1))
    }
    ,e),i?k.onload():n.parentNode.insertBefore(k,n)
  }
  ,a.yepnope.injectCss=function(a,c,d,e,g,i){
    var e=b.createElement("link"),j,c=i?h:c||f;
    e.href=a,e.rel="stylesheet",e.type="text/css";
    for(j in d)e.setAttribute(j,d[j]);
    g||(n.parentNode.insertBefore(e,n),m(c,0))
  }
}
(this,document),Modernizr.load=function(){
  yepnope.apply(window,[].slice.call(arguments,0))
}
,Modernizr.addTest("ie8compat",function(){
  return!window.addEventListener&&document.documentMode&&document.documentMode===7
});
jQuery(document).ready(function ($) {
  /* DROPDOWN NAV ------------- */
  var lockNavBar = false;
  /* Windows Phone, sadly, does not register touch events :( */
  if (Modernizr.touch ||navigator.userAgent.match(/Windows Phone/i)) {
    $('.nav-bar a.flyout-toggle').on('click.fndtn touchstart.fndtn', function(e) {
      e.preventDefault();
      var flyout = $(this).siblings('.flyout').first();
      if (lockNavBar === false) {
        $('.nav-bar .flyout').not(flyout).slideUp(500);
        flyout.slideToggle(500, function(){
          lockNavBar = false;
        });
      }
      lockNavBar = true;
    });
    $('.nav-bar>li.has-flyout').addClass('is-touch');
  } else {
    $('.nav-bar>li.has-flyout').hover(function() {
      $(this).children('.flyout').show();
    }
    , function() {
      $(this).children('.flyout').hide();
    });
  }
  /* TABS --------------------------------- */
  function activateTab($tab) {
    var $activeTab = $tab.closest('dl').find('dd.active'),
    contentLocation = $tab.children('a').attr("href") + 'Tab';
    // Strip off the current url that IE adds
    contentLocation = contentLocation.replace(/^.+#/, '#');
    //Make Tab Active
    $activeTab.removeClass('active');
    $tab.addClass('active');
    //Show Tab Content
    //$(contentLocation).closest('.tabs-content').children('li').removeClass('active').hide();
    $('.tabs-content').children('li').removeClass('active').hide();
    $(contentLocation).css('display', 'block').addClass('active');
  }
  $('dl.tabs dd a').on('click.fndtn', function (event) {
    activateTab($(this).parent('dd'));
  });
  if (window.location.hash) {
    activateTab($('a[href="' + window.location.hash + '"]').parent('dd'));
  }
});
$(function() {
  var nav = $('.nav-menu-container');
  var navPlaceholder = $('.nav-menu-container-placeholder');
  var shoptitle = $('.shoptitle');
  if(!(nav == null || typeof nav === 'undefined' || typeof nav.offset() === 'undefined')) {
    var navHomeY = nav.offset().top;
    var isFixed = false;
    var $w = $(window);
    $w.scroll(function() {
      var scrollTop = $w.scrollTop();
      var shouldBeFixed = scrollTop > navHomeY;
      if (shouldBeFixed && !isFixed) {
        var currentHeight = nav.height();
        nav.css({
          position: 'fixed',
          top: 0,
          left: nav.offset().left,
          'max-width': '100%',
          width: '1200px'
        });
        navPlaceholder.css({
          height : currentHeight,
          display: 'block'
        });
        isFixed = true;
      } else if (!shouldBeFixed && isFixed) {
        nav.css({
          position: 'static'
        });
        navPlaceholder.css({
          display: 'none'
        });
        isFixed = false;
      }
    });
    $w.resize(function() {
      if(isFixed) {
        nav.css({
          left: shoptitle.offset().left
        });
      }
    });
  }
});
/* Fast search input ------------------------ */
function showOrHideFastSearchInput() {
  if($('.fastsearchinput').css('display') == 'none') {
    $('.fastsearchinput').css('display', 'block');
    $('#hamburgercontent').css('opacity', '0.5');
    $('#fastsearchinputlayer').css('display', 'block');
    $('#hamburgercontainer').bind('touchmove', function(e){
      e.preventDefault();
    });
    //disable scrolling
    $('.fastsearchinput').animate({
      "top": ["46px", 'easeOutExpo']
    }
    , {
      duration: 300
    });
  } else {
    hideFastSearchInput();
  }
}
function hideFastSearchInput() {
  $('#hamburgercontainer').unbind('touchmove');
  //enable scrolling
  $('.fastsearchinput').animate({
    "top": ["-16px", 'easeOutExpo']
  }
  , {
    duration: 300,
    complete: function() {
      $('#fastsearchinputlayer').css('display', 'none');
      $('.fastsearchinput').css('display', 'none');
      $('#hamburgercontent').css('opacity', '1');
    }
  });
}
$(document).ready(function() {
  $('#fastsearchinputicon').click(showOrHideFastSearchInput);
  $('#fastsearchinputlayer').click(hideFastSearchInput);
});
/* Hamburger menu -------------------------- */
$(document).ready(function() {
  //Open the hamburger menu
  $("#hamburgerbutton").click(function() {
    var contentWidth = $('#hamburgercontent').width();
    var contentHeight = $(window).height();
    $('#hamburgercontent').css('width', contentWidth);
    $('#hamburgercontent').css('min-height', contentHeight);
    $('#hamburgercontentlayer').css('display', 'block');
    $('#hamburgernav').css('display', 'block');
    $('#hamburgercontainer').bind('touchmove', function(e){
      e.preventDefault();
    });
    //disable scrolling
    $("#hamburgercontainer").animate({
      "marginLeft": ["70%", 'easeOutExpo']
    }
    , {
      duration: 700
    });
  });
  //close the menu
  $("#hamburgercontentlayer").click(function() {
    $('#hamburgercontainer').unbind('touchmove');
    //enable scrolling
    $("#hamburgercontainer").animate({
      "marginLeft": ["0", 'easeOutExpo']
    }
    , {
      duration: 700,
      complete: function() {
        $('#hamburgercontent').css('width', 'auto');
        $('#hamburgercontentlayer').css('display', 'none');
        $('#hamburgernav').css('display', 'none');
      }
    });
  });
});


/********************
  *    productlist    *
  ********************/
var productList_pageCounter = 2;
var productList_productsCache = "";
var productList_updateLink = "";
var productList_reinitCounter = 0;
function loadProductsCache() {
  var link = productList_updateLink.replace("PLACEHOLDERPAGENR", productList_pageCounter);
  $.get(link, function(data) {
    var response = readPLInfos(data);
    if(response.plInfos.data("productlist-forcereinit")) {
      if(productList_reinitCounter++ >= 20) {
        //if theres a problem and this code ends in an endless loop -> break after 20 reinits
        location.reload();
      } else {
        if(document.cookie != null && document.cookie.length > 0) {
          var forms = $(".productlistform");
          var formsCounter = 0;
          if(forms.length) {
            forms.each(function() {
              $.ajax({
                "url": $(this).attr("action"),
                "type": "POST",
                "data": $(this).serialize(),
                "success": function(data2) {
                  readPLInfos(data2);
                  if(++formsCounter == forms.length) {
                    loadProductsCache();
                  }
                }
                ,
                "error": function() {
                  location.reload();
                }
              });
            });
          } else {
            $.get(window.location.href, function(data) {
              var response = readPLInfos(data);
              if(response.plInfos.length) {
                loadProductsCache();
              } else {
                location.reload();
              }
            });
          }
        } else {
          //load more does not work without cookie, do not refresh or reaload or try to get more products from server
          $(".productlist-loadmorebutton-container .button").hide();
        }
      }
    } else {
      response.plInfos.remove();
      productList_productsCache = response.dataHtml;
      productList_pageCounter++;
    }
  }
  )
}
function readPLInfos(data) {
  var dataHtml = $.parseHTML(data);
  var dom = $("<mydom></mydom>").append(dataHtml);
  var plInfos = $(".productlist-info", dom);
  if(plInfos.length) {
    productList_updateLink = plInfos.data("productlist-updatelink");
  }
  var result = {
  };
  result.plInfos = plInfos;
  result.dataHtml = dataHtml;
  return result;
}
function loadMoreProducts() {
  if(productList_productsCache == "") {
    loadProductsCache();
  } else {
    $(".productlist .productlist-loadmorebutton-container").remove();
    $(".productlist").append(productList_productsCache);
    productList_productsCache = "";
    if($(".productlist .productlist-loadmorebutton-container").length) {
      $(".productlist-loadmorebutton-container .button").click(function() {
        loadMoreProducts();
      });
      loadProductsCache();
    }
  }
}
$(document).ready(function() {
  var plInfos = $(".productlist-info").last();
  if(plInfos.length) {
    productList_updateLink = plInfos.data("productlist-updatelink");
    plInfos.remove();
    $(".productlist-loadmorebutton-container .button").click(function() {
      loadMoreProducts();
    });
    loadProductsCache();
  }
});
