jQuery(document).ready(function(b){b("#filmstrip").sortable({delay:1,items:".item",placeholder:"item-tmp"});b("#set-nav ul li a").click(function(a){a.preventDefault();a.returnValue=!1;var a=b(this),c=b("#set-nav ul li a").index(a),d=b("#set-nav ul li a.current"),e=b("#set-cont ul li.current"),g=b("#set-cont ul li").eq(c);if(!a.hasClass("current"))return d.removeClass("current"),a.addClass("current"),e.removeClass("current"),g.addClass("current"),window.localStorage&&(localStorage.currentTab=c),!1});

if(window.localStorage){var f=localStorage.currentTab;f&&b("#set-nav ul li a").eq(f).click()}b("#set-cont").on("click",".span2 .button",function(a){a.preventDefault();a.returnValue=!1;var a=b(this),c=a.prev(),d=a.parent().next(),e=a.attr("action-data");tb_show("",admin_url+"media-upload.php?type=image&amp;TB_iframe=true");window.send_to_editor=function(a){var regex = /src="([^"]*)"/g;var imgurl = regex.exec(a)[1];"slider"==e?d.html('<img src="'+ajax_url+"?src="+imgurl+'&w=220&h=137.5&zc=1&q=100" alt="" />'):d.html('<img src="'+

imgurl+'" alt="" />');c.val(imgurl);tb_remove()};return!1});b("#addbutton-thumb").click(function(){b(this);var a=b("#thumb-preview");tb_show("",admin_url+"media-upload.php?type=image&amp;TB_iframe=true");window.send_to_editor=function(c){var regex = /src="([^"]*)"/g;var imgurl = regex.exec(c)[1];a.append('<div class="thumb-preview"><img src="'+imgurl+'"/><input type="hidden" name="monkey-options[thumbs][]" value="'+imgurl+'" /><a href="javascript:;">X</a></div>');tb_remove()};return!1});b("#thumb-preview").on("click",".thumb-preview a",

function(){b(this).parent().remove();return!1});b(".layout a").click(function(a){a.preventDefault();a.returnValue=!1;if(!b(this).hasClass("current"))return b(".layout a.current").removeClass("current"),b(this).addClass("current"),b("#layout").val(b(this).attr("layout")),!1});b("#add-sliders").click(function(a){a.preventDefault();a=b("#filmstrip > .item").length+1;b("#filmstrip").append('<div class="item new-item clx"><div class="span span1"><label class="set-label">\u5e7b\u706f\u7247'+a+'</label></div><div class="span span2"><input type="text" class="set-thumb set-input" name="monkey-options[filmstrip][title][]" value="" placeholder="\u56fe\u7247\u6807\u9898" title="\u56fe\u7247\u6807\u9898">\u6807\u9898<br /><input type="text" class="set-thumb set-input" name="monkey-options[filmstrip][href][]" value="" placeholder="\u94fe\u63a5\u5730\u5740" title="\u94fe\u63a5\u5730\u5740">\u94fe\u63a5<br /><input type="text" class="set-thumb set-input" name="monkey-options[filmstrip][src][]" value="" placeholder="\u56fe\u7247\u5730\u5740" title="\u56fe\u7247\u5730\u5740"><a href="#" class="button" action-data="slider">\u4e0a\u4f20\u56fe\u7247</a><div class="set-text" style="display:none"><textarea type="textarea" class="set-textaera" name="monkey-options[filmstrip][text][]"  placeholder="\u6587\u5b57\u5185\u5bb9" title="\u6587\u5b57\u5185\u5bb9"></textarea></div></div><div class="span span3"></div><a href="#" class="filmstrip-remove">X</a></div>');

b("body").scrollTop(b(".new-item").offset().top);return!1});b("#set-cont").on("click",".item .filmstrip-remove",function(a){a.preventDefault();b(this).parent().remove();return!1});b(".switch").click(function(){var a=b(this),c=a.children("input");a.hasClass("disabled")?(a.removeClass("disabled"),c.val(1),a.hasClass("switch-sliderenabled")&&b("#slider-itemwrap").show(),a.hasClass("switch-focusenabled")&&b("#focus-itemwrap").show(),a.hasClass("switch-listad")&&b("#listad-itemwrap").show(),a.hasClass("switch-topic")&&b("#topic-itemwrap").show(),a.hasClass("switch-event")&&b("#event-itemwrap").show()):(a.addClass("disabled"),c.val(0),a.hasClass("switch-sliderenabled")&&b("#slider-itemwrap").hide(),a.hasClass("switch-focusenabled")&&b("#focus-itemwrap").hide(),a.hasClass("switch-listad")&&b("#listad-itemwrap").hide(),a.hasClass("switch-topic")&&b("#topic-itemwrap").hide(),a.hasClass("switch-event")&&b("#event-itemwrap").hide());return!1});b(".sidepos").click(function(a){a.preventDefault();

var a=b(this),c=a.attr("rel"),d=a.parent().children("input");a.hasClass("current")?(b(".sidepos").addClass("current"),a.removeClass("current")):(b(".sidepos").removeClass("current"),a.addClass("current"));d.val(c);return!1});b("#weibo-auth, #weibo-delete-auth").click(function(a){a.preventDefault();window.open(b(this).attr("href"),"Invoker Auth","width=800,height=600,left=150,top=100,scrollbar=no,resize=no");return!1})});