(function(E){var J,Q,D,N,S,G,M,B,O;var P=function(){Q=E("#ap_tabs li");D=E("div.ap_panel");E("#ap_tabs li>a").click(K);E("#ap_tabs li:first").addClass("current");D.css("display","none");E("div.ap_panel:first").css("display","block");E("#ap_enclosure-at-top").attr("disabled",!E("#ap_behaviour-enclosure").attr("checked"));E("#ap_behaviour-enclosure").click(function(){E("#ap_enclosure-at-top").attr("disabled",!E(this).attr("checked"))});E("#ap_transparentpagebg").click(function(){var U=E("#ap_pagebgcolor");if(E("#ap_transparentpagebg").attr("checked")){U.attr("disabled",true);U.css("color","#999999")}else{U.attr("disabled",false);U.css("color","#000000")}});E("#ap_audiofolder-check").css("display","block");E("#ap_check-button").click(F);E("#ap_audiowebpath_iscustom").change(H);H();E("#ap_reset").val("");E("#ap_resetcolor").click(function(){E("#ap_reset").val("1");E("#ap_option-form").submit()});N=E("#ap_fieldselector");S=E("#ap_colorvalue");G=E("#ap_picker-btn");M=E("#ap_colorsample");B=E("#ap_"+N.val()+"color");N.change(function(){B=E("#ap_"+N.val()+"color");S.val(B.val());G.ColorPickerSetColor(B.val());M.css("background-color",B.val())});S.keyup(function(){var U=S.val();if(U.match(/#?[0-9a-f]{6}/i)){B.val(U);M.css("background-color",U);G.ColorPickerSetColor(B.val());C()}});var T=E("#ap_themecolor");if(T){T.css("display","none");themeColorPickerBtn=E("#ap_themecolor-btn");themeColorPickerBtn.click(function(U){T.css({top:themeColorPickerBtn.offset().top+themeColorPickerBtn.height()+3,left:themeColorPickerBtn.offset().left});T.show();U.stopPropagation()});E("li",T).click(function(U){var V=E(this).attr("title");if(V.length==4){V=V.replace(/#(.)(.)(.)/,"#$1$1$2$2$3$3")}S.val(V);B.val(V);M.css("background-color",V);C();E("#ap_themecolor").css("display","none");U.stopPropagation()});E(document).click(function(){T.hide()})}G.ColorPicker({onChange:function(U,X,W){var V="#"+X;S.val(V);B.val(V);M.css("background-color",V);C()},onShow:function(){T.hide()}});R()};var K=function(T){var U;var W=E(this);var V=W.parent();T.preventDefault();if(V.attr("class")=="current"){return }Q.removeClass("current");V.addClass("current");D.css("display","none");var X=W.attr("href").replace(/[^#]*#/,"");E("#"+X).css("display","block");if(X=="ap_panel-colour"){J=setTimeout(C,100)}else{if(J){clearTimeout(J)}}};var R=function(){B=E("#ap_"+N.val()+"color");S.val(B.val());G.ColorPickerSetColor(B.val());M.css("background-color",B.val())};var C=function(){O=audioplayer_swfobject.getObjectById("ap_demoplayer");E("#ap_colorselector input[type=hidden]").each(function(T){O.SetVariable(E(this).attr("name").replace(/ap_(.+)color/,"$1"),E(this).val().replace("#",""))});O.SetVariable("setcolors",1)};var L=function(T){var U=target.attr("title");if(U.length==4){U=U.replace(/#(.)(.)(.)/,"#$1$1$2$2$3$3")}E("#ap_colorvalue").val(U);getCurrentColorField().val(U);C();E("#ap_picker-btn").ColorPickerSetColor(U);E("ap_colorsample").css("background-color",U);E("#ap_themecolor").css("display","none")};var F=function(){I("checking");E.post(ap_ajaxRootURL+"check-audio-folder.php",{audioFolder:E("#ap_audiowebpath").val()},A)};var A=function(T){E("#ap_checking-message").css("display","none");if(T=="ok"){I("success")}else{E("#ap_failure-message strong").text(T);I("failure")}};var I=function(T){E("#ap_info-message").css("display","none");E("#ap_disabled-message").css("display","none");E("#ap_checking-message").css("display","none");E("#ap_success-message").css("display","none");E("#ap_failure-message").css("display","none");if(T!="none"){E("#ap_"+T+"-message").css("display","block")}};var H=function(){if(E("#ap_audiowebpath_iscustom").val()=="false"){E("#ap_check-button").attr("disabled",false);I("info")}else{E("#ap_check-button").attr("disabled",true);I("disabled")}};E(P)})(jQuery);