!function($){var t={init:function(t){return this.each((function(){var e={id:"",type:"scroll",scroll_direction:"left",scroll_speed:10,scroll_pause:0,scroll_spacing:40,scroll_units:10,scroll_init:0,scroll_init_delay:2,scroll_loop:1,rotate_type:"fade",auto_rotate:0,rotate_delay:10,rotate_pause:0,rotate_speed:10,rotate_ease:"easeOutExpo",nav_reverse:0,disable_touchswipe:0,offset:20,before_change:function(){},after_change:function(){},after_load:function(){}},i={id:e.id,tick_count:0,previous_tick:0,current_tick:0,next_tick:0,reverse:0,running:0,paused:0};t&&$.extend(e,t);var n,r,s,a=$(this),o=a.find(".mtphr-dnt-tick-contents"),c=a.find(".mtphr-dnt-nav-prev"),p=a.find(".mtphr-dnt-nav-next"),l=a.find(".mtphr-dnt-control-links"),_=a.find(".mtphr-dnt-play-pause"),u=o.outerWidth(!0),f=0,d=[],h=!0,g=e.rotate_type,v=!0,m=.13;function k(){i.tick_count=o.find(".mtphr-dnt-tick").length,i.tick_count>0&&("scroll"===e.type?function(){var t=o.find(".mtphr-dnt-tick:first");if(t.attr("style")){var n=t.attr("style").split("width:");h=!(n.length>1)}d=[],o.find("img").length?o.imagesLoaded((function(){y(),o.find(".mtphr-dnt-tick").each((function(){$(this).show();var t=[{headline:$(this)}];d.push(t)})),D(),x()})):(y(),o.find(".mtphr-dnt-tick").each((function(){$(this).show();var t=[{headline:$(this)}];d.push(t)})),D(),x());o.on({mouseenter:function(){e.scroll_pause&&w()},mouseleave:function(){e.scroll_pause&&!i.paused&&b()}}),o.find("a").on("click",(function(){e.scroll_pause&&!i.paused&&b()}))}():"rotate"===e.type&&function(){switch(o.find(".mtphr-dnt-tick").each((function(){d.push($(this)),$(this).imagesLoaded((function(){O()}))})),O(),o.find(".mtphr-dnt-tick").show(),e.rotate_type){case"fade":!function(t,e){var i=e[0],n=i.height();t.css("height",n+"px"),i.css({opacity:1,left:"auto"})}(o,d,parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_left":!function(t,e){var i=e[0],n=i.height();t.css("height",n+"px"),i.css({opacity:1,left:0})}(o,d,parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_right":!function(t,e){var i=e[0],n=i.height();t.css("height",n+"px"),i.css({opacity:1,left:0})}(o,d,parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_down":!function(t,e){var i=e[0],n=i.height();t.css("height",n+"px"),i.css({opacity:1,top:0,left:"auto"})}(o,d,parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_up":!function(t,e){var i=e[0],n=i.height();t.css({height:n+"px",left:"auto"}),i.css({opacity:1,top:0})}(o,d,parseInt(100*e.rotate_speed),e.rotate_ease)}j(0),e.auto_rotate&&E();o.on({mouseenter:function(){e.auto_rotate&&e.rotate_pause&&!i.running&&L()},mouseleave:function(){e.auto_rotate&&e.rotate_pause&&!i.running&&!i.paused&&E()}}),o.find("a").on("click",(function(){e.auto_rotate&&e.rotate_pause&&!i.running&&!i.paused&&E()}))}()),e.after_load.call(a,o),a.trigger("mtphr_dnt_after_load_single",[i,d]),$("body").trigger("mtphr_dnt_after_load",[a,i,d])}function y(){o.find(".mtphr-dnt-tick").each((function(){$(this).height()>f&&(f=$(this).height()),"up"!==e.scroll_direction&&"down"!==e.scroll_direction||$(this).css("height","auto")})),o.css("height",f+"px")}function w(){clearTimeout(s),cancelAnimationFrame(n)}function b(){x()}function x(){clearTimeout(s),cancelAnimationFrame(n),n=requestAnimationFrame((function t(){for(var r=0;r<i.tick_count;r++)if(!0===d[r][0].visible){var a="reset";"left"===e.scroll_direction||"right"===e.scroll_direction?("reset"===(a="left"===e.scroll_direction?I(r):F(r))?(a=d[r][0].reset,d[r][0].headline.css("opacity",0)):d[r][0].headline.css("opacity",1),d[r][0].headline.css({transform:"translateX("+a+"px)"})):("reset"===(a="up"===e.scroll_direction?T(r):A(r))?(a=d[r][0].reset,d[r][0].headline.css("opacity",0)):d[r][0].headline.css("opacity",1),d[r][0].headline.css({transform:"translateY("+a+"px)"})),d[r][0].position=a}e.scroll_init&&v?(v=!1,s=setTimeout((function(){n=requestAnimationFrame(t)}),1e3*e.scroll_init_delay)):(v=!1,n=requestAnimationFrame(t))}))}function I(t){var i=parseFloat(d[t][0].position-e.scroll_speed*m);return i<-(d[t][0].headline.width()+e.offset)?i=X(t):i<parseFloat(u-d[t][0].headline.width()-e.scroll_spacing)&&W(t),i}function F(t){var i=parseFloat(d[t][0].position+e.scroll_speed*m);return i>u+e.offset?i=X(t):i>e.scroll_spacing&&W(t),i}function T(t){var i=parseFloat(d[t][0].position-e.scroll_speed*m);return i<-(d[t][0].headline.height()+e.offset)?i=X(t):i<f-d[t][0].headline.height()-e.scroll_spacing&&W(t),i}function A(t){var i=parseFloat(d[t][0].position+e.scroll_speed*m);return i>f+e.offset?i=X(t):i>e.scroll_spacing&&W(t),i}function X(t){return i.tick_count>1&&(d[t][0].visible=!1),i.tick_count===t+1&&(a.trigger("mtphr_dnt_scroll_complete",[i,d]),$("body").trigger("mtphr_dnt_scroll_complete",[a,i,d])),"reset"}function Y(t){!1===d[t][0].visible&&(i.previous_tick=parseInt(t-1),i.previous_tick<0&&(i.previous_tick=parseInt(i.tick_count-1)),i.current_tick=t,i.next_tick=parseInt(t+1),i.next_tick>=i.tick_count&&(i.next_tick=0))}function W(t){t===i.tick_count-1?e.scroll_loop&&(Y(0),d[0][0].visible=!0):(Y(parseInt(t+1)),d[t+1][0].visible=!0)}function C(){for(var t=0;t<i.tick_count;t++){var n,r=d[t][0].headline;switch(e.scroll_direction){case"left":n=u+e.offset,!1===d[t][0].visible&&r.css("transform","translateX("+n+"px)");break;case"right":n=parseInt("-"+(r.width()+e.offset)),!1===d[t][0].visible&&r.css("transform","translateX("+n+"px)");break;case"up":h&&r.css("width",u),n=parseInt(f+e.offset),!1===d[t][0].visible&&r.css("transform","translateY("+n+"px)");break;case"down":h&&r.css("width",u),n=parseInt("-"+(r.height()+e.offset)),!1===d[t][0].visible&&r.css("transform","translateY("+n+"px)")}d[t][0].width=r.width(),d[t][0].height=r.height(),!1===d[t][0].visible&&(d[t][0].position=n),d[t][0].reset=n}}function D(){for(var t,n,r=0;r<i.tick_count;r++)if(d[r]){switch(n=d[r][0].headline,e.scroll_direction){case"left":t=u+e.offset,n.css("transform","translateX("+t+"px)");break;case"right":t=parseInt("-"+(n.width()+e.offset)),n.css("transform","translateX("+t+"px)");break;case"up":h&&n.css("width",u),t=parseInt(f+e.offset),n.css("transform","translateY("+t+"px)");break;case"down":h&&n.css("width",u),t=parseInt("-"+(n.height()+e.offset)),n.css("transform","translateY("+t+"px)")}d[r][0].width=n.width(),d[r][0].height=n.height(),d[r][0].position=t,d[r][0].reset=t,d[r][0].visible=!1,n=d[r][0].headline}if(i.current_tick=0,d[i.current_tick][0].visible=!0,e.scroll_init)for("left"===e.scroll_direction?t=0:"right"===e.scroll_direction?t=u:"up"===e.scroll_direction?t=0:"down"===e.scroll_direction&&(t=f),r=0;r<i.tick_count;r++)switch(n=d[r][0].headline,e.scroll_direction){case"left":t<u&&(n.css("transform","translateX("+t+"px)"),d[r][0].position=t,d[r][0].visible=!0,t=t+d[r][0].width+e.scroll_spacing);break;case"right":t>0&&(t-=d[r][0].width,n.css("transform","translateX("+t+"px)"),d[r][0].position=t,d[r][0].visible=!0,t-=e.scroll_spacing);break;case"up":t<f&&(n.css("transform","translateY("+t+"px)"),d[r][0].position=t,d[r][0].visible=!0,t=t+d[r][0].height+e.scroll_spacing);break;case"down":t>0&&(n.css("transform","translateY("+t+"px)"),n.stop(!0,!0).css("top",t+"px"),d[r][0].position=t,d[r][0].visible=!0,t-=e.scroll_spacing)}}function E(){q()}function L(){clearInterval(r)}function q(){L(),r=setInterval((function(){var t=parseInt(i.current_tick+1);t===i.tick_count&&(t=0),z(t)}),parseInt(1e3*e.rotate_delay))}function z(t){i.current_tick!==t&&(e.auto_rotate&&L(),i.next_tick=t,e.before_change.call(a,o),a.trigger("mtphr_dnt_before_change_single",[i,d]),$("body").trigger("mtphr_dnt_before_change",[a,i,d]),i.running=1,function(t){switch(g){case"fade":!function(t,i,n,r,s){i.stop().animate({opacity:0},r,s,(function(){$(this).css({left:parseFloat(u+e.offset)+"px"}),i.remove(),t.append(i)}))}(o,$(d[i.current_tick]),$(d[t]),parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_left":!function(t,i,n,r,s){i.stop().animate({left:"-"+parseFloat(u+e.offset)+"px"},r,s,(function(){i.css({opacity:0}),i.remove(),t.append(i)}))}(o,$(d[i.current_tick]),$(d[t]),parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_right":!function(t,i,n,r,s){i.stop().animate({left:parseFloat(u+e.offset)+"px"},r,s,(function(){i.css({opacity:0}),i.remove(),t.append(i)}))}(o,$(d[i.current_tick]),$(d[t]),parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_down":!function(t,i,n,r,s){var a=n.height();i.stop().animate({top:parseFloat(a+e.offset)+"px"},r,s,(function(){i.css({opacity:0}),i.remove(),t.append(i)}))}(o,$(d[i.current_tick]),$(d[t]),parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_up":!function(t,i,n,r,s){var a=i.height();i.stop().animate({top:"-"+parseFloat(a+e.offset)+"px"},r,s,(function(){i.css({opacity:0}),i.remove(),t.append(i)}))}(o,$(d[i.current_tick]),$(d[t]),parseInt(100*e.rotate_speed),e.rotate_ease)}}(t),function(t){switch(j(t),g){case"fade":!function(t,e,i,n,r){e.css({opacity:0,left:"auto"}),e.stop().animate({opacity:1},n,r);var s=e.height();t.stop().animate({height:s+"px"},n,r)}(o,$(d[t]),$(d[i.current_tick]),parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_left":!function(t,i,n,r,s){var a=i.height();i.css({opacity:1,left:parseFloat(u+e.offset)+"px"}),t.stop().animate({height:a+"px"},r,s,(function(){})),i.stop().animate({left:"0"},r,s,(function(){}))}(o,$(d[t]),$(d[i.current_tick]),parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_right":!function(t,i,n,r,s){var a=i.height();i.css({opacity:1,left:"-"+parseFloat(u+e.offset)+"px"}),t.stop().animate({height:a+"px"},r,s,(function(){})),i.stop().animate({left:"0"},r,s)}(o,$(d[t]),$(d[i.current_tick]),parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_down":!function(t,i,n,r,s){var a=i.height();i.css({opacity:1,top:"-"+parseFloat(a+e.offset)+"px",left:"auto"}),t.stop().animate({height:a+"px"},r,s),i.stop().animate({top:"0"},r,s)}(o,$(d[t]),$(d[i.current_tick]),parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_up":!function(t,i,n,r,s){var a=i.height();i.css({opacity:1,top:parseFloat(n.height()+e.offset)+"px",left:"auto"}),t.stop().animate({height:a+"px"},r,s),i.stop().animate({top:"0"},r,s)}(o,$(d[t]),$(d[i.current_tick]),parseInt(100*e.rotate_speed),e.rotate_ease)}}(t),i.previous_tick=i.current_tick,i.current_tick=t,setTimeout((function(){e.after_change.call(a,o),a.trigger("mtphr_dnt_after_change_single",[i,d]),$("body").trigger("mtphr_dnt_after_change",[a,i,d]),g=e.rotate_type,i.reverse=0,i.running=0,e.auto_rotate&&!i.paused&&q()}),parseInt(100*e.rotate_speed)))}function j(t){l&&(l.children("a").removeClass("active"),l.children('a[href="'+t+'"]').addClass("active"))}function O(){for(var t=0;t<i.tick_count;t++)$(d[t]).width(u+"px"),i.current_tick!==t&&$(d[t]).css({left:parseFloat(u+e.offset)+"px"});var n=$(d[i.current_tick]).height();o.stop().css("height",n+"px")}function M(){if(i.running)return!1;var t=parseInt(i.current_tick+1);t===i.tick_count&&(t=0),z(t)}function Q(){if(i.running)return!1;var t=parseInt(i.current_tick-1);t<0&&(t=i.tick_count-1),e.nav_reverse&&("slide_left"===e.rotate_type?g="slide_right":"slide_right"===e.rotate_type?g="slide_left":"slide_down"===e.rotate_type?g="slide_up":"slide_up"===e.rotate_type&&(g="slide_down"),i.reverse=1),z(t)}function B(t){t?(i.paused=!1,_.removeClass("paused"),"scroll"===e.type?b():E()):(i.paused=!0,_.addClass("paused"),"scroll"===e.type?w():L()),a.trigger("mtphr_dnt_play_pause",[i,d])}if(o.data("ditty:vars",i),c&&"rotate"===e.type&&(c.on("click",(function(t){t.preventDefault(),Q()})),p.on("click",(function(t){t.preventDefault(),M()}))),l&&"rotate"===e.type&&l.children("a").on("click",(function(t){t.preventDefault();var n=parseInt($(this).attr("href"));if(i.running)return!1;if(n===i.current_tick)return!1;var r=n<i.current_tick?1:0;e.nav_reverse&&r&&("slide_left"===e.rotate_type?g="slide_right":"slide_right"===e.rotate_type?g="slide_left":"slide_down"===e.rotate_type?g="slide_up":"slide_up"===e.rotate_type&&(g="slide_down"),i.reverse=1),z(n)})),_.on("click",(function(t){t.preventDefault(),B(i.paused)})),"rotate"!==e.type||e.disable_touchswipe||(o[0].addEventListener("swiped-left",(function(){!function(){if(i.running)return!1;var t=parseInt(i.current_tick+1);t===i.tick_count&&(t=0),"slide_left"!==e.rotate_type&&"slide_right"!==e.rotate_type||(g="slide_left"),z(t)}()})),o[0].addEventListener("swiped-right",(function(){!function(){if(i.running)return!1;var t=parseInt(i.current_tick-1);t<0&&(t=i.tick_count-1),"slide_left"!==e.rotate_type&&"slide_right"!==e.rotate_type||(g="slide_right"),e.nav_reverse&&("slide_down"===e.rotate_type?g="slide_up":"slide_up"===e.rotate_type&&(g="slide_down"),i.reverse=1),z(t)}()}))),a.on("mtphr_dnt_next",(function(){M()})),a.on("mtphr_dnt_prev",(function(){Q()})),a.on("mtphr_dnt_goto",(function(t,e){z(parseInt(e))})),a.on("mtphr_dnt_pause",(function(){B()})),a.on("mtphr_dnt_play",(function(){B(!0)})),$(window).on("resize",(function(){o.outerWidth()!==u&&(u=o.outerWidth(!0),"scroll"===e.type?("up"===e.scroll_direction||"down"===e.scroll_direction)&&h?D():C():"rotate"===e.type&&O())})),a.on("mtphr_dnt_resize_single",(function(t,i){u=o.outerWidth(!0),"scroll"===e.type?(i&&D(),C()):"rotate"===e.type&&O()})),$("body").on("mtphr_dnt_resize",(function(t,i){i&&i.indexOf(e.id)>=0&&("scroll"===e.type?C():"rotate"===e.type&&O())})),a.on("mtphr_dnt_replace_ticks",(function(t,e,i){clearTimeout(s),cancelAnimationFrame(n),a.find(".mtphr-dnt-tick").remove(),e.each((function(){o.append($(this))})),setTimeout((function(){k()}),i)})),0===a.width()){var G=!0;setTimeout((function t(){a.width()>10&&(G=!1,u=o.outerWidth(!0),k()),G&&setTimeout(t,100)}),100)}else k()}))}};$.fn.ditty_news_ticker=function(e){if(t[e])return t[e].apply(this,Array.prototype.slice.call(arguments,1));if("object"!=typeof e&&e)throw new Error("Method "+e+" does not exist in ditty_news_ticker");return t.init.apply(this,arguments)}}(jQuery);