/**
 * @project         ViO
 * @copyright       argonauten G2 GmbH
 */
(function($){$.fn.resizeHeight=function(){var $$=$(this);var newHeight_;newHeight_=window.innerHeight;if(document.body.clientHeight){newHeight_=document.body.clientHeight}if($$.attr('id')!="container_about"){if(newHeight_<940)newHeight_=940}else{if(newHeight_<850)newHeight_=850}$$.css({"height":newHeight_+"px"})};$.fn.resizeFullheight=function(){var $$=$(this);var newHeight_=document.documentElement.scrollHeight;$$.css({"height":newHeight_+"px"})}}(jQuery));(function($){$.distancefromfold=function($element,settings){if(settings.container===undefined||settings.container===window){var value_=$(window).height()+$(window).scrollTop()}else{var value_=$(settings.container).offset().top+$(settings.container).height()}return(value_)-$element.offset().top};$.belowthefold=function($element,settings){if(settings.container===undefined||settings.container===window){var value_=$(window).height()+$(window).scrollTop()}else{var value_=$(settings.container).offset().top+$(settings.container).height()}return value_<=$element.offset().top-settings.threshold};$.abovethetop=function($element,settings){if(settings.container===undefined||settings.container===window){var value_=$(window).scrollTop()}else{var value_=$(settings.container).offset().top}return value_>=$element.offset().top+settings.threshold+$element.height()};$.inview=function($element,settings){return($.abovethetop($element,settings)!=true&&$.belowthefold($element,settings)!=true)}})(jQuery);(function($){$.fn.Scrollable=function(settings){var config={threshold:-100,offset_scroll:6,offset_intertia:.15,left:50,isPixel:false,scroll:true};if(settings)$.extend(config,settings);this.each(function(){var $self=$(this),$id=$self.attr('id');if(config.scroll==true)_scroll_background();if($.Mobile||$.Unsupported){$self.css({backgroundAttachment:'scroll'})}else{$(window).bind('pagescroll',function(e){if($.inview($self,{threshold:config.threshold})){if(!$self.hasClass('activeElement')){$self.addClass('activeElement');$self.triggerHandler($.Events.SCROLL_ENTER)}if(config.scroll==true)_scroll_background();$self.triggerHandler($.Events.SCROLL,$.distancefromfold($self,{threshold:config.threshold})-config.threshold)}else{if($self.hasClass('activeElement')){$self.removeClass('activeElement');$self.triggerHandler($.Events.SCROLL_LEAVE)}}})}function _scroll_background(){if(config.scroll==true){if(config.isPixel==true){var _x=config.left+'px '}else{var _x=config.left+'% '}var bpos=_x+(-($.distancefromfold($self,{threshold:config.threshold})-config.threshold)*config.offset_intertia)+'px';$self.css({'backgroundPosition':bpos})}}});return this}}(jQuery));(function($){$.Events={SECTION_ENTER:'sectionEnter',SCROLL_TO:'scrollTo',SCROLL:'windowScroll',SCROLL_ENTER:'windowScrollEnter',SCROLL_LEAVE:'windwScrollLeave'}})(jQuery);(function($){$.fn.StartBackground=function(){$(this).each(function(){var $self=$(this);$self.Scrollable({threshold:800,offset_intertia:0.15})});return this};$.fn.StartTeaser=function(){$(this).each(function(){var $self=$(this);$self.Scrollable({threshold:520,offset_intertia:0.15,scroll:false});$self.bind($.Events.SCROLL,on_scroll);function on_scroll(e,distance){var bpos=($(window).height()/2-distance/3);$self.css({'top':bpos+'px'})}});return this};$.fn.Background=function(treshold_,offset_intertia_,left_,isPixel_){$(this).each(function(){var $self=$(this);$self.Scrollable({threshold:treshold_,offset_intertia:offset_intertia_,left:left_,isPixel:isPixel_})});return this};$.fn.GastroBottles=function(treshold_,offset_intertia_,left_){$(this).each(function(){var $self=$(this);$self.Scrollable({threshold:treshold_,offset_intertia:offset_intertia_,left:left_});$self.bind($.Events.SCROLL,on_scroll);function on_scroll(e,distance){var bpos='70% '+(-170+$(window).height()/2-distance/3)+'px';$self.css({'backgroundPosition':bpos})}});return this};$.fn.SortimentBottles=function(treshold_,offset_intertia_,left_){var _offset_intertia=offset_intertia_;$(this).each(function(){var $self=$(this);$self.Scrollable({threshold:treshold_,offset_intertia:offset_intertia_,left:left_,scroll:false});$self.bind($.Events.SCROLL,on_scroll);function on_scroll(e,distance){var windowTop=$(window).scrollTop();var parentTop=$self.parent().offset().top;var newCoord=Math.floor(((windowTop-parentTop)*_offset_intertia)+distance);$self.css({'backgroundPosition':'0 '+newCoord+'px'})}});return this};$.fn.SortimentBottles2=function(treshold_,offset_intertia_,left_){$(this).each(function(){var $self=$(this);$self.Scrollable({threshold:treshold_,offset_intertia:offset_intertia_,left:left_});$self.bind($.Events.SCROLL,on_scroll);function on_scroll(e,distance){var bpos='0 '+($(window).height()/2-distance*1.25)+'px';$self.css({'backgroundPosition':bpos})}});return this};$.fn.BackgroundAbout=function(treshold_,offset_intertia_,left_){$(this).each(function(){var $self=$(this);$self.Scrollable({threshold:treshold_,offset_intertia:offset_intertia_,left:left_});$self.bind($.Events.SCROLL,on_scroll);function on_scroll(e,distance){var bpos='-50px '+(500+$(window).height()/2-distance/3)+'px';$self.css({'backgroundPosition':bpos})}});return this};$.fn.GastroTeaser=function(treshold_,offset_intertia_,left_){$(this).each(function(){var $self=$(this);$self.Scrollable({threshold:treshold_,offset_intertia:offset_intertia_,left:left_});$self.bind($.Events.SCROLL,on_scroll);function on_scroll(e,distance){var bpos=($(window).height()/3-distance/4-250);if(bpos>-78)$self.css({'margin-top':bpos+'px'})}});return this};$.fn.GastroTeaserBottle=function(treshold_,offset_intertia_,left_){$(this).each(function(){var $self=$(this);$self.Scrollable({threshold:treshold_,offset_intertia:offset_intertia_,left:left_});$self.bind($.Events.SCROLL,on_scroll);function on_scroll(e,distance){var bpos='0 '+($(window).height()/2-distance/3)+'px';$self.css({'backgroundPosition':bpos})}});return this};$.fn.PlantTeaser=function(treshold_,offset_intertia_,left_){$(this).each(function(){var $self=$(this);$self.Scrollable({threshold:treshold_,offset_intertia:offset_intertia_,left:left_,scroll:false});$self.bind($.Events.SCROLL,on_scroll);function on_scroll(e,distance){var bpos=($(window).height()/3-distance/4-100);$self.css({'top':bpos+'px'})}});return this};$.fn.BackgroundSmallTVTeaser=function(treshold_,offset_intertia_,left_){$(this).each(function(){var $self=$(this);$self.Scrollable({threshold:treshold_,offset_intertia:offset_intertia_,left:left_,scroll:false});$self.bind($.Events.SCROLL,on_scroll);function on_scroll(e,distance){var bpos=-(distance/3)+120+'px';$self.css({'top':bpos})}});return this};$.fn.TVC=function(treshold_,offset_intertia_,left_){$(this).each(function(){var $self=$(this);$self.Scrollable({threshold:treshold_,offset_intertia:offset_intertia_,left:left_,scroll:false});$self.bind($.Events.SCROLL,on_scroll);function on_scroll(e,distance){var bpos=($(window).height()/3-distance/4-180);$self.css({'top':bpos+'px'})}});return this};$.fn.setActiveNavigation=function(object,activeId){var nav_arr={"#navi_start":22,"#navi_about":45,"#navi_sortiment":68,"#navi_gastro":92,"#navi_plant":121,"#navi_tvc":154};$(object).each(function(){$(this).find('a').removeClass('active')});$(activeId).find('a').addClass('active');var $$=$('#vio_navigation_active');$('#vio_navigation_active').animate({top:nav_arr[activeId]},150,'linear',function(){})};$.fn.goToByScroll=function(activeId){if($(activeId).offset()){var scrollTo_=$(activeId).offset().top;animationRunning=true;if(scrollTo_>document.documentElement.scrollTop)scrollTo_=scrollTo_+1;if(scrollTo_<document.documentElement.scrollTop)scrollTo_=scrollTo_-1;$('html,body').animate({scrollTop:scrollTo_},500,'linear',function(){animationRunning=false})}};$.fn.goTo=function(activeId){if($(activeId).offset()){var scrollTo_=$(activeId).offset().top;animationRunning=true;if(scrollTo_>document.documentElement.scrollTop)scrollTo_=scrollTo_+1;if(scrollTo_<document.documentElement.scrollTop)scrollTo_=scrollTo_-1;$('html,body').css({'scrollTop':scrollTo_})}};$.fn.initParallaxScroll=function(){$('#container_start').StartBackground();$('#content_start_teaser').Background(2450,0.25,50);$('#sortiment_content_bottle4').Background(2200,0.15,0);$('#sortiment_content_bottle3').Background(1450,0.35,0);$('#sortiment_content_bottle2').Background(1250,0.55,0);$('#sortiment_content_bottle1').Background(1120,0.85,0);$('#small_tv_1').Background(1360,0.15,0);$('#small_tv_2').Background(1010,0.25,0);$('#video_teaser').BackgroundSmallTVTeaser(100,0.15,0);$('#about_content_bottleBackground').Background(5920,0.15,0);$('#gastro_teaser').GastroTeaser(200,0.55);$('#gastro_teaser_bottle').GastroTeaserBottle(20,0.15);$('#container_gastro').Background(200,0.35);$('#gastro_content_bottle1').GastroBottles(500,0.25);$('#green_teaser').PlantTeaser(200,0.35);$('#video').TVC(200,0.35)}}(jQuery));
