(function(undef){var version="2.1.7",author="Vova Feldman",global=this,is_migrating=false;if(typeof(RW_Advanced_Options)==="undefined"){RW_Advanced_Options={};} if(typeof(String.prototype.isEmpty)!=="function") String.prototype.isEmpty=function(){return(this.length===0);};if(typeof(String.prototype.ltrim)!=="function") String.prototype.ltrim=function(str) {if(typeof(str)=="undefined") str="\\s";return this.replace(new RegExp("^("+str+")+"),"");};if(typeof(String.prototype.rtrim)!=="function") String.prototype.rtrim=function(str) {if(typeof(str)=="undefined") str="\\s";return this.replace(new RegExp("("+str+")+$"),"");};if(typeof(String.prototype.trim)!=="function") String.prototype.trim=function(str){return this.ltrim(str).rtrim(str);};if(typeof(String.prototype.left)!=="function") String.prototype.left=function(index){return this.substring(0,index);};if(typeof(String.prototype.right)!=="function") String.prototype.right=function(index){return this.substring(index);};if(typeof(String.prototype.contains)!=="function") String.prototype.contains=function(s){return(-1-1);for(var urid in _ratings) {if(!flush_sync&&_ratings[urid].isSynced()) continue;if(false===_ratings[urid].getOption('forceSync')&&(_ratings[urid].getOption('readOnly')||false===_ratings[urid].getOption('sync'))) continue;rating={rid:_ratings[urid].rid.toString(),type:_ratings[urid].type,rclass:_ratings[urid].rclass.substring(0,64),title:_ratings[urid].title.substring(0,256),url:_ratings[urid].url.substring(0,512),img:_ratings[urid].img.substring(0,512)};rlen=rating.rid.length+ rating.type.length+ rating.rclass.length+ rating.title.length+ rating.url.length+ rating.img.length+'{rid:type:rclass:title:url:img:}'.length;if(len+rlen>RW.CALL_RATINGS_MAX_LEN) {chunk=[];chunks.push(chunk);len=0;} len+=rlen;chunk.push(rating);} for(var i=0,len=chunks.length;i0) RW.Com.jsonp(RW._jsUrl('api/v2/rating/update.php'),{data:[{name:'ratings',value:encodeURIComponent(RW.JSON.stringify(chunks[i]))}],callback:RW._updateCallback});},_prefillMissing=function() {for(var urid in _ratings) if(''===_ratings[urid].title) if(RW._isNotEmptyString(_ratings[urid].turid)&&(!_ratings[urid].turid.startsWith('t')||!RW._isNumeric(_ratings[urid].turid.substring(1)))) _ratings[urid].title=_ratings[urid].turid;var primary_rating=RW.getPrimaryRating();if(false!==primary_rating) {if(''===primary_rating.title) primary_rating.title=doc.title;if(''===primary_rating.img) {var og_image=RW._getFirstByAttr('property','og:image','','meta',doc.head);if(RW._is(og_image)) primary_rating.img=og_image.getAttribute('content');}}},_renderRatings=function() {for(var urid in _ratings) _ratings[urid].render();if(RW._isFun(render_options.callback)) render_options.callback(_ratings);RW._clearJS();RW._invokeHook("RW_HOOK_READY");_prefillMissing();_syncRatings();},_isCssLoaded=function(id,z) {var d=doc.createElement("div");d.id=id;d.style.position="relative";body.appendChild(d);var zIndex=parseFloat(RW._getStyle(d,'zIndex'));RW.remove(d);return(zIndex==z);},_isStaticCssLoaded=function() {return _isCssLoaded('rw-css-loaded-flag',12358);},_isDynamicCssLoaded=function() {return _isCssLoaded('rw-dcss-loaded-flag',12358);};return{MAX:5,MIN:1,LIKE_RATE:5,DISLIKE_RATE:0,MIN_STARS:1,MAX_STARS:20,CALL_RATINGS_MAX_LEN:1000,PREFIX:"rw",CUSTOM:"custom",_TYPE:{STRING:"string",BOOL:"boolean",NUM:"numeric",SIZE:"size",DIR:"dir",ALIGN_HOR:"hor",ALIGN_VER:"ver",RTYPE:"rating_type"},_DEF_STYLES:{STAR:"oxygen",NERO:"thumbs"},_DEF_FONT_SIZE:{TINY:"10px",SMALL:"12px",MEDIUM:"16px",LARGE:"20px"},_DEF_LINE_HEIGHT:{TINY:"12px",SMALL:"16px",MEDIUM:"20px",LARGE:"30px"},_TEXT_MAP:{STAR:['rateAwful','ratePoor','rateAverage','rateGood','rateExcellent'],NERO:['dislike','like']},TYPE:{STAR:"star",NERO:"nero"},SIZE:{TINY:"tiny",SMALL:"small",MEDIUM:"medium",LARGE:"large"},STYLE:{YELLOW:"yellow",RED:"red",GREEN:"green",BLUE:"blue",CUSTOM:"custom"},FREQUENCY:{ONCE:-1,UNLIMITED:0,DAILY:1,WEEKLY:7,MONTHLY:30,YEARLY:365},DIR:{LTR:"ltr",RTL:"rtl"},ID_LOCATION:{LSO:"lso",COOKIE:"cookie",STORAGE:"storage"},IDENTIFICATION:{DEVICE:"device",IP:"ip",ACCOUNT:"account",LOCAL_ACOUNT:"laccount"},ALIGN:{HOR:{LEFT:"left",CENTER:"center",RIGHT:"right"},VER:{TOP:"top",MIDDLE:"middle",BOTTOM:"bottom"}},site:{id:null,key:null,token:null,type:"website",category:"unknown",page:{url:window.location.toString()}},visitor:{id:null,gid:null,device:{id:EMPTY_PCID,type:'desktop',os:'other',browser:'other'},country:null,isFromEUCountry:null,identifyBy:"laccount",mobile:false},Ad:null,Sponsored:null,_tooltip:null,_defaultOptions:{lng:"en",url:'',img:'',title:'',type:"star",rclass:"",size:"small",theme:"",style:"",imgUrl:{ltr:"",rtl:""},isDummy:false,readOnly:false,sync:true,forceSync:false,reVote:true,frequency:-1,showInfo:true,showTooltip:true,showAverage:true,showReport:true,showRecommendations:false,hideRecommendations:false,showSponsored:false,showLoader:true,boost:{votes:0,rate:5},uarid:'0',mobile:{optimized:true,showTrigger:true},label:{background:'#FFFFFF',text:{star:{empty:'{{text.rateThis}}',normal:'{{text.rateThis}} ({{rating.votes}} {{text.votes}})',rated:'{{rating.votes}} {{text.votes}}'},nero:{empty:'{{text.rateThis}}',normal:'{{text.rateThis}}',rated:'{{rating.votes}} {{text.votes}}'}}},advanced:{star:{stars:5},nero:{showDislike:true,showLike:true,text:{like:{empty:'{{rating.likes}}',rated:'{{rating.likes}}'},dislike:{empty:'{{rating.dislikes}}',rated:'{{rating.dislikes}}'}}},font:{bold:false,italic:false,color:'#000000',size:"12px",type:'inherit',hover:{color:"#000000"}},layout:{dir:'ltr',align:{hor:'right',ver:"middle"},lineHeight:"16px"},text:{rateAwful:'Awful',ratePoor:'Poor',rateAverage:'Average',rateGood:'Good',rateExcellent:'Excellent',rateThis:'Rate this',like:'Like',dislike:'Dislike',vote:'Vote',votes:'Votes',thanks:'Thank You',outOf:'out of',weRecommend:'We Recommend'},css:{container:""}},beforeRate:null,afterRate:null},getClassOptions:function(c) {return RW._is(coptions[c])?coptions[c]:EMPTY_OPTIONS;},getGlobalOptions:function() {return RW._is(goptions)?goptions:EMPTY_OPTIONS;},getDefaultOptions:function() {return this._defaultOptions;},_parseClassProperty:function(e,property,def) {var className=e.className,prefix="rw-"+property+"-",start=className.indexOf(prefix);if(start<0) return def;if(start>0) {start=className.indexOf(" "+prefix);if(start<0) return def;start++;} var ret='';for(var i=start+prefix.length,len=className.length;i=0);} if(RW._isNumeric(RW.visitor.device.id)) _identified=true;},_generateDeviceID:function() {return(new Date().getTime()-1389650400000).toString()+Math.random().toString().substr(2,6);},_startInit:function() {if(_initialized) return;_initialized=true;RW._invokeHook("RW_HOOK_INIT");if(typeof(RW_Async_Init)!==UNDEF&&RW._isFun(RW_Async_Init)) RW_Async_Init();},initRating:function(pURid,pOptions) {if(this._is(options[pURid])) delete options[pURid];options[pURid]=pOptions;},initClass:function(pClass,pOptions) {if(this._is(coptions[pClass])){delete coptions[pClass];} coptions[pClass]=pOptions;},render:function(pCallback,pOptimized,pContainer) {if(is_migrating) return;if(undef===pCallback) pCallback={};var callback,unsafeCallback,optimized,container;if(!this._isNull(pCallback)&&typeof(pCallback)=="object") {unsafeCallback=this._def(pCallback.callback,null);optimized=this._def(pCallback.optimized,true);container=this._def(pCallback.container,undef);} else {unsafeCallback=this._def(pCallback,null);optimized=this._def(pOptimized,true);container=this._def(pContainer,undef);} callback=this._isFun(unsafeCallback)?function(){try{unsafeCallback.apply(this,Array.prototype.slice.call(arguments,0));}catch(e){debugger;console.error('ratingwidget: '+'Error during callback: '+e.message);}}:null;render_options.optimized=optimized;render_options.callback=callback;render_options.container=container;if(typeof(_rwq)!==typeof(undef)) {for(var i=0;i<_rwq.length;i++) {if(!RW._isNotEmptyArray(_rwq[i])) continue;if(undef===RW[_rwq[i][0]]) continue;if('_setRecommendations'===_rwq[i][0]) RW[_rwq[i][0]].apply(this,_rwq[i].slice(1));}} var ratingElements=RW._getByClassName("rw-ui-container","*",container);if(optimized&&ratingElements.length===0) {if(this._isFun(callback)) callback([]);return;} var user={uid:RW.Uid,huid:RW.site.id},turid=0;_ratings={};_count=0;_resourceMonitor={data:false,resources:false,css:false,dcss:_isStaticCssLoaded()};if(ratingElements.length>0) {_initTooltip();RW.RatingReport.init();if(!_resourceMonitor.css) RW.Com.asyncCss(RW._cssUrl('widget/style.'+(LOCALHOST?'':(HTTPS?'secure.':'min.'))+'css'),{isLoaded:_isStaticCssLoaded,callback:function(){RW._resourceLoaded('css');}});} var urids={},unique_encoded_urids=[];RW._foreach(ratingElements,function(rating){if(RW._Class.has(rating,'rw-no-render')) return;var urid=RW._getRatingId(rating);if(!urid) {urid='t'+turid;turid++;} rating.setAttribute('data-urid',urid);urids[urid]=true;});for(var urid in urids) {_ratings[urid]=new RW.Rating(urid,user,options[urid]);unique_encoded_urids.push(encodeURIComponent(urid));_count++;} var data=[{name:'ids',value:RW.JSON.stringify(unique_encoded_urids)}];if(00){js.removeChild(js.firstChild);}}});},_distroyRatings:function() {for(var urid in _ratings) {_ratings[urid].distroy();delete _ratings[urid];}},_resourceLoaded:function(r) {_resourceMonitor[r]=true;if(_resourceMonitor.data&&_resourceMonitor.resources&&_resourceMonitor.css&&_resourceMonitor.dcss) {_renderRatings();}},_getCallback:function(res) {if(!res.success) {this._distroyRatings();if(res.msg.indexOf('MAINTENANCE')==0) console.warn('ratingwidget: '+res.msg) else RW._error(res.msg);return;} _isPremium=!res.data.basic;_plan=res.data.plan;if(res.data.basic) this.site.token=null;if(RW.IDENTIFICATION.IP===this.visitor.identifyBy&&!RW._isTrial()&&!RW._isProfessional()) {this.visitor.identifyBy=RW.IDENTIFICATION.LOCAL_ACOUNT;console.warn('ratingwidget: '+'IP visitor identification is not supported in your plan. Please upgrade to Professional (http://rating-widget.com/pricing/).');} this.site.id=res.data.user.huid;this.Ad=new RW.Ads(res.data.ads);_showRecommendations=res.data.recommendations;_showSponsoredRecommendations=res.data.showSponsored;this.site.category=res.data.site.category;this.visitor.device.id=res.data.visitor.device.id;this.visitor.country=res.data.visitor.country;if(RW._is(res.data.visitor.id)) this.visitor.gid=res.data.visitor.id;RW._identifyVisitor();this.Sponsored=new RW.Rec();this.Sponsored.preload();this._foreach(_recommendations,function(widget){widget.postRender();});var ratings=res.data.ratings;for(var i=0,len=ratings.length;i1) return false;} return primary;},getRating:function(pURid) {return(!RW._isNumeric(pURid)||!RW._is(_ratings[pURid]))?undef:_ratings[pURid];},getRatings:function() {return _ratings;},getTopRatedWidgets:function() {return _recommendations;},_getClassOptions:function(pClass) {if(this._is(coptions[pClass])){return coptions[pClass];}else{return false;}},_getThemeOptions:function(pTheme) {if(this._is(RWT[pTheme])&&this._is(RWT[pTheme])){return RWT[pTheme].options;}else{return false;}},_addCustomImgStyle:function(pImgUrl,pTypes,pProperty,pPropertyValue) {var style_identifier="rw_"+pProperty+"_"+pPropertyValue+"_custom_style",identifier_class=".rw-"+pProperty+"-"+pPropertyValue;var stylesheet=RW._getById(style_identifier);if(RW._is(stylesheet)){stylesheet.parentNode.removeChild(stylesheet);} stylesheet=doc.createElement("style");stylesheet.type="text/css";stylesheet.rel="stylesheet";stylesheet.id=style_identifier;doc.getElementsByTagName("head")[0].appendChild(stylesheet);var style_text="";for(var i=0,len=pTypes.length;i0?elements[0]:null);},_getById:function(id) {return doc.getElementById(id);},_getByTagName:function(pTag,pContainer) {pContainer=pContainer||doc;return pContainer.getElementsByTagName(pTag);},_getFirstByTagName:function(pTag,pContainer) {var elements=this._getByTagName(pTag,pContainer);return(elements.length>0?elements[0]:null);},_getFirstByClassName:function(pClassName,pTag,pContainer) {var elements=this._getByClassName(pClassName,pTag,pContainer);return(elements.length>0?elements[0]:null);},_getByClassName:function(pClassName,pTag,pContainer) {if(RW._isString(pClassName)) pClassName=[pClassName];var filtered=[];for(var i=0,len=pClassName.length;i0?elements[0]:null);},_getByAttr:function(pAttrName,pAttrVal,pClassName,pTag,pContainer) {pClassName=pClassName||'';var elements=this._getByClassName(pClassName,pTag,pContainer);return this._filterElements(elements,function(e){return(RW._hasAttr(e,pAttrName)&&(''===pAttrVal||pAttrVal==e.getAttribute(pAttrName)));});},_hasAttr:function(e,name) {if(e.hasAttribute) return e.hasAttribute(name);var a=e.getAttribute(name);return!(null===a||''===a);},_typeOf:function(value) {var s=typeof(value);if(s=='object') {if(value) {if(value instanceof Array||(!(value instanceof Object)&&(Object.prototype.toString.call((value))=='[object Array]')||typeof(value.length)=='number'&&typeof(value.splice)!=UNDEF&&typeof(value.propertyIsEnumerable)!=UNDEF&&!value.propertyIsEnumerable('splice'))) {return'array';} if(!(value instanceof Object)&&(Object.prototype.toString.call((value))=='[object Function]'||typeof(value.call)!=UNDEF&&typeof(value.propertyIsEnumerable)!=UNDEF&&!value.propertyIsEnumerable('call'))) {return'function';}} else {return'null';}}else if(s=='function'&&typeof(value.call)==UNDEF){return'object';} return s;},_isDefined:function(p) {return(typeof(p)!=UNDEF);},_isNull:function(p) {return(p===null);},_is:function(p) {return(p!=null);},_isUndefinedOrNull:function(p) {return(p==null);},_isString:function(p) {return(typeof(p)=="string");},_isBoolean:function(p) {return(typeof(p)=="boolean");},_isNumber:function(p) {return(typeof(p)=="number");},_isNumeric:function(p) {return!isNaN(parseFloat(p));},_isRatingType:function(p) {return(this._isString(p)&&(p==this.TYPE.STAR||p==this.TYPE.NERO));},_isSize:function(p) {return(this._isString(p)&&(p==this.SIZE.SMALL||p==this.SIZE.MEDIUM||p==this.SIZE.LARGE));},_isDir:function(p) {return(this._isString(p)&&(p==this.DIR.LTR||p==this.DIR.RTL));},_isHorAlign:function(p) {return(this._isString(p)&&(p==this.ALIGN.HOR.LEFT||p==this.ALIGN.HOR.CENTER||p==this.ALIGN.HOR.RIGHT));},_isVerAlign:function(p) {return(this._isString(p)&&(p==this.ALIGN.VER.TOP||p==this.ALIGN.VER.MIDDLE||p==this.ALIGN.VER.BOTTOM));},_isArray:function(p) {return(this._is(p)&&this._typeOf(p)=="array");},_isNotEmptyArray:function(p) {return(this._isArray(p)&&p.length>0);},_isNotEmptyString:function(p) {return(RW._isString(p)&&!p.isEmpty());},_isFun:function(p) {return(this._typeOf(p)=="function");},_error:function(pMessage) {debugger;console.error('ratingwidget: '+pMessage);throw('ratingwidget: '+pMessage);},_guid:function() {var date=new Date();return date.getTime();},_getStyle:function(pElement,pProperty) {var s=undef;if(RW._is(pElement.currentStyle)) {pProperty=pProperty.replace(/\-(\w)/g,function(strMatch,p1){return p1.toUpperCase();});s=pElement.currentStyle;} else if(window.getComputedStyle) {s=doc.defaultView.getComputedStyle(pElement,null);} return(s!==undef)?s[pProperty]:s;},_filterElements:function(pItems,pPredicate,pCallback) {var has_callback=this._isFun(pCallback);var filtered=[];for(var i=0,length=pItems.length;i\ '+prefix+' RatingWidget\ ';},executeWhen:function(predicate,callback,iteration) {if(predicate()) return callback();setTimeout(function(){RW.executeWhen(predicate,callback,iteration);},iteration);},isConnected:function() {return this._is(this.visitor.gid);},optIn:function() {RW.Com.jsonp(RW._jsUrl('api/cookies.php'),{data:[{name:'optin',value:true}]});},_optInCallback:function(deviceID){RW.visitor.device.id=deviceID;},optOut:function(expirationDays) {RW.Com.jsonp(RW._jsUrl('api/cookies.php'),{data:[{name:'days',value:expirationDays},{name:'optin',value:false}]});},shouldConnect:function() {return((RW.IDENTIFICATION.ACCOUNT===RW.visitor.identifyBy)&&!RW.isConnected());},connectUrl:function() {return RW._url('/action/widget/visitor/signin/facebook.php?site_id='+this.site.id);},isLocalhost:function() {return LOCALHOST;},elapsedTime:function() {return Math.round((new Date().getTime()-_timestamp.getTime())/1000);},isLocalizedNumbers:function(lng) {return RW._is(RWL[lng].numbers);},localizeNumber:function(n,lng) {if(!this.isLocalizedNumbers(lng)) return n;var loc='';n=n.toString();for(var i=0;i0)?"&":"")+data[i].name+"="+data[i].value;return q;},toNameValue:function(map) {var data=[];for(var key in map) data.push({name:key,value:map[key]});return data;},fromNameValue:function(arr) {var data={};for(var idx in arr){if(arr.hasOwnProperty(idx)){var nameValuePair=arr[idx];data[nameValuePair.name]=nameValuePair.value;}} return data;},getUrl:function(url,data) {if(data.length>0) url+=((url.indexOf("?")+1)?"&":"?");return url+this.toQueryString(data);},asyncCss:function(url,options) {options=RW._extandObj(options,{cycle:50,timeout:5000,data:[],callback:null,success:null,failure:null,isLoaded:null});if(null!==options.isLoaded&&options.isLoaded()) {if(null!==options.success) options.success();if(null!==options.callback) options.callback();return;} options.data.push({name:"v",value:version});var head=RW._getFirstByTagName("head"),stylesheet=_getStylesheetElement(this.getUrl(url,options.data));head.appendChild(stylesheet);var con=doc.createElement("div");body.appendChild(con);con.innerHTML='';if(null===options.isLoaded) return;if(null===options.callback&&null===options.success&&null===options.failure) return;var checkIfCssReady=function() {options.timeout-=options.cycle;if(options.isLoaded()) {if(null!==options.success) options.success();if(null!==options.callback) options.callback();} else {if(options.timeout>0) {setTimeout(checkIfCssReady,options.cycle);} else {console.warn('Async stylesheet include timeouted.');if(null!==options.failure) options.failure();if(null!==options.callback) options.callback();}}};setTimeout(checkIfCssReady,options.cycle);},enrichRequest:function(data,isStatic) {data.push({name:"v",value:version});data.push({name:"sw",value:screen.width});data.push({name:"sh",value:screen.height});data.push({name:"sd",value:screen.pixelDepth});data.push({name:"uid",value:RW.site.key});if(RW._is(RW.site.id)) data.push({name:"huid",value:RW.site.id});if(isStatic) {data.push({name:"fp",value:_fingerprint});} else {if(RW.visitor.device.id!==EMPTY_PCID) data.push({name:"pcid",value:RW.visitor.device.id});data.push({name:"by",value:RW.visitor.identifyBy});data.push({name:"et",value:RW.elapsedTime()});if(RW._is(RW.visitor.id)) {var vid_exist=false;for(i=0,len=data.length;i=_dataCache.recs.length) return _dataCache.recs;var start=Math.floor(Math.random()*(_dataCache.recs.length-(limit-1))),end=start+limit;return _dataCache.recs.slice(start,end);},_pickUnclicked=function(limit) {if(!RW._is(_dataCache)||!RW._isArray(_dataCache.recs)||0===_dataCache.recs.length) return false;if(limit>=_dataCache.recs.length) return _dataCache.recs;if(!RW.Storage.contains('sponsored_clicks')) return _dataCache.recs.slice(0,limit);var clicked=RW.Storage.get('sponsored_clicks'),ordered=[];for(var i=0,len=_dataCache.recs.length;i180);var d=RW.Svg.move(this.getRadialPos(center,innerRadius,startAngle))+' '+ RW.Svg.line(this.getRadialPos(center,outerRadius,startAngle))+' '+ RW.Svg.circleArc(outerRadius,this.getRadialPos(center,outerRadius,endEngle),isLargeArc)+' '+ RW.Svg.line(this.getRadialPos(center,innerRadius,endEngle))+' '+ RW.Svg.circleArc(innerRadius,this.getRadialPos(center,innerRadius,startAngle),isLargeArc,false)+' '+'z';var arc=this.createElement("path");RW._setAttr(arc,{d:d});return arc;}};}();RW.Rating=function(urid,user,options) {var $=this,_elements=RW._getByAttr('data-urid',urid,'rw-ui-container'),_instances=[],_voteTimeout=null,_callState='ready',_refreshUI=true,_refreshCount,_serverHash,_o=options,_defaultOptions=RW.getDefaultOptions(),_globalOptions=RW.getGlobalOptions();$.huid=user.huid;$.uid=user.uid;$.urid=urid;$.turid=null;$.rid=null;$.rate=null;$.votes=null;$.votesData=null;$.isRated=false;$.lastVote=null;$.lastVoteRate=null;$.report=null;$.options=_o;$.title='';$.img='';$.url='';$.rclass='';$.type=RW.TYPE.STAR;var _getRequiredResources=function() {var resources={lng:{},star:{theme:{},style:{}},nero:{theme:{},style:{}}},classOptions,lng,type,style,theme,size,optionsArray,optionsArrayWithoutDefaults;RW._foreach(_instances,function(i){classOptions=i.getClassOptions();optionsArray=[i.options,classOptions,_globalOptions,_defaultOptions];optionsArrayWithoutDefaults=[i.options,classOptions,_globalOptions];lng=RW._Set.getOption(optionsArrayWithoutDefaults,'lng',false);if(false!==lng) resources.lng[lng]=true;type=RW._Set.getOption(optionsArray,'type');size=RW._Set.getOption(optionsArray,'size');style=RW._Set.getOption(optionsArray,'style',false);if(false!==style&&RW.CUSTOM===style.toLowerCase()&&!RW._isTrial()&&!RW._isProfessional()) {style=RW._DEF_STYLES[type.toUpperCase()];console.warn('Custom ratings image is not supported in your plan. Please upgrade to Professional (http://rating-widget.com/pricing/).');} if(false!==style) {if(!RW._is(resources[type].style[size])) resources[type].style[size]={};resources[type].style[size][style]=true;} theme=RW._Set.getOption(optionsArray,'theme',false);if(false!==theme) {if(!RW._is(resources[type].theme[size])) resources[type].theme[size]={};resources[type].theme[size][theme]=(true===resources[type].theme[size][theme])||(false===style);} if(false===style) {if(!RW._is(resources[type].style[size])) resources[type].style[size]={};resources[type].style[size][RW._DEF_STYLES[type.toUpperCase()]]=true;}});return resources;},_getUniqueHash=function() {return $.type[0]+'-'+ (RW._isNotEmptyString($.title)?'1':'0')+'-'+ (RW._isNotEmptyString($.rclass)?'1':'0')+'-'+ (RW._isNotEmptyString($.url)?'1':'0')+ (RW._isNotEmptyString($.img)?'-'+$.img.length:'');};$.distroy=function() {RW._foreach(_elements,function(e){RW.remove(e);});_instances=null;};$.initData=function(d) {$.urid=d.urid;$.rid=d.rid;$.rate=parseFloat(d.rate);$.votes=Math.max(0,parseInt(d.votes,10));$.rate=Math.max(0,Math.min(RW.MAX*d.votes,d.rate));$.votesData=RW._isArray(d.votesData)?d.votesData:[];$.isRated=($.votesData.length>0);$.lastVote=($.isRated?$.votesData[0]:null);$.lastVoteRate=($.isRated?$.lastVote.rate:0);$.report=null;_serverHash=d.hash;};$.getRequiredResources=function() {return _getRequiredResources();};$.render=function() {var p=['title','img','url','rclass','type'];for(var i=0,len=p.length;i-1);if(!flush_sync&&rating.isSynced()) return;var ratingData={rid:rating.rid.toString(),type:rating.type,rclass:rating.rclass.substring(0,64),title:rating.title.substring(0,256),url:rating.url.substring(0,512),img:rating.img.substring(0,512)},chunk=[ratingData];RW.Com.jsonp(RW._jsUrl('api/v2/rating/update.php'),{data:[{name:'ratings',value:encodeURIComponent(RW.JSON.stringify(chunk))}],callback:RW._updateCallback});};$.afterRate=function(instanceID) {return _getOptionsProperty('afterRate');};$.beforeRate=function(instanceID) {return _getOptionsProperty('beforeRate');};$.voteCompleted=function(success,ratingData,msg,is_accumulator) {var isFirstVote=(!$.isRated);is_accumulator=RW._def(is_accumulator,false);if(success) {var prevVotesNumber=$.votes,prevLastVoteRate=$.lastVoteRate;if(0===$.rid&&(!$.getFirstInstance().isDummy())){$.rid=ratingData.rid;_syncRating($);} $.rate=parseFloat(ratingData.rate);$.votes=Math.max(0,parseInt(ratingData.votes,10));$.rate=Math.max(0,Math.min(RW.MAX*$.votes,$.rate));$.votesData=ratingData.votesData;$.lastVote=$.votesData[0];$.lastVoteRate=$.lastVote.rate;if(!RW._isNull($.report)) {$.addReportVotes($.lastVoteRate,1);if(prevVotesNumber==$.votes) $.addReportVotes(prevLastVoteRate,-1);} $.isRated=true;if(undef!==ratingData.accumulator) {var accumulator=RW.getRating(ratingData.accumulator.urid);if(RW._is(accumulator)) {ratingData.accumulator.votesData=ratingData.votesData;accumulator.voteCompleted(success,ratingData.accumulator,msg,true);}}} if(!is_accumulator) {var afterRate=$.afterRate();if(afterRate) afterRate(success,($.getFirstInstance().isThumb()?($.lastVoteRate===RW.LIKE_RATE):$.lastVoteRate),$,isFirstVote,msg);} $.voteEnd();$.refresh();if(success&&!is_accumulator) _instances[ratingData.riid].showReport();};RW._foreach(_elements,function(e,i){_instances.push(new RW.RatingInstance(e,$,i));});};RW.RatingInstance=function(element,rating,id) {var $=this,_options,_mouseOutTimeout=null,PREFIX=RW.PREFIX+'-',P=PREFIX,_r=$.rating=rating,_e=element,_label,_labelContainer,_labelInnerContainer,_stars,_mobileDropdown,_o,_advanced,_a,_font,_f,_hover,_text,_t,_l,_layout,_align,_type,_ostyle,_defaultOptions=RW.getDefaultOptions(),_globalOptions;var _initOptions=function(o) {_options=RW._extandObj(_getOptions(element),o);return _options;},_getLoaderHtml=function() {return'';},_renderLoading=function() {_globalOptions=RW.getGlobalOptions();_ostyle=element.getAttribute('style');if(element.style.display==='') element.style.display='inline-table';var showLoader=true;if(undef!==_options&&undef!==_options.showLoader) showLoader=_options.showLoader;else if(undef!==_globalOptions&&undef!==_globalOptions.showLoader) showLoader=_globalOptions.showLoader;else if(undef!==_defaultOptions&&undef!==_defaultOptions.showLoader) showLoader=_defaultOptions.showLoader;element.innerHTML=(showLoader?_getLoaderHtml():'');},_atrrToProperty=function(name) {var words=name.toLowerCase().split('-'),propertyName=words[0];for(var i=1,len=words.length;iRW.MAX)?$.localizeNumber((i+1))+" / "+$.localizeNumber(_a.star.stars):_t[RW._TEXT_MAP.STAR[i]];},_attachStarEvents=function() {var triggers=_stars;RW._foreach(triggers,function(star,i){star.onmouseover=function(e) {if(!$.isActiveAndReady()) return;clearTimeout(_mouseOutTimeout);_mouseOutTimeout=null;var lastVote=_r.isRated?(_r.lastVoteRate-1):-1;for(var j=0,len=_stars.length;j0)?Math.round((b.rate/b.votes)*2):0;var len=(twiceAverage-(twiceAverage%2))/2;for(var i=0;i0)?thumbs:thumbs.reverse();var sel=thumbs[0],unsel=thumbs[1];if(_isThumbVisible(sel)) RW._Class.add(_getThumb(sel).parentNode,"rw-selected");if(_isThumbVisible(unsel)) RW._Class.remove(_getThumb(unsel).parentNode,"rw-selected");}},_renderFontColor=function() {return(_f.color===RW._defaultOptions.advanced.font.color)?'':'color: '+_f.color+';';},_renderFontFamily=function() {return(_f.type===RW._defaultOptions.advanced.font.type)?'':'font-family: '+_f.type+';';},_renderFontSize=function() {return(_f.size===RW._DEF_FONT_SIZE[_o.size.toUpperCase()])?'':'font-size: '+_f.size+';';},_renderLineHeight=function() {return(_layout.lineHeight===RW._DEF_LINE_HEIGHT[_o.size.toUpperCase()])?'':'line-height: '+_layout.lineHeight+';';},_getReportUrl=function() {return RW._url('my-rating-report/'+ _type+'/'+_o.style.replace(/\_/g,'-')+'/rating-'+_r.rid+ ($.isStar()?'-'+_a.star.stars:'')+'/');},_renderReportLink=function() {return'';},_renderInfo=function() {return(!_o.showInfo)?'':''+ $.renderNub()+''+'';},_showMobileUX=function() {return(RW._isMobile()&&!_o.readOnly&&_o.mobile.optimized);},_renderStars=function() {var html='';if(_showMobileUX()) html+=$.renderMobileDropdown();html+='
    ';var a='';for(var i=0,len=_a.star.stars;i'+a+'';return html+'
';},_renderStarsActionArea=function() {return'
'+_renderStars()+(!RW._isPremium()?_renderReportLink():'')+'
';},_renderStarRating=function() {_e.innerHTML=(_align.ver==RW.ALIGN.VER.TOP)?_renderInfo()+_renderStarsActionArea():_renderStarsActionArea()+_renderInfo();_stars=RW._getByTagName("li",_e);},_renderLikeButton=function(like) {var action=(like?"like":"dislike"),a='';return''+a+'';},_renderThumbRating=function() {var innerHtml='
';if(_showMobileUX()) {var disableSelection=$.isActive()?'':' disabled="disabled"',lastVote=(_r.isRated?_r.lastVoteRate:-1);innerHtml+='
';} if(_a.nero.showLike) innerHtml+=_renderLikeButton(true);if(_a.nero.showDislike) innerHtml+=_renderLikeButton(false);if(!RW._isPremium()) innerHtml+=_renderReportLink();innerHtml+='
';_e.innerHTML=(_align.ver==RW.ALIGN.VER.TOP)?_renderInfo()+innerHtml:innerHtml+_renderInfo();},_setRatingClassNames=function() {RW._Class.set(_e,P+'ui-container '+ P+'urid-'+_r.urid+' '+ P+'ui-'+_type+' '+ P+'size-'+_o.size+' '+ P+'dir-'+((_layout.dir==RW.DIR.RTL)?RW.DIR.RTL:RW.DIR.LTR)+' '+ P+'halign-'+_align.hor+' '+ P+'valign-'+_align.ver+' '+ P+'style-'+_o.style);if(null!=_o.theme&&!_o.theme.isEmpty()) RW._Class.add(_e,'theme-'+_o.theme,P);if(!_o.readOnly) RW._Class.add(_e,'active',P);if(_f.bold) RW._Class.add(_e,'bold',P);if(_f.italic) RW._Class.add(_e,'italic',P);if(!(_o.rclass.trim().isEmpty())) RW._Class.add(_e,"class-"+_o.rclass,P);if(RW.visitor.mobile) RW._Class.add(_e,'mobile',P);},_addCustomImageCss=function() {if(_o.style.toLowerCase()!==RW.CUSTOM) return;var classOptions=$.getClassOptions(),themeOptions=$.getThemeOptions(classOptions);if((classOptions.style!==RW.CUSTOM||!RW._isEqualImg(_o.imgUrl,classOptions.imgUrl))&&(themeOptions.style!==RW.CUSTOM||!RW._isEqualImg(_o.imgUrl,themeOptions.imgUrl))) {RW._addCustomImgStyle(_o.imgUrl,[_type],"urid",_r.urid);}},_placeTooltip=function(target,flush) {flush=false||flush;if(!flush&&!$.isReady()) return;if(!_o.showTooltip) return;var a=RW._getFirstByTagName('a',target);target=RW._is(a)?a:target;RW._tooltip.style.left='';RW._tooltip.style.top='';target.appendChild(RW._tooltip);RW._tooltip.style.display="block";RW._tooltip.style.left="-"+Math.ceil((RW.width(RW._tooltip)-$.getIconWidth())/2)+"px";var offset=RW.offset(RW._tooltip),doc_offset=RW.docOffset();doc.body.appendChild(RW._tooltip);RW._tooltip.style.left=offset.left+"px";var height=RW.height(RW._tooltip);if((offset.top-height-4)>doc_offset.top){RW._Class.set(RW._tooltip,"rw-ui-tooltip rw-valign-top");RW._tooltip.style.top=(offset.top-height-3)+"px";}else{RW._Class.set(RW._tooltip,"rw-ui-tooltip rw-valign-bottom");RW._tooltip.style.top=(offset.top+$.getIconWidth()+4)+"px";}},_render=function() {_prepareOptions();_e.innerHTML='';_e.setAttribute('style',(RW._is(_ostyle)?_ostyle+';':'')+_a.css.container);_addCustomImageCss();_setRatingClassNames();if($.isStar()) _renderStarRating();else if($.isThumb()) _renderThumbRating();if(_o.isDummy){_e.innerHTML+='';} if(_o.showInfo) {_label=RW._getFirstByClassName("rw-ui-info","span",_e);_labelInnerContainer=_label.parentNode;_labelContainer=_labelInnerContainer.parentNode;} if(_showMobileUX()) {_mobileDropdown=RW._getFirstByClassName("rw-ui-mobile-stars","select",_e);if(!_r.isRated) _mobileDropdown.selectedIndex=-1;} $.refresh();_attachEvents();},_isTimePassed=function(utcDateTime,days) {var now=new Date(),utc=new Date(now.getUTCFullYear(),now.getUTCMonth(),now.getUTCDate(),now.getUTCHours(),now.getUTCMinutes(),now.getUTCSeconds()),next=Date.parse(utcDateTime.replace(/-/g,"/"))+days*(1000*60*60*24);return(utc.getTime()>=next)?true:next;},_overridenVoteID=function() {var voteID=false;if(!_r.isRated) voteID=false;else if(!_o.reVote) voteID=false;else if(_o.frequency==RW.FREQUENCY.UNLIMITED) voteID=false;else if(_o.frequency==RW.FREQUENCY.ONCE) voteID=_r.lastVote.id;else voteID=(true===_isTimePassed(_r.lastVote.created,_o.frequency))?false:_r.lastVote.id;return voteID;},_cancelRate=function() {_r.voteEnd();$.refresh();},_completeRate=function(element,score,e) {$.setTooltip('',true);_placeTooltip(element,true);var beforeRate=_r.beforeRate(),voterID=(beforeRate?beforeRate(rating,score):true);if(false===voterID) {_cancelRate();return;} if(true===voterID&&RW._is(RW.visitor.id)) voterID=RW.visitor.id;$.setLabel(_t.thanks);var voteID=_overridenVoteID();var data=[{name:"urid",value:_r.urid},{name:"riid",value:$.id}];data.push(((RW.TYPE.STAR===_type)?{name:"rate",value:score*(RW.MAX/_a.star.stars)}:{name:"like",value:score}));if(voteID!==false) data.push({name:"voteID",value:voteID});if(voterID!==true) data.push({name:"vid",value:voterID});if(_o.uarid>0) data.push({name:"uarid",value:_o.uarid});if(!_o.isDummy){RW.Com.jsonp(RW._jsUrl('api/rating/rate.php'),{data:data});}else{RW.Com.enrichRequest(data,false);var requestData=RW.Com.fromNameValue(data);if(requestData.voteID){delete requestData.voteID;} var fakeResponse={success:true,msg:""};var fakeResponseRateData={riid:requestData.riid,votes:1};if(undef!==requestData.like){fakeResponseRateData.rate=requestData.like?5:0;}else{fakeResponseRateData.rate=requestData.rate;} var fakeResponseVoteData=[{rate:fakeResponseRateData.rate}];fakeResponseRateData.votesData=fakeResponseVoteData;fakeResponse.data=fakeResponseRateData;var rwVote=RW._getFirstByClassName("rw-vote-data",'input',_e);rwVote.value=JSON.stringify(requestData);RW._rateCallback(fakeResponse,_r.urid);} if(typeof(undef)!==typeof(_gaq)) {_gaq.push(['_setCustomVar',1,'urid',_r.urid,3]);_gaq.push(['_setCustomVar',2,'title',_o.title,3]);_gaq.push(['_setCustomVar',3,'rate',((RW.TYPE.STAR===_type)?score.toString():(score?'like':'dislike')),1]);_gaq.push(['_trackEvent','Rating','Vote',_o.title,score]);} else if(typeof(undef)!==typeof(window.ga)) {ga('send','event','Rating','Vote',_o.title,score);}},_rate=function(element,score,e) {if(!$.isReady()) return;_r.voteBegin();$.hideReport();$.hideTooltip();if(!RW.shouldConnect()) {_completeRate(element,score,e);} else {var sign_win=doc.createElement('iframe'),modal=doc.createElement('div');modal.id='rw_modal';sign_win.className='rw-ui-signup-window';sign_win.src=RW._url(RW.Com.getUrl('/signup/visitor/',[{name:'site_id',value:RW.site.id},{name:'type',value:_type},{name:'style',value:_o.style},{name:'rate',value:(RW.TYPE.STAR===_type)?score:(score?5:0)},{name:'label',value:encodeURIComponent((RW.TYPE.STAR===_type)?_getStarLabel(score-1):_t[(score?'like':'dislike')])},{name:'stars',value:(RW.TYPE.STAR===_type)?_a.star.stars:0},{name:"cguid",value:RW._guid()}]));sign_win.onload=function() {this.style.visibility='visible';RW.remove(RW._getFirstByTagName('img',modal));};body.appendChild(modal);modal.innerHTML=_getLoaderHtml();modal.appendChild(sign_win);window.addEventListener("message",function(evt){evt=evt||window.event;if(!evt.data.startsWith('rw:')) return;var data=evt.data.split(':'),msg=data[1];switch(msg) {case'rw_visitor_id':RW._setVisitorID(data[2],true);_completeRate(element,score,e);break;default:_cancelRate();break;} RW.remove(modal);},false);}};$.distroy=function() {RW.remove(element);};$.getClass=function() {_globalOptions=RW.getGlobalOptions();return RW._Set.getOption([_options,_globalOptions],'rclass');};$.getClassOptions=function() {return RW.getClassOptions($.getClass());};$.getThemeOptions=function(classOptions) {_globalOptions=RW.getGlobalOptions();return RW._getThemeOptions(RW._Set.getOption([_options,classOptions,_globalOptions],'theme',false));};$.getCalculatedOptions=function() {var classOptions=$.getClassOptions();_globalOptions=RW.getGlobalOptions();var o=RW._Set.merge([_options,classOptions,$.getThemeOptions(classOptions),_globalOptions],_defaultOptions);if(!RW._isNotEmptyString(o.style)) o.style=RW._DEF_STYLES[o.type.toUpperCase()];if(o.style.toLowerCase()===RW.CUSTOM&&!RW._isTrial()&&!RW._isProfessional()) o.style=RW._DEF_STYLES[o.type.toUpperCase()];return o;};$.getIconWidth=function() {return(_o.size==RW.SIZE.SMALL)?16:((_o.size==RW.SIZE.MEDIUM)?20:((_o.size==RW.SIZE.TINY)?13:30));};$.isStar=function() {return(_type==RW.TYPE.STAR);};$.isThumb=function() {return(_type==RW.TYPE.NERO);};$.isDummy=function() {return _o.isDummy;};$.getTotalLikes=function() {return _getThumbTotal('like');};$.getTotalDislikes=function() {return _getThumbTotal('dislike');};$.getBoostedVotes=function() {var b=$.getBoostedValues();return $.isStar()?b.votes:((_a.nero.showLike?b.likes:0)+(_a.nero.showDislike?b.dislikes:0));};$.getBoostedValues=function() {var votes=(_o.showAverage?_r.votes+_o.boost.votes:(_r.isRated?1:0)),rate=(_o.showAverage?$.getNormalizedRate(_r.rate)+(_o.boost.rate*_o.boost.votes):$.getNormalizedRate(_r.lastVoteRate)),likes=Math.floor(rate/RW.MAX),dislikes=Math.max(0,votes-likes);return $.isStar()?{votes:votes,rate:rate}:{likes:likes,dislikes:dislikes};};$.localizeNumber=function(n) {return RW.localizeNumber(n,_o.lng);};$.lastVoteTooltip=function(){return(_r.rate>0&&_r.votes>0)?($.isThumb()?(_t[(RW.LIKE_RATE===_r.rate)?'like':'dislike']):_getStarLabel(Math.ceil((_r.rate/_r.votes))-1)):_t.rateThis;},$.formatLabel=function(label) {if(label.indexOf('/%')===-1&&label.indexOf('{{')===-1) return label;var b=$.getBoostedValues(),votes=b.votes;if($.isThumb()) {votes=0;if(_a.nero.showLike) votes+=b.likes;if(_a.nero.showDislike) votes+=b.dislikes;} var map={'text.rateThis':_t.rateThis,'text.outOf':_t.outOf,'text.votes':((votes==1)?_t.vote:_t.votes),'rating.lastVote':$.lastVoteTooltip()},nmap={'rating.votes':votes,'rating.likes':b.likes,'rating.dislikes':b.dislikes,'rating.max_rate':_a.star.stars,'rating.avg_rate':((votes>0)?((b.rate/votes)*(_a.star.stars/RW.MAX)).toFixed(2):0),'rating.rate_percent':((votes>0)?Math.ceil((b.rate/votes)*100/RW.MAX):0)},localized=RW.isLocalizedNumbers(_o.lng),i=0;do {for(var key in map) {label=label.replace('/%'+key+'%/',map[key]);label=label.replace('{{'+key+'}}',map[key]);} for(var key in nmap) {if(label.indexOf('/%'+key+'%/')>-1) label=label.replace('/%'+key+'%/',localized?$.localizeNumber(nmap[key]):nmap[key]);if(label.indexOf('{{'+key+'}}')>-1) label=label.replace('{{'+key+'}}',localized?$.localizeNumber(nmap[key]):nmap[key]);} i++;} while(i<10&&(label.indexOf('/%')>-1||label.indexOf('{{')>-1));label=label.trim();return label;};$.getLabelValue=function() {var b=$.getBoostedValues();var label="";if($.isStar()) {if(!_o.readOnly&&(0===b.votes||(!_o.showAverage&&!_r.isRated))) {label=_l.text.star.empty;} else {if(!_o.showAverage) {label=_t.thanks;} else {label=_l.text.star.rated;if(!_o.readOnly&&!_r.isRated) label=_l.text.star.normal;}}} else {if(!_o.readOnly&&!_r.isRated) label=_l.text.nero.empty;else if(!_a.nero.showLike||!_a.nero.showDislike) label='';else label=_l.text.nero.rated;} return label;};$.getNormalizedRate=function(rate,round) {if($.isThumb()) return rate;var n=rate*(_a.star.stars/RW.MAX);return(true===round)?Math.round(n):n;};$.isReady=function() {return(_r.getState()=='ready');};$.isActive=function() {var res=false;if(_o.readOnly) res=false;else if(!_r.isRated) res=true;else if(_o.reVote&&(($.isStar()&&_a.star.stars>1)||($.isThumb()&&_a.nero.showLike&&_a.nero.showDislike))) res=true;else if(_o.frequency==RW.FREQUENCY.ONCE) res=false;else if(_o.frequency==RW.FREQUENCY.UNLIMITED) res=true;else res=(true===_isTimePassed(_r.lastVote.created,_o.frequency));RW._Class.toggle(_e,PREFIX+"active",(true===res));return res;};$.isActiveAndReady=function() {return($.isActive()&&$.isReady());};$.setOptions=function(o) {_options=RW._Set.merge([o],_defaultOptions);$.render();};$.setSize=function(s) {if(s==_o.size) return;RW._Class.override(_e,PREFIX+"size-"+_o.size,PREFIX+"size-"+s);_o.size=s;};$.setStyle=function(pStyle,pUrl) {pUrl=RW._def(pUrl,{ltr:"",rtl:""});pStyle=pStyle.toLowerCase();if(pStyle==_o.style&&(pStyle!=RW.CUSTOM||RW._isEqualImg(pUrl,_o.imgUrl))) return;if(_o.style==RW.CUSTOM&&pStyle!==RW.CUSTOM) {RW._Class.remove(_e,PREFIX+"theme-"+_o.theme);RW._Class.remove(_e,PREFIX+"class-"+_o.rclass);var stylesheet=RW._getById("rw_urid_"+_r.urid+"_custom_style");if(RW._is(stylesheet)) RW.remove(stylesheet);} RW._Class.override(_e,PREFIX+"style-"+_o.style,PREFIX+"style-"+pStyle);_o.style=pStyle;_o.imgUrl=pUrl;if(_o.style.toLowerCase()==RW.CUSTOM) RW._addCustomImgStyle(_o.imgUrl,[_type],"urid",_r.urid);};$.toggleBold=function() {RW._Class.toggle(_e,PREFIX+'bold');_f.bold=!_f.bold;};$.toggleLike=function(show) {if(!$.isThumb()) return;_a.nero.showLike=(RW._is(show)?show:!_a.nero.showLike);$.render();};$.toggleDislike=function(show) {if(!$.isThumb()) return;_a.nero.showDislike=(RW._is(show)?show:!_a.nero.showDislike);$.render();};$.setReadOnly=function(readOnly) {if(readOnly==_o.readOnly) return;RW._Class.toggle(_e,PREFIX+'active');_o.readOnly=readOnly;};$.setShowInfo=function(show) {if(show==_o.showInfo) return;_o.showInfo=show;$.render();};$.toggleItalic=function() {RW._Class.toggle(_e,PREFIX+'italic');_f.italic=!_f.italic;};$.setFontType=function(family) {if(family==_f.type) return;RW._foreach(RW._getByTagName('span',_e),function(s){s.style.fontFamily=family;});_f.type=family;};$.setLabelBackground=function(color,flush) {color=RW.Color.canonize(color);if(!(flush||false)&&color==RW.Color.canonize(_o.label.background)) return;if(_o.showInfo) _labelContainer.style.backgroundColor=color;$.setLabelNubColor(color,'inner');_o.label.background=color;};$.setFontColor=function(color,flush) {color=RW.Color.canonize(color);if(!(flush||false)&&color==RW.Color.canonize(_f.color)) return;$.setLabelColor(color);_f.color=color;};$.setFontHOverColor=function(color) {color=RW.Color.canonize(color);if(color==RW.Color.canonize(_hover.color)) return;_hover.color=color;};$.setFontSize=function(size) {if(size==_f.size) return;if(_o.showInfo) _label.style.fontSize=size;if($.isThumb()) {if(_a.nero.showLike) _getLikeLabel().style.fontSize=size;if(_a.nero.showDislike) _getDislikeLabel().style.fontSize=size;} _f.size=size;};$.setDirection=function(dir) {if(dir==_layout.dir) return;RW._Class.override(_e,PREFIX+"dir-"+_layout.dir,PREFIX+"dir-"+dir);_layout.dir=dir;};$.setAlignment=function(ver,hor) {if(ver==_align.ver&&hor==_align.hor) return;if(ver!=_align.ver) RW._Class.replace(_e,PREFIX+"valign-"+_align.ver,PREFIX+"valign-"+ver);if(hor!=_align.hor) RW._Class.replace(_e,PREFIX+"halign-"+_align.hor,PREFIX+"halign-"+hor);if(_o.showInfo) {if(ver!=_align.ver) {if(ver==RW.ALIGN.VER.TOP) {_e.appendChild(_labelContainer);_e.appendChild(_getActionsContainer());} else {_e.appendChild(_getActionsContainer());_e.appendChild(_labelContainer);}}} _align.ver=ver;_align.hor=hor;$.setLabelBackground(_o.label.background,true);$.setFontColor(_f.color,true);};$.setLineHeight=function(height) {if(height==_layout.lineHeight) return;if(_o.showInfo) _label.style.lineHeight=height;if($.isThumb()) {if(_a.nero.showLike) _getLikeLabel().style.lineHeight=height;if(_a.nero.showDislike) _getDislikeLabel().style.lineHeight=height;} _layout.lineHeight=height;};$.setLanguage=function(lng) {if(lng==_o.lng||!RW._is(RWL[lng])) return;for(var p in _text){_t[p]=RWL[lng].text[p];} $.setDirection(RWL[lng].dir);if(RW.ALIGN.VER.MIDDLE===_align.ver) $.setAlignment(RWL[lng].align.ver,RWL[lng].align.hor);_o.lng=lng;$.refresh();};$.setStarsNum=function(n) {n=Math.max(RW.MIN_STARS,Math.min(RW.MAX_STARS,parseInt(n,10)));if(_type!==RW.TYPE.STAR||_a.star.stars===n) return;_a.star.stars=n;$.render();};$.setCSS=function(item,style) {if(!RW._is(_a.css[item])||_a.css[item]===style) return;_a.css[item]=style;var display=_e.style.display;_e.setAttribute('style',style);_e.style.display=display;};$.setLabel=function(label) {if(!$.isReady()) return;if(!_o.showInfo) return;if(''==label) RW._getFirstByClassName('rw-ui-info-container','span',_e).style.display='none';else if(_o.showInfo) _label.innerHTML=$.formatLabel(label);};$.setLabelColor=function(color) {if(!$.isReady()) return;if(!_o.showInfo) return;if(_o.showInfo) _label.style.color=color;$.setLabelBorderColor(RW.Color.toRgba(color,0.5));};$.setLabelBorderColor=function(color) {if(_o.showInfo) _labelInnerContainer.style.borderColor=color;$.setLabelNubColor(color,'outer');};$.setLabelNubColor=function(color,nub) {if(!_o.showInfo) return;var nub=RW._getFirstByClassName('rw-ui-info-'+nub+'-nub','*',_labelContainer),nubDir=(RW.ALIGN.VER.MIDDLE===_align.ver)?_align.hor:_align.ver;nub.style.borderTopColor=nub.style.borderRightColor=nub.style.borderBottomColor=nub.style.borderLeftColor='';nub.style['border'+nubDir.ucfirst()+'Color']=color;};$.setTooltip=function(tip,flush) {flush=false||flush;if(!flush&&!$.isReady()) return;if(!_o.showTooltip) return;RW._tooltip.innerHTML=''+tip+'';return!tip.isEmpty();};$.rate=function(i,e) {i=(_stars.length+i)%_stars.length;_stars[i].onclick(e);if(_showMobileUX()) _mobileDropdown.selectedIndex=(_stars.length-1-i);};$.doRate=function(i,star,e) {i=Math.min(_a.star.stars,Math.max(RW.MIN,i));return _rate(star,i,e);};$.like=function(thumb,e,like) {return _rate(thumb,RW._def(like,true),e);};$.dislike=function(thumb,e) {return $.like(thumb,e,false);};$.hideTooltip=function() {_r.hideTooltip();};$.hideReport=function() {RW.RatingReport.close(true);};$.showReport=function() {if(_showReport()) {var trigger=RW._getFirstByClassName("rw-ui-info-container","span",_e);if(!RW._is(trigger)) trigger=_e;RW.RatingReport.open($,trigger);}};$.refresh=function() {if($.isStar()) _refreshStar();else if($.isThumb()) _refreshNero();if(RW._isPremium()) RW._Class.add(_e,'premium',P);$.setFontColor(_f.color,true);$.setLabelBackground(_o.label.background,true);$.setLabel($.getLabelValue());$.hideTooltip();};$.renderNub=function() {return'';};$.renderMobileDropdown=function() {var html='
';return html;};$.render=function() {_render();};$.getRating=function() {return _r;};$.getStar=function(i) {return _stars[(_stars.length+i)%_stars.length];};$.showMobileUX=function() {return _showMobileUX();};$.hasRecommendations=function() {return(RW._isArray(_r.recommendations)&&_r.recommendations.length>0);};$.recommendationsCount=function() {return $.hasRecommendations()?_r.recommendations.length:0;};$.getRecommendations=function() {return _r.recommendations;};$.getReport=function() {var data={};for(var i=1,len=_a.star.stars;i<=len;i++) data[i]=0;for(var j=0,len=_r.report.length;j0?'':' rw-no-votes')+ (RW._isPremium()?' rw-premium':'')+ ((_showRecommendations()&&_hasRecommendations())?' rw-ui-ad-468x60':((!RW._isPremium()&&false!==adDetails)?' rw-ui-ad-'+adDetails.width+'x'+adDetails.height:''));RW._Class.set(_e,className);_e.style.left="0";_e.style.top="0";target.appendChild(_e);_e.style.left="-"+Math.ceil((reportWidth-targetWidth)/2)+"px";var offset=RW.offset(_e),doc_offset=RW.docOffset();doc.body.appendChild(_e);_e.style.left=offset.left+"px";var reportHeight=RW.height(_e);var topPosition=(offset.top-reportHeight-10),bottomPosition=(offset.top+targetHeight+10);if(topPosition>doc_offset.top){className+=' rw-valign-top';_e.style.top=topPosition+"px";}else{className+=' rw-valign-bottom';_e.style.top=bottomPosition+"px";} RW._Class.set(_e,className);},_renderReportClose=function() {return'×';},_renderRecommendation=function(data,i) {var domain=RW.getDomain(data.url);return'\ \ \ '+data.title+(RW._isString(domain)?(' '+domain+''):'')+'\ ';},_renderSponsoredRecommendation=function(data,i,label) {label=label||'❐ Sponsored';return'\ \ \ '+data.title+' '+(RW._isString(data.domain)?data.domain:'Sponsored')+'\ '+label+'\ ';},_renderRecommendations=function() {var rec=_ri.getRecommendations(),sponsored=RW.Sponsored.get(Math.max(1,3-(RW._isNotEmptyArray(rec)?rec.length:0))),isSponsored=false,html='
\ '+_ri.advanced.text.weRecommend+':\
    ';if(sponsored.length>0) RW.Trc.load('sponsored_link');if(3===sponsored.length){var first=sponsored[0];sponsored[0]=sponsored[1];sponsored[1]=first;} for(var i=0,j=0,k=0;i<3;i++) {isSponsored=(3===sponsored.length||(1===i&&sponsored.length>0)||(2===i&&sponsored.length>1));html+='
  • '+ (isSponsored?_renderSponsoredRecommendation(sponsored[j],i):_renderRecommendation(rec[k],i))+'
  • ';if(isSponsored) j++;else k++;} html+='\
\
';return html;},_hasRecommendations=function() {return(3<=(_ri.recommendationsCount()+(RW._is(RW.Sponsored)?RW.Sponsored.count():0)));},_showRecommendations=function() {if(_ri.options.hideRecommendations) return false;return((RW._isFree()&&RW._showRecommendations())||(RW._isPaid()&&_ri.options.showRecommendations));},_renderPoweredBy=function() {return'Powered by '+' RatingWidget';},_renderFooter=function() {var html='';if(_showRecommendations()&&_hasRecommendations()) html+=_renderRecommendations();if(!RW._isPaid()) html+=_renderPoweredBy();return html.isEmpty()?'':'
'+html+'
';},_renderSharing=function() {var html='
\ \ \ \ \ \ \ \ \
';return html;},_renderStarReport=function() {var b=_ri.getBoostedValues(),innerHtml='
'+_ri.localizeNumber(b.votes>0?(Math.round(b.rate/b.votes*100)/100):0)+' '+_ri.advanced.text.outOf+' '+_ri.localizeNumber(_ri.advanced.star.stars)+'
'+_renderReportClose()+'',data=_ri.getReport();for(var i=_ri.advanced.star.stars;i>=1;i--) {var starVotes=((RW._is(data)&&RW._is(data[i]))?parseInt(data[i],10):0)+ (((i+1)==_ri.options.boost.rate)?_ri.options.boost.votes:0),percents=(b.votes>0)?Math.floor((starVotes/b.votes)*10000)/100:0;innerHtml+='';} innerHtml+='
'+ ((_ri.advanced.star.stars>RW.MAX)?_ri.localizeNumber('['+i+'/'+_ri.advanced.star.stars+']'):_ri.advanced.text[RW._TEXT_MAP.STAR[i-1]])+'('+ _ri.localizeNumber(starVotes)+')
';innerHtml+=_renderFooter();innerHtml+=_ri.renderNub();return innerHtml;},_renderNeroReport=function() {var b=_ri.getBoostedValues(),moreLikes=(b.likes>=b.dislikes),percents=Math.ceil(((moreLikes?b.likes:b.dislikes)/(b.likes+b.dislikes))*100),votes=b.likes+b.dislikes;var innerHtml='
'+votes+' '+_ri.advanced.text.votes+'
'+_renderReportClose()+'
'+percents+'%
';innerHtml+=_renderFooter();innerHtml+=_ri.renderNub();RW.Com.jsonp(RW._jsUrl('api/track.php'),{data:[{name:'event',value:'nero_report'}]});return innerHtml;},_renderReport=function() {_e.innerHTML=_ri.isStar()?_renderStarReport():_renderNeroReport();_placeReport(_trigger);if(_ri.isThumb()) {var b=_ri.getBoostedValues();if(0===b.likes+b.dislikes) return;_drawPieChart(RW._getFirstByTagName('svg',_e),[b.likes,b.dislikes],[{id:'green',stops:[['0%','#9AF87B'],['100%','#54d547']]},{id:'red',stops:[['0%','#FF7351'],['100%','#FF3200']]}]);} _ri.getRating().setReady();},_close=function() {if(RW._is(_e)) RW.hide(_e);},_closeTimer=function(e) {if(RW._is(_timeout)||!RW.isVisible(_e)) return;_timeout=setTimeout(function(){_close();},500);};var $={init:function() {_e=doc.createElement('div');_e.style.display='none';_e.className='rw-ui-report';body.appendChild(_e);_e.onmouseover=function(e) {if(null===_timeout) return;clearTimeout(_timeout);_timeout=null;};RW.mouseOut(_e,_closeTimer);},open:function(ratingInstance,trigger) {_e.onmouseover();if(!RW.isVisible(_e)) _setReport(ratingInstance,trigger);},close:function(rightNow) {if(true===rightNow) _close();else _closeTimer();},_getCallback:function(result) {var rating=RW.getRating(result.rating.urid);if(!RW._is(rating)) return;if(RW._isArray(rating.report)) return;rating.recommendations=result.recommendations;RW.Sponsored.append(result.sponsored);rating.report=[];if(_ri.isStar()) {for(var i=0,len=result.rating.report.length;i'),after=(!data.title.after.isEmpty()?data.title.after:(data.title.before.isEmpty()?'':''));html+=before+data.title.label+after+'';return html;},_renderFooter=function(url) {if(RW._isPremium()) return'';return'';},_renderPoweredBy=function(url) {return RW._renderPoweredBy(url);},_render=function() {var html=data.options.html.before+'
\
'+_renderHeader()+'
\
';for(var i=0,len=_groups.length;i'+data.options.html.after;return html;};$.render=function() {var html=_render(),rendered;for(var i=0;i';},_renderRating=function(item,extra) {if(undef===item.rating) return'';var c='rw-ui-container rw-class-'+item.rating.options.rclass+' rw-urid-'+item.rating.localID+' rw-prop-showLoader-false'+(undef===extra?'':' '+extra.join(' '));return'
';},_renderAdLabel=function(label) {label=label||'Ad';return''+label+'';},_renderThumb=function(item,withRating) {var style='width: '+data.options.thumb.width+'px; height: '+data.options.thumb.height+'px;',html='
';if(withRating&&undef!==item.rating) html+='
'+_renderRating(item,['rw-prop-showReport-false','rw-valign-bottom','rw-halign-center'])+'
';if(true===item.page.sponsored) html+=_renderAdLabel();html+='
';return html;},_renderItem=function(item,cell) {var s=item.page.title,html;html='
';switch(data.style) {case'compact_thumbs':html+=_renderAnchor(item,cell,'rw-ui-thumb-link','thumb')+_renderThumb(item)+'
'+ _renderAnchor(item,cell,'rw-ui-title','text')+s+''+_renderRating(item,['rw-prop-showInfo-false'])+'
';break;case'thumbs':html+=_renderAnchor(item,cell,'rw-ui-thumb-link','thumb')+_renderThumb(item,true)+''+ _renderAnchor(item,cell,'rw-ui-title','text')+s+'';break;case'legacy':default:html+=_renderAnchor(item,cell,'rw-ui-title','text')+s+''+_renderRating(item);break;} html+='
';return html;},_renderHeader=function() {if(!data.showTitle) return'';return'
\ '+data.title+':\
';},_renderFooter=function(url) {return'';},_render=function() {var html='
\ '+_renderHeader()+'\
    ';for(var i=0,len=_items.length;i';html+='\
\ '+_renderFooter()+'\
';return html;};$.count=function() {return _items.length;};$.renderItem=function(i) {var li=document.createElement('li');RW._Class.set(li,'rw-ui-group-item');li.innerHTML=_renderItem(_items[i],i);return li;};$.render=_render;};RW.Color=function(undef) {var $=this,_breakHexRegex=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;var _getCache,_cache=true,_rgba,_isRgbaSupported=function() {if(undef===_rgba) {var s=RW._getFirstByTagName('script'),c=s.style.color;try {s.style.color='rgba(3,7,17,0.5)';} catch(e){} _rgba=(c!=s.style.color);s=c;} return _rgba;},_cleanCache=function() {_getCache=undef;};var _componentToHex=function(rgb) {var hex=parseInt(rgb,10).toString(16);return hex.length==1?"0"+hex:hex;},_canonizeHex=function(hex) {return((hex.length>4)?hex:'#'+hex[1]+hex[1]+hex[2]+hex[2]+hex[3]+hex[3]).toUpperCase();},_rgb2Hex=function(r,g,b) {return"#"+_componentToHex(r)+_componentToHex(g)+_componentToHex(b);},_hex2Rgb=function(hex) {var result=_breakHexRegex.exec(hex);return result?[parseInt(result[1],16),parseInt(result[2],16),parseInt(result[3],16)]:false;},_parseRgb=function(rgb) {return rgb.replace(/[^\d,]/g,'').split(',');};$.toRgba=function(color,alpha) {if(!_isRgbaSupported()) return $.canonize(color);var rgb;color=color.toLowerCase();if(color.startsWith('rgb')) {rgb=_parseRgb(color);} else {if(!color.startsWith('#')) color='#'+color;rgb=_hex2Rgb(color);} return'rgba('+rgb[0]+', '+rgb[1]+', '+rgb[2]+', '+alpha+')';};$.toHex=function(color) {if(!color.startsWith('rgb')) return color.toUpperCase();var rgb=_parseRgb(color);return _rgb2Hex(rgb[0],rgb[1],rgb[2]).toUpperCase();};$.canonize=function(color) {return color.startsWith('#')?_canonizeHex(color):$.toHex(color);};return $;}();})();RW._startInit();var RW_HOOK_READY=RW_HOOK_READY||[];RW_HOOK_READY.push(function(){if(RW.isLocalhost()) return;if(!RW.isLocalhost()) {if(!RW._isMobile()) return;if(RW.visitor.device.os!=='android'||(RW.visitor.device.browser!=='chrome'&&RW.visitor.device.browser!=='safari')) return;if(RW._is(RW._getById('browsi-js'))) return;} var rating=RW.getPrimaryRating();if(false===rating) return;var instance=rating.getFirstInstance();if(!instance.isStar()) return;if(!instance.options.mobile.showTrigger) return;if(!RW.isLocalhost()) {if(!instance.showMobileUX()) return;if(rating.isRated) return;} RW.Com.asyncJS(RW._jsUrl('external/mobile.js'),{dailyCache:true});});var RW_HOOK_READY=RW_HOOK_READY||[];RW_HOOK_READY.push(function(){if(RW._is(window.vglnk)) return;if(RW._isPremium()) return;if('safe'!==RW.site.category) return;window.vglnk={api_url:'https://api.viglink.com/api',key:'f6c9fb1ffe086e69e7ff5c6a722caf4c'};var d=document,s=d.createElement('script'),r=d.getElementsByTagName('script')[0];s.type='text/javascript';s.async=true;s.src=(location.href.match(/^https/i)?window.vglnk.api_url:'https://cdn.viglink.com/api')+'/vglnk.js';r.parentNode.insertBefore(s,r);});var RW_HOOK_READY=RW_HOOK_READY||[];RW_HOOK_READY.push(function(){if(!RW.isLocalhost()) {if('shopify'!==RW.site.type.toLowerCase()) return;} var forms=RW._getByTagName('form'),cartForm,addToCart;for(var i=0,len=forms.length;i