/**
 * jQuery Plugin to obtain touch gestures from iPhone, iPod Touch and iPad, should also work with Android mobile phones (not tested yet!)
 * Common usage: wipe images (left and right to show the previous or next image)
 * 
 * @author Andreas Waltl, netCU Internetagentur (http://www.netcu.de)
 * @version 1.0 (15th July 2010)
 */
(function($){$.fn.touchwipe=function(settings){var config={min_move_x:20,wipeLeft:function(){alert("left");},wipeRight:function(){alert("right");},preventDefaultEvents:true};if(settings)$.extend(config,settings);this.each(function(){var startX;var isMoving=false;function cancelTouch(){this.removeEventListener('touchmove',onTouchMove);startX=null;isMoving=false;}function onTouchMove(e){if(config.preventDefaultEvents){e.preventDefault();}if(isMoving){var x=e.touches[0].pageX;var dx=startX-x;if(Math.abs(dx)>=config.min_move_x){cancelTouch();if(dx>0){config.wipeLeft();}else{config.wipeRight();}}}}function onTouchStart(e){if(e.touches.length==1){startX=e.touches[0].pageX;isMoving=true;this.addEventListener('touchmove',onTouchMove,false);}}if(document.addEventListener){this.addEventListener('touchstart',onTouchStart,false);}});return this;};})(jQuery);;
(function($){
  Drupal.behaviors.gorton = {
    attach: function (context) {
        if (navigator.userAgent.search('Chrome') != -1) {
          $('#page-wrapper').addClass('chrome');
        }
        if (navigator.userAgent.search('Windows NT 5') != -1) {
          $('#page-wrapper').addClass('xp');
        }
        $("#views_slideshow_cycle_teaser_section_hp_banner-block_1").touchwipe({
          wipeLeft: function() {
              $("#views_slideshow_cycle_teaser_section_hp_banner-block_1").cycle("next");
          },
          wipeRight: function() {
              $("#views_slideshow_cycle_teaser_section_hp_banner-block_1").cycle("prev");
          }
        });
        $("#views_slideshow_cycle_main_hp_banner-block_1").append('<a href="#" class="next">Next</a>');
        if((!navigator.userAgent.match(/iPhone/i)) && (!navigator.userAgent.match(/iPod/i)) && (!navigator.userAgent.match(/iPad/i))) {
          $("#views_slideshow_cycle_main_hp_banner-block_1").hover(
            function() {
              $("#views_slideshow_cycle_main_hp_banner-block_1 a.next").fadeIn();
            },
            function() {
              $("#views_slideshow_cycle_main_hp_banner-block_1 a.next").fadeOut();
            }  
          );
        }
        $("#views_slideshow_cycle_main_hp_banner-block_1").click(function(){
          $("#views_slideshow_cycle_teaser_section_hp_banner-block_1").cycle("next");
          return false;
        });
        
        $(".node-detail .node-body li, .node-detail .node-body ol").wrapInner("<span>");
    }
  }
})(jQuery);

function fadeView() {
   (function($){
    $(".view-work .views-row").fadeOut(1200);
   })(jQuery);
};

