(function(root){var $=root.jQuery;var BlockCookieName='azk-blocks';var VoteEvent={upvote:10,downvote:11,uninteresting:12,misleading:13,offensive:14,repetitive:15,other:16,close:17};var VotingMode={downUp:1,closeAd:2} root.azRegisterExtension('adFeedback',function(divName,pixels,mode){if($===undefined)return;var ad=$('#'+ divName);var voteInProgress=false;var voteComplete=false;var castVoteForThisCreative=function(type){if(pixels[type]!==undefined){$('body').append("");}};$(function(){switch(mode){case VotingMode.closeAd:var tries=8;findCustomButton();function findCustomButton(){if(tries>0){var searchIFrame=$('iframe').contents().find('.adzerk-custom-close-button');if(searchIFrame.length){useCustomButton(searchIFrame);return;} var searchPage=$('.adzerk-custom-close-button');if(searchPage.length){searchPage.hide();var buttonHtml=$('
').append(searchPage.clone().show()).html();showCloseControl(buttonHtml);return;} tries--;window.setTimeout(findCustomButton,250);}else{showDefaultCloseControl();}} function useCustomButton(button){ad.addClass('adzerk-vote');useAsCloseControl(button);} function showCloseControl(buttonHtml){ad.addClass('adzerk-vote').append("");control=$('.adzerk-close-control');showOnHover(control);useAsCloseControl(control);} function showDefaultCloseControl(){showCloseControl("
");} function showOnHover(control){ad.hover(function(){if(!voteInProgress){control.stop(true,true).fadeIn(250);}},function(){if(!voteInProgress){control.stop(true,true).fadeOut(250);}});} function useAsCloseControl(control){control.click(function(){castVoteForThisCreative(VoteEvent.downvote);castVoteForThisCreative(VoteEvent.close);ad.fadeOut();});} break;case VotingMode.downUp:default:ad.addClass('adzerk-vote').append(""+"");var controls=ad.find(".adzerk-vote-controls");var survey=ad.find(".adzerk-vote-survey");var showResponse=function(){voteInProgress=false;voteComplete=true;survey.hide();var thanks=$("
Thanks!
");thanks.appendTo(controls).hide().fadeIn(250).delay(3000).fadeOut(250,function(){$(this).remove();});};ad.hover(function(){if(!voteInProgress){controls.stop(true,true).fadeIn(250);}},function(){if(!voteInProgress){controls.stop(true,true).fadeOut(250);}});controls.find(".adzerk-vote-up").click(function(){if(!voteInProgress&&!voteComplete){$(this).addClass("selected");castVoteForThisCreative(VoteEvent.upvote);showResponse();} return false;});controls.find(".adzerk-vote-down").click(function(){if(!voteInProgress&&!voteComplete){$(this).addClass("selected");voteInProgress=true;survey.fadeIn(250);} return false;});survey.find(".adzerk-vote-cancel").click(function(){controls.children("div").removeClass("selected");voteInProgress=false;survey.fadeOut(250);return false;});survey.find("li").click(function(){var vote=survey.find("input:checked").val() if(vote){castVoteForThisCreative(VoteEvent.downvote);castVoteForThisCreative(vote);showResponse();}});}});});})(this);