jQuery(function(a){function s(s,e){wysijaAJAX.task="get_social_bookmarks",wysijaAJAX.wysijaData={size:s,theme:e},jQuery.ajax({type:"POST",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(s){if(void 0!=s.result){var e,o=JSON.parse(s.result),t="",i='class="selected"';a.each(Object.keys(o.icons).sort(),function(s,r){t+='<li class="clearfix"><a href="javascript:;" '+i+' rel="'+r+'">',e=o.icons[r],0==s&&(i="",a("#bookmarks-iconset").val(r),s++),a.each(["facebook","twitter","google","linkedin"],function(a,s){t+='<img src="'+e[s]+'" alt="'+s+'" />'})}),t+="</a></li>",a("ul.icons").html(t)}},dataType:"json"})}var e=window.parent.document.getElementById("bodyBgColorInput").value;(void 0===e||6!==e.length)&&(e="FFFFFF"),a("ul.icons").css("backgroundColor","#"+e),a(document).on("click",".bookmarks .sizes a",function(){return a(".bookmarks .sizes a").removeClass("selected"),a(this).addClass("selected"),s(a(this).attr("rel"),a("#bookmarks-theme").val()),a("#bookmarks-size").val(a(this).attr("rel")),a("#bookmarks-iconset").val(""),!1}),a(document).on("click",".bookmarks .icons a",function(){return a(".bookmarks .icons a").removeClass("selected"),a(this).addClass("selected"),a("#bookmarks-iconset").val(a(this).attr("rel")),!1}),a("#bookmarks-submit").click(function(){return wysijaAJAX.task="generate_social_bookmarks",wysijaAJAX._wpnonce=wysijanonces.campaigns.generate_social_bookmarks,wysijaAJAX.wysijaData=a("#bookmarks-form").serializeArray(),jQuery.ajax({type:"POST",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(a){void 0!==a.result&&""!==a.result?window.parent.WysijaPopup.success(a.result):window.parent.WysijaPopup.cancel()}}),!1}),a(function(){s(a("#bookmarks-size").val(),a("#bookmarks-theme").val())})});