jQuery.fn.delay=function(b,a){return this.queue((a||"fx"),function(){var c=this;setTimeout(function(){jQuery.dequeue(c)},b)})};var MoneysupermarketCustomerSavingsTicker=MoneysupermarketCustomerSavingsTicker||{};MoneysupermarketCustomerSavingsTicker.CustomerSavedTickerView=function(){var q;var b;var a=[0,-240,-480,-720,-960,-1200,-1440,-1680,-1920,-2160];var m=5;var p=40;var c=[],s=[],n,f,i,g;this.setup=function(u,v,x,w){q=x*1000;r(jQuery);jQuery(document).ready(function(){l(u);var y=setInterval(function(){d(v)},q);setTimeout(function(){clearInterval(y)},w*60000)})};function r(v){if(!document.defaultView||!document.defaultView.getComputedStyle){var x=jQuery.curCSS;jQuery.curCSS=function(A,y,B){if(y==="background-position"){y="backgroundPosition"}if(y!=="backgroundPosition"||!A.currentStyle||A.currentStyle[y]){return x.apply(this,arguments)}var z=A.style;if(!B&&z&&z[y]){return z[y]}return x(A,"backgroundPositionX",B)+" "+x(A,"backgroundPositionY",B)}}var w=v.fn.animate;v.fn.animate=function(y){if("background-position" in y){y.backgroundPosition=y["background-position"];delete y["background-position"]}if("backgroundPosition" in y){y.backgroundPosition="("+y.backgroundPosition}return w.apply(this,arguments)};function u(z){z=z.replace(/left|top/g,"0px");z=z.replace(/right|bottom/g,"100%");z=z.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");var y=z.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);return[parseFloat(y[1],10),y[2],parseFloat(y[3],10),y[4]]}v.fx.step.backgroundPosition=function(z){if(!z.bgPosReady){var B=v.curCSS(z.elem,"backgroundPosition");if(!B){B="0px 0px"}B=u(B);z.start=[B[0],B[2]];var y=u(z.options.curAnim.backgroundPosition);z.end=[y[0],y[2]];z.unit=[y[1],y[3]];z.bgPosReady=true}var A=[];A[0]=((z.end[0]-z.start[0])*z.pos)+z.start[0]+z.unit[0];A[1]=((z.end[1]-z.start[1])*z.pos)+z.start[1]+z.unit[1];z.elem.style.backgroundPosition=A[0]+" "+A[1]}}function d(v){var u=o(b.toString());b+=v;var w=o(b.toString());h(u,w)}function h(v,B){if(B.length>v.length){j(B.length)}var u=k(v),z=k(B);for(var w=0,A=z.length;w<A;w++){if(z[w]!=u[w]){e(w,u[w],z[w])}}}function e(z,w,u){var x;switch(z){case 0:x=q/8;break;case 1:x=q/4;break;default:x=q/2;break}x=(x>100)?100:x;var y=a[w];for(var v=0;v<m;v++){y=y-p;if(v==(m-1)){jQuery("#d"+z).delay(x).animate({"background-position":"0 "+y+"px"},0,function(){jQuery("#d"+z).css({"background-position":"0 "+a[u]+"px"},0)})}else{jQuery("#d"+z).delay(x).animate({"background-position":"0 "+y+"px"},0)}}}function k(u){var x=new Array();for(var v=0,z=u.length;v<z;v++){var y=u.length-(v+1),w=u.length-v;x[v]=u.substring(y,w)}return x}function j(v){var u=Number(v)-1;if(u%3==0){jQuery("ul#customers-saved-ticker").prepend('<li class="seperator">,</li>')}jQuery("ul#customers-saved-ticker").prepend('<li id="d'+u+'"></li>');jQuery("#d"+u).css({"background-position":"0 "+a[1]+"px"})}function l(u){b=u;var w=o(u.toString());var x=w.length;var z=1;for(var v=0;v<x;v++){jQuery("ul#customers-saved-ticker").prepend('<li id="d'+v+'"></li>');if(z!=(x)&&z%3==0){jQuery("ul#customers-saved-ticker").prepend('<li class="seperator">,</li>')}z++}jQuery("ul#customers-saved-ticker").prepend('<li class="pound"></li>');var y=k(u.toString());for(var v=0,A=y.length;v<A;v++){jQuery("#d"+v).css({"background-position":"0 "+a[y[v]]+"px"})}}function t(){var u=Math.floor(Math.random()*9)+3;var v="";for(var w=0;w<u;w++){v+=Math.floor(Math.random()*9).toString()}return v}function o(w,v){var u=10;while(w.length<u){w="0"+w}return w}};MoneysupermarketCustomerSavingsTicker.CustomerSavedTickerController=function(b,h){this.setup=function(p,l,q,k,m,o,n){b.setup(Math.ceil(g(p,l,q,k,m)),Math.ceil(f(q,k,m.getHours())*o),o,n)};function g(n,l,o,k,m){return n+i(n,l,o,h.getDate(m))+j(o,k,m)}function i(m,k,n,l){return a(n)*h.getTimeDifferenceInSeconds(k,l)}function j(m,k,l){return d(m,k,l)+e(m,k,l)}function d(p,k,n){var m=h.getDate(n);var o=0;for(var l=0;l<n.getHours();l++){o+=c(p,k,l)}return o}function e(m,k,l){return c(m,k,l.getHours())*h.getFractionOfHour(l)}function c(m,k,l){return(m/7)*(k[l]/100)}function f(m,k,l){return c(m,k,l)/60/60}function a(k){return k/7/24/60/60}};MoneysupermarketCustomerSavingsTicker.DateTimeHelper=function(){this.getDate=function(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate())};this.getTimeDifferenceInSeconds=function(b,a){return this.getTimeDifferenceInMilliseconds(b,a)/1000};this.getTimeDifferenceInMilliseconds=function(b,a){return a.getTime()-b.getTime()};this.getFractionOfHour=function(a){return((a.getMinutes()*60)+a.getSeconds())/(60*60)}};
