!function(p){p.fn.ticker=function(e){var m=p.extend({},p.fn.ticker.defaults,e);if(0==p(this).length)return window.console&&window.console.log?window.console.log("Element does not exist in DOM!"):alert("Element does not exist in DOM!"),!1;var i="#"+p(this).attr("id"),s=p(this).get(0).tagName;return this.each(function(){var e=(new Date).getTime(),l={position:0,time:0,distance:0,newsArr:{},play:!0,paused:!1,contentLoaded:!1,dom:{contentID:"#ticker-content-"+e,titleID:"#ticker-title-"+e,titleElem:"#ticker-title-"+e+" SPAN",tickerID:"#ticker-"+e,wrapperID:"#ticker-wrapper-"+e,revealID:"#ticker-swipe-"+e,revealElem:"#ticker-swipe-"+e+" SPAN",controlsID:"#ticker-controls-"+e,prevID:"#prev-"+e,nextID:"#next-"+e,playPauseID:"#play-pause-"+e}};if("UL"!=s&&"OL"!=s&&!0===m.htmlFeed)return r("Cannot use <"+s.toLowerCase()+"> type of element for this plugin - must of type
or "),!1;function a(e){var t,o=0;for(t in e)e.hasOwnProperty(t)&&o++;return o}function r(e){m.debugMode&&(window.console&&window.console.log?window.console.log(e):alert(e))}function c(){var e;l.contentLoaded=!0,p(l.dom.titleElem).html(l.newsArr["item-"+l.position].type),p(l.dom.contentID).html(l.newsArr["item-"+l.position].content),l.position==a(l.newsArr)-1?l.position=0:l.position++,distance=p(l.dom.contentID).width(),time=distance/m.speed,p(l.dom.contentID).css("opacity","1"),l.play&&(e=p(l.dom.titleID).width()+20,p(l.dom.revealID).css(m.direction,e+"px"),"fade"==m.displayType?p(l.dom.revealID).hide(0,function(){p(l.dom.contentID).css(m.direction,e+"px").fadeIn(m.fadeInSpeed,t)}):"scroll"==m.displayType||p(l.dom.revealElem).show(0,function(){p(l.dom.contentID).css(m.direction,e+"px").show(),animationAction="right"==m.direction?{marginRight:distance+"px"}:{marginLeft:distance+"px"},p(l.dom.revealID).css("margin-"+m.direction,"0px").delay(20).animate(animationAction,time,"linear",t)}))}function t(){l.play?(p(l.dom.contentID).delay(m.pauseOnItems).fadeOut(m.fadeOutSpeed),"fade"==m.displayType?p(l.dom.contentID).fadeOut(m.fadeOutSpeed,function(){p(l.dom.wrapperID).find(l.dom.revealElem+","+l.dom.contentID).hide().end().find(l.dom.tickerID+","+l.dom.revealID).show().end().find(l.dom.tickerID+","+l.dom.revealID).removeAttr("style"),c()}):p(l.dom.revealID).hide(0,function(){p(l.dom.contentID).fadeOut(m.fadeOutSpeed,function(){p(l.dom.wrapperID).find(l.dom.revealElem+","+l.dom.contentID).hide().end().find(l.dom.tickerID+","+l.dom.revealID).show().end().find(l.dom.tickerID+","+l.dom.revealID).removeAttr("style"),c()})})):p(l.dom.revealElem).hide()}function o(){l.play=!1,p(l.dom.tickerID+","+l.dom.revealID+","+l.dom.titleID+","+l.dom.titleElem+","+l.dom.revealElem+","+l.dom.contentID).stop(!0,!0),p(l.dom.revealID+","+l.dom.revealElem).hide(),p(l.dom.wrapperID).find(l.dom.titleID+","+l.dom.titleElem).show().end().find(l.dom.contentID).show()}function n(){l.play=!0,l.paused=!1,t()}function d(e){switch(o(),e){case"prev":0==l.position?l.position=a(l.newsArr)-2:1==l.position?l.position=a(l.newsArr)-1:l.position=l.position-2,p(l.dom.titleElem).html(l.newsArr["item-"+l.position].type),p(l.dom.contentID).html(l.newsArr["item-"+l.position].content);break;case"next":p(l.dom.titleElem).html(l.newsArr["item-"+l.position].type),p(l.dom.contentID).html(l.newsArr["item-"+l.position].content)}l.position==a(l.newsArr)-1?l.position=0:l.position++}"rtl"==m.direction?m.direction="right":m.direction="left",function(){if(0==l.contentLoaded)if(m.ajaxFeed)"xml"==m.feedType?p.ajax({url:m.feedUrl,cache:!1,dataType:m.feedType,async:!0,success:function(e){for(var t=count=0;t'+d+""},count++,i=d=!1)}if(a(l.newsArr<1))return r("Couldn't find any content from the XML feed for the ticker to use!"),!1;l.contentLoaded=!0,c()}}):r("Code Me!");else{if(!m.htmlFeed)return r("The ticker is set to not use any types of content! Check the settings for the ticker.");{if(!(0'),p(l.dom.wrapperID).children().remove(),p(l.dom.wrapperID).append('
\x3c!-- --\x3e
\x3c!-- --\x3e
'),p(l.dom.wrapperID).removeClass("no-js").addClass("ticker-wrapper has-js "+m.direction),p(l.dom.tickerElem+","+l.dom.contentID).hide(),m.controls&&(p(l.dom.controlsID).on("click mouseover mousedown mouseout mouseup",function(e){var t=e.target.id;if("click"==e.type)switch(t){case l.dom.prevID.replace("#",""):l.paused=!0,p(l.dom.playPauseID).addClass("paused"),d("prev");break;case l.dom.nextID.replace("#",""):l.paused=!0,p(l.dom.playPauseID).addClass("paused"),d("next");break;case l.dom.playPauseID.replace("#",""):1==l.play?(l.paused=!0,p(l.dom.playPauseID).addClass("paused"),o()):(l.paused=!1,p(l.dom.playPauseID).removeClass("paused"),n())}else"mouseover"==e.type&&p("#"+t).hasClass("controls")?p("#"+t).addClass("over"):"mousedown"==e.type&&p("#"+t).hasClass("controls")?p("#"+t).addClass("down"):"mouseup"==e.type&&p("#"+t).hasClass("controls")?p("#"+t).removeClass("down"):"mouseout"==e.type&&p("#"+t).hasClass("controls")&&p("#"+t).removeClass("over")}),p(l.dom.wrapperID).append('')),"fade"!=m.displayType&&p(l.dom.contentID).on("mouseover",function(){0==l.paused&&o()}).mouseout(function(){0==l.paused&&n()}),m.ajaxFeed||c()})},p.fn.ticker.defaults={speed:.1,ajaxFeed:!1,feedUrl:"",feedType:"xml",displayType:"reveal",htmlFeed:!0,debugMode:!0,controls:!0,titleText:"Latest",direction:"ltr",pauseOnItems:3e3,fadeInSpeed:600,fadeOutSpeed:300}}(jQuery);