var disqus_shortname=countVars.disqusShortname;(function(){var nodes=document.getElementsByTagName('span');for(var i=0,url;i<nodes.length;i++){if(nodes[i].className.indexOf('dsq-postid')!=-1&&nodes[i].parentNode.tagName=='A'){nodes[i].parentNode.setAttribute('data-disqus-identifier',nodes[i].getAttribute('data-dsqidentifier'));url=nodes[i].parentNode.href.split('#',1);if(url.length==1){url=url[0];}
else{url=url[1];}
nodes[i].parentNode.href=url+'#disqus_thread';}}
var s=document.createElement('script');s.async=true;s.type='text/javascript';s.src='https://'+disqus_shortname+'.disqus.com/count.js';(document.getElementsByTagName('HEAD')[0]||document.getElementsByTagName('BODY')[0]).appendChild(s);}());;var disqus_url=embedVars.disqusUrl;var disqus_identifier=embedVars.disqusIdentifier;var disqus_container_id='disqus_thread';var disqus_shortname=embedVars.disqusShortname;var disqus_title=embedVars.disqusTitle;var disqus_config_custom=window.disqus_config;var disqus_config=function(){var dsqConfig=embedVars.disqusConfig;this.page.integration=dsqConfig.integration;this.page.remote_auth_s3=dsqConfig.remote_auth_s3;this.page.api_key=dsqConfig.api_key;this.sso=dsqConfig.sso;this.language=dsqConfig.language;if(disqus_config_custom)
disqus_config_custom.call(this);};(function(){var dsq=document.createElement('script');dsq.type='text/javascript';dsq.async=true;dsq.src='https://'+disqus_shortname+'.disqus.com/embed.js';(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(dsq);})();;jQuery(document).ready(function($){$('.wp-review-comment-field.allowed-to-rate a').on('click',function(){var $this=$(this),$elem=$this.closest('.wp-review-comment-field');if($elem.hasClass('allowed-to-rate')){$elem.removeClass('has-not-rated-yet');$elem.find('.review-result').css('width',parseInt($this.data('input-value'))*20+'%');$elem.find('.wp_review_comment_rating').val($this.data('input-value'));}});var $commentFeedback=$('.wp-review-feedback');$commentFeedback.on('click','a',function(e){var $this=$(this);e.preventDefault();if($this.hasClass('voted')||$this.siblings().hasClass('voted')||$commentFeedback.hasClass('processing'))return;$.ajax({type:'POST',url:wpreview.ajaxurl,beforeSend:function(){$commentFeedback.addClass('processing');},data:{action:'mts_review_feedback',isHelpful:$this.data('value'),commentId:$this.data('comment-id')},success:function(data){$this.closest('.wp-review-feedback').find('a').removeClass('voted');$this.addClass('voted').find('.feedback-count').text('('+data+')');},error:function(jqXHR){alert(jqXHR.responseText);},complete:function(){$commentFeedback.removeClass('processing');}});});if($('#wp-review-comment-title-field').length){$('#wp-review-comment-title-field').closest('form').addClass('wp-review-comment-form');}});function wp_review_rate($elem){var is_comment_rating=($elem.is('.wp-review-comment-rating-star')||!!$elem.closest('.wp-review-comment-rating-star').length);if(is_comment_rating){return'';}
var rating=$elem.find('.wp-review-user-rating-val').val();var postid=$elem.find('.wp-review-user-rating-postid').val();var token=$elem.find('.wp-review-user-rating-nonce').val();var $target=$elem;if(!$target.is('.wp-review-user-rating'))
$target=$elem.closest('.wp-review-user-rating');if(rating==0){return'';}
jQuery.ajax({beforeSend:function(){$target.addClass('wp-review-loading');},data:{action:'wp_review_rate',post_id:postid,nonce:token,review:rating},type:'post',dataType:'json',url:wpreview.ajaxurl,success:function(response){$target.removeClass('wp-review-loading');if(typeof response.html!=='undefined'&&response.html!=''){$target.empty().append(response.html).addClass('has-rated');}
if(typeof response.rating_total!=='undefined'&&response.rating_total!=''){$target.parent().find('.wp-review-user-rating-total').text(response.rating_total);}
if(typeof response.rating_count!=='undefined'&&response.rating_count!=''){$target.parent().find('.wp-review-user-rating-counter').text(response.rating_count);}}});}