(function($){$.fn.rotate=function(options){var $this=$(this),prefixes,opts,wait4css=0;prefixes=['-Webkit-','-Moz-','-O-','-ms-',''];opts=$.extend({startDeg:!1,endDeg:360,duration:1,count:1,easing:'linear',animate:{},forceJS:!1},options);function supports(prop){var can=!1,style=document.createElement('div').style;$.each(prefixes,function(i,prefix){if(style[prefix.replace(/\-/g,'')+prop]===''){can=!0}});return can}
function prefixed(prop,value){var css={};if(!supports.transform){return css}
$.each(prefixes,function(i,prefix){css[prefix.toLowerCase()+prop]=value||''});return css}
function generateFilter(deg){var rot,cos,sin,matrix;if(supports.transform){return''}
rot=deg>=0?Math.PI*deg/180:Math.PI*(360+deg)/180;cos=Math.cos(rot);sin=Math.sin(rot);matrix='M11='+cos+',M12='+(-sin)+',M21='+sin+',M22='+cos+',SizingMethod="auto expand"';return'progid:DXImageTransform.Microsoft.Matrix('+matrix+')'}
supports.transform=supports('Transform');supports.transition=supports('Transition');opts.endDeg*=opts.count;opts.duration*=opts.count;if(supports.transition&&!opts.forceJS){if((/Firefox/).test(navigator.userAgent)){wait4css=(!options||!options.animate)&&(opts.startDeg===!1||opts.startDeg>=0)?0:25}
$this.queue(function(next){if(opts.startDeg!==!1){$this.css(prefixed('transform','rotate('+opts.startDeg+'deg)'))}
setTimeout(function(){$this.css(prefixed('transition','all '+opts.duration+'s '+opts.easing)).css(prefixed('transform','rotate('+opts.endDeg+'deg)')).css(opts.animate)},wait4css);setTimeout(function(){$this.css(prefixed('transition'));if(!opts.persist){$this.css(prefixed('transform'))}
next()},(opts.duration*1000)-wait4css)})}else{if(opts.startDeg===!1){opts.startDeg=$this.data('rotated')||0}
opts.animate.perc=100;$this.animate(opts.animate,{duration:opts.duration*1000,easing:$.easing[opts.easing]?opts.easing:'',step:function(perc,fx){var deg;if(fx.prop==='perc'){deg=opts.startDeg+(opts.endDeg-opts.startDeg)*perc/100;$this.css(prefixed('transform','rotate('+deg+'deg)')).css('filter',generateFilter(deg))}},complete:function(){if(opts.persist){while(opts.endDeg>=360){opts.endDeg-=360}}else{opts.endDeg=0;$this.css(prefixed('transform'))}
$this.css('perc',0).data('rotated',opts.endDeg)}})}
return $this};$.widget("lws.lws_badge",{options:{imageUrl:"",bgUrl:"",iconClass:"lws-icon lws-icon-checkmark",optClass:"",title:"",text:"",},_create:function(){this._getDataOptions();this._createStructure();this._animateBadge()},_bind:function(fn,me){return function(){return fn.apply(me,arguments)}},_getDataOptions:function(){if(this.element.data('imageurl')!=undefined)
this.options.imageUrl=this.element.data('imageurl');if(this.element.data('bgurl')!=undefined)
this.options.bgUrl=this.element.data('bgurl');if(this.element.data('optclass')!=undefined)
this.options.optClass=this.element.data('optclass');if(this.element.data('iconclass')!=undefined)
this.options.iconClass=this.element.data('iconclass');if(this.element.data('title')!=undefined)
this.options.title=this.element.data('title');if(this.element.data('text')!=undefined){this.options.text=this.element.data('text')}else if(this.element.html()!=''){this.options.text=this.element.html()}},_createStructure:function(){var starHtml="<img src='"+this.options.bgUrl+"' style='max-width:200px;max-height:200px;' />";if(this.options.imageUrl!=''){var imgClass="";var imgHtml="<img class='lws-badge-image' src='"+this.options.imageUrl+"'/>"}else{var imgClass="lws-badge-icon "+this.options.iconClass;var imgHtml=""}
this.container=$(document.body);this.globalDelay=($(".lws-badge-wrapper").length)*7000;$("<div>",{'class':'lws-badge','css':{'position':'fixed','bottom':'100px','left':'0','right':'0',}}).append($("<div>",{'class':'lwss_selectable lws-badge-wrapper '+this.options.optClass,'css':{'max-width':'500px','width':'0px','height':'0px'}}).append($("<div>",{'class':'lwss_selectable lws-badge-img-container',}).append($("<div>",{'class':'lws-badge-star','css':{'opacity':'0'},'html':starHtml,})).append($("<div>",{'class':'lwss_selectable lws-badge-img '+imgClass,'css':{'opacity':'0'},'html':imgHtml,}))).append($("<div>",{'class':'lwss_selectable lws-badge-content-container',}).append($("<div>",{'class':'lwss_selectable lws-badge-content-title ','html':this.options.title,})).append($("<div>",{'class':'lwss_selectable lws-badge-content-sep',})).append($("<div>",{'class':'lwss_selectable lws-badge-content-text','html':this.options.text,})))).appendTo(this.container);this.badge=this.container.find(".lws-badge-wrapper")},_animateBadge:function(){this.badge.delay(this.globalDelay).delay("500").animate({left:"-=50",top:"-=50",width:"100",height:"100",},500).delay("500").animate({left:'-=200',width:"100%"},500);this.badge.find(".lws-badge-img").delay(this.globalDelay).delay("1000").animate({opacity:1},1000);this.badge.find(".lws-badge-star").delay(this.globalDelay).delay("1500").animate({opacity:0.5},500).rotate({count:1,duration:10});this.badge.delay("4000").animate({opacity:0},1000).queue(function(){$(this).remove()})}})})(jQuery)
jQuery(function($){$(".lws_wre_badge").lws_badge()})