!function(a){a.fn.countDown=function(b){return config={},a.extend(config,b),diffSecs=this.setCountDown(config),config.onComplete&&a.data(a(this)[0],"callback",config.onComplete),config.omitWeeks&&a.data(a(this)[0],"omitWeeks",config.omitWeeks),a("#"+a(this).attr("id")+" .fusion-digit").html('<div class="top"></div><div class="bottom"></div>'),a(this).doCountDown(a(this).attr("id"),diffSecs,500),this},a.fn.stopCountDown=function(){clearTimeout(a.data(this[0],"timer"))},a.fn.startCountDown=function(){this.doCountDown(a(this).attr("id"),a.data(this[0],"diffSecs"),500)},a.fn.setCountDown=function(b){var c=new Date;b.targetDate?c=new Date(b.targetDate.month+"/"+b.targetDate.day+"/"+b.targetDate.year+" "+b.targetDate.hour+":"+b.targetDate.min+":"+b.targetDate.sec+(b.targetDate.utc?" UTC":"")):b.targetOffset&&(c.setFullYear(b.targetOffset.year+c.getFullYear()),c.setMonth(b.targetOffset.month+c.getMonth()),c.setDate(b.targetOffset.day+c.getDate()),c.setHours(b.targetOffset.hour+c.getHours()),c.setMinutes(b.targetOffset.min+c.getMinutes()),c.setSeconds(b.targetOffset.sec+c.getSeconds()));var d=new Date;if(b.gmtOffset){var e=60*b.gmtOffset*6e4,f=6e4*d.getTimezoneOffset();d=new Date(d.getTime()+e+f)}return diffSecs=Math.floor((c.valueOf()-d.valueOf())/1e3),a.data(this[0],"diffSecs",diffSecs),diffSecs},a.fn.doCountDown=function(b,c,d){$this=a("#"+b),c<=0&&(c=0,$this.data("timer")&&clearTimeout($this.data("timer"))),secs=c%60,mins=Math.floor(c/60)%60,hours=Math.floor(c/60/60)%24,1==$this.data("omitWeeks")?(days=Math.floor(c/60/60/24),weeks=Math.floor(c/60/60/24/7)):(days=Math.floor(c/60/60/24)%7,weeks=Math.floor(c/60/60/24/7)),days>99&&$this.find(".fusion-dash-days").find(".fusion-hundred-digit").css("display","inline-block"),days>999&&$this.find(".fusion-dash-days").find(".fusion-thousand-digit").css("display","inline-block"),weeks>99&&$this.find(".fusion-dash-weeks").find(".fusion-hundred-digit").css("display","inline-block"),$this.dashChangeTo(b,"fusion-dash-seconds",secs,d||800),$this.dashChangeTo(b,"fusion-dash-minutes",mins,d||1200),$this.dashChangeTo(b,"fusion-dash-hours",hours,d||1200),$this.dashChangeTo(b,"fusion-dash-days",days,d||1200),$this.dashChangeTo(b,"fusion-dash-weeks",weeks,d||1200),a.data($this[0],"diffSecs",c),c>0?(e=$this,t=setTimeout(function(){e.doCountDown(b,c-1)},1e3),a.data(e[0],"timer",t)):(cb=a.data($this[0],"callback"))&&a.data($this[0],"callback")()},a.fn.dashChangeTo=function(b,c,d,e){$this=a("#"+b);for(var f=$this.find("."+c+" .fusion-digit").length-1;f>=0;f--){var g=d%10;d=(d-g)/10,$this.digitChangeTo("#"+$this.attr("id")+" ."+c+" .fusion-digit:eq("+f+")",g,e)}},a.fn.digitChangeTo=function(b,c,d){var e=a(b+" div.top"),f=a(b+" div.bottom");d||(d=800),e.html()!=c+""&&e.not(":animated").length&&(e.css({display:"none"}),e.html(c||"0").fadeOut(d,function(){f.html(e.html()),f.css({display:"block",height:"auto"}),e.css({display:"none"})}))}}(jQuery);