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