(function () {
    'use strict';
    $(function () {
        $("#accordion").accordion({
            collapsible: true,
            heightStyle: "content"
        });
    });

    $(function () {
        $(document).tooltip({
            position: {
                my: "center top+2"
                , at: "center bottom"
            }
        });
    });

    $(document).ready(
        function () {
            $("html").niceScroll({
                zindex: 9999,
                scrollspeed: 300
            });
        }
    );
    
    var active = $( ".selector" ).accordion( "option", "active" );
    active.css("zindex", "auto");



    var csInterface = new CSInterface();

    // Reloads extension panel
    function reloadPanel() {
        location.reload();
    }
   // logo ref
    $(document).ready(function () {
        $("#i_logo").on("click", function (a) {
            a.preventDefault();
            (new CSInterface).openURLInDefaultBrowser("http://vsco.co/")
        })
    });    
   //update 
    $(document).ready(function () {
        $("#updatePanel").on("click", function (a) {
            a.preventDefault();
            (new CSInterface).openURLInDefaultBrowser("https://pan.baidu.com/s/1geAwaGV")
        })
    });


    var extensionRoot = csInterface.getSystemPath(SystemPath.EXTENSION) + "/jsx/includes/";


    function init() {

        
        themeManager.init();

        $("#btn_reload").click(reloadPanel);
        
        //tools
      
        
        
        
        //vsco-ajdm
        
        
        
        // vsco-shadows
        $("#btn_sadows_red").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_ShadowsColor_red.jsx")');
        });
        $("#btn_sadows_orange").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_ShadowsColor_orange.jsx")');
        });
        $("#btn_sadows_blue").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_ShadowsColor_blue.jsx")');
        });
        $("#btn_sadows_green").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_ShadowsColor_green.jsx")');
        });
        $("#btn_sadows_purple").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_ShadowsColor_purple.jsx")');
        });
        $("#btn_sadows_yellow").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_ShadowsColor_yellow.jsx")');
        });
       //vsco-Highlights
        
         $("#btn_Highlights_red").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_HighlightsColor_red-h.jsx")');
        });
        $("#btn_Highlights_blue").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_HighlightsColor_blue-h.jsx")');
        });
        $("#btn_Highlights_cream").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_HighlightsColor_cream-h.jsx")');
        });
        $("#btn_Highlights_green").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_HighlightsColor_green-h.jsx")');
        });
        $("#btn_Highlights_purple").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_HighlightsColor_purple-h.jsx")');
        });
        $("#btn_Highlights_yellow").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_HighlightsColor_yellow-h.jsx")');
        });
       
        //frequncy separation
        $("#btn_retouch_2B").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Retouch/retouch_2B.jsx")');
        });

        $("#btn_retouch_3B").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Retouch/retouch_3B.jsx")');
        });

        $("#btn_highlights_recovery").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'HDR/HDR_HighlightsRecovery.jsx")');
        });

        $("#btn_shadows_recovery").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'HDR/HDR_ShadowsRecovery.jsx")');
        });
        $("#btn_HDR").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'HDR/HDR_HDR.jsx")');
        });
        $("#btn_boost_details").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'HDR/HDR_BoostDetails.jsx")');
        });
        $("#btn_clarity").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'HDR/HDR_Clarity.jsx")');
        });
        $("#btn_detail_extractor").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'HDR/HDR_DetailExtractorfor.jsx")');
        });
        $("#btn_lights_detailed").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'HDR/HDR_LightsDetailed.jsx")');
        });
        $("#btn_darks_detiled").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'HDR/HDR_DarksDetailed.jsx")');
        });
        $("#btn_make_it_glow").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'HDR/HDR_Make_It_Glow.jsx")');
        });
        $("#btn_make_it_glow_2").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'HDR/HDR_Make_It_Glowv2.jsx")');
        });
        $("#btn_Retouch_2L_GB").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Retouch/Retouch_Retouch_2L_GB.jsx")');
        });
        $("#btn_Retouch_2L_SB").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Retouch/Retouch_Retouch_2L_SB.jsx")');
        });
        $("#btn_Retouch_3L_GB").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Retouch/Retouch_Retouch_3L_GB.jsx")');
        });
        $("#btn_Retouch_3L_SB").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Retouch/Retouch_Retouch_3L_SB.jsx")');
        });
        $("#btn_FastRetouch").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Retouch/Retouch_FastRetouch.jsx")');
        });
        $("#btn_HairRetouch").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Retouch/Retouch_HairRetouch.jsx")');
        });
        $("#btn_UniformitySkintone").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Retouch/Retouch_UniformitySkintone.jsx")');
        });
        $("#btn_BurnDodgeLayers").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Retouch/Retouch_Burn_DodgeLayers.jsx")');
        });
       

        //color
        $("#btn_Aa1").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_A1.jsx")');
        });
        $("#btn_A2").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_A2.jsx")');
        });
        $("#btn_A3").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_A3.jsx")');
        });
        $("#btn_A4").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_A4.jsx")');
        });
        $("#btn_A5").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_A5.jsx")');
        });
        $("#btn_A6").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_A6.jsx")');
        });
        $("#btn_A7").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_A7.jsx")');
        });
        $("#btn_A8").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_A8.jsx")');
        });
        $("#btn_A9").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_A9.jsx")');
        });
        $("#btn_A10").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_A10.jsx")');
        });
        
        $("#btn_C1").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_C1.jsx")');
        });
        $("#btn_C2").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_C2.jsx")');
        });
        $("#btn_C3").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_C3.jsx")');
        });
        $("#btn_C4").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_C4.jsx")');
        });
        $("#btn_C5").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_C5.jsx")');
        });
        $("#btn_C6").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_C6.jsx")');
        });
        $("#btn_C7").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_C7.jsx")');
        });
        $("#btn_C8").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_C8.jsx")');
        });
        $("#btn_C9").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_C9.jsx")');
        });
        
        $("#btn_E1").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_E1.jsx")');
        });
        $("#btn_E2").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_E2.jsx")');
        });
        $("#btn_E3").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_E3.jsx")');
        });
        $("#btn_E4").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_E4.jsx")');
        });
        $("#btn_E5").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_E5.jsx")');
        });
        $("#btn_E6").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_E6.jsx")');
        });
        $("#btn_E7").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_E7.jsx")');
        });
        
        $("#btn_F1").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_F1.jsx")');
        });
        $("#btn_F2").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_F2.jsx")');
        });
        $("#btn_F3").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_F3.jsx")');
        });
        
        $("#btn_G1").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_G1.jsx")');
        });
        $("#btn_G2").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_G2.jsx")');
        });
        $("#btn_G3").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_G2.jsx")');
        });
        
        $("#btn_HB1").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_HB1.jsx")');
        });
        $("#btn_HB2").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_HB2.jsx")');
        });
        
        $("#btn_KK1").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_KK1.jsx")');
        });
        $("#btn_KK2").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_KK2.jsx")');
        });
        $("#btn_M3").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_M3.jsx")');
        });
        $("#btn_M4").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_M4.jsx")');
        });
        $("#btn_M5").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_M5.jsx")');
        });
        $("#btn_M6").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_M6.jsx")');
        });
        $("#btn_BW").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'VSCO/color_BW.jsx")');
        });
        
        
       






       


       



        //Instagram

        $("#btn_Lark").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Lark.jsx")');
        });
        $("#btn_Juno").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Juno.jsx")');
        });
        $("#btn_Aden").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Aden.jsx")');
        });
        $("#btn_Inkwell").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Inkwell.jsx")');
        });
        $("#btn_Hefe").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Hefe.jsx")');
        });
        $("#btn_Amaro").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Amaro.jsx")');
        });
        $("#btn_Kelvin").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Kelvin.jsx")');
        });
        $("#btn_Nashville").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Nashville.jsx")');
        });
        $("#btn_Reyes").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Reyes.jsx")');
        });
        $("#btn_Toaster").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Toaster.jsx")');
        });
        $("#btn_Walden").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Walden.jsx")');
        });
        $("#btn_XPro").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_XPro.jsx")');
        });
        $("#btn_Brannan").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Brannan.jsx")');
        });
        $("#btn_Earlybird").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Earlybird.jsx")');
        });
        $("#btn_Moon").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Moon.jsx")');
        });
        $("#btn_Hudson").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Hudson.jsx")');
        });
        $("#btn_Clarendon").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Clarendon.jsx")');
        });
        $("#btn_Gingham").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Gingham.jsx")');
        });
        $("#btn_LoFi").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_LoFi.jsx")');
        });
        $("#btn_Ludwig").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Ludwig.jsx")');
        });
        $("#btn_Crema").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Crema.jsx")');
        });     
        $("#btn_Valencia").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Valencia.jsx")');
        });
        $("#btn_Filmic").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Filmic.jsx")');
        });
        $("#btn_Charmes").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Charmes.jsx")');
        });
        $("#btn_Charmes2").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Charmes.jsx")');
        });
        $("#btn_Slumber").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Slumber.jsx")');
        });
        $("#btn_Perpetua").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Perpetua.jsx")');
        });
        $("#btn_Mayfair").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Mayfair.jsx")');
        });
        $("#btn_Rise").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Rise.jsx")');
        });
        $("#btn_Sierra").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Sierra.jsx")');
        });

        $("#btn_Willow").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Willow.jsx")');
        });

        $("#btn_Sinson").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Sinson.jsx")');
        });
        $("#btn_Vesper").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Vesper.jsx")');
        });
        $("#btn_1977").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_1977.jsx")');
        });
        $("#btn_Maven").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Maven.jsx")');
        });
        $("#btn_Ginza").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Ginza.jsx")');
        });
        $("#btn_Skyline").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Ginza.jsx")');
        });
        $("#btn_Dogpatch").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Dogpatch.jsx")');
        });
        $("#btn_Brooklyn").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Brooklyn.jsx")');
        });
        $("#btn_Helena").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Helena.jsx")');
        });
        $("#btn_Ashby").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Ashby.jsx")');
        });
        $("#btn_Sutro").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Instagram/color_Sutro.jsx")');
        });

        //Sharpness
        $("#btn_Resize").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Sharpness/Sharpness_Resize.jsx")');
        });
        $("#btn_Sharpness").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Sharpness/Sharpness_Sharpness.jsx")');
        });
        $("#btn_SharpnessforLessResolution").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Sharpness/Sharpness_SharpnessforLessResolution.jsx")');
        });
        $("#btn_SharpnessforPortrait").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Sharpness/Sharpness_SharpnessforPortrait.jsx")');
        });
        $("#btn_SharpnessforPortraitforLessResolution").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Sharpness/Sharpness_SharpnessforPortraitforLessResolution.jsx")');
        });

        //Saturatiom
        
        
        
        $("#btn_UniformitySkintone").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_UniformitySkintone.jsx")');
        });
        $("#btn_WhiteBalance").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_WhiteBalance.jsx")');
        });
        $("#btn_Vintage").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_Vintage.jsx")');
        });
        $("#btn_NaturalColor").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_NaturalColor.jsx")');
        });
        $("#btn_Red_Cyan").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_Red_Cyan.jsx")');
        });
        $("#btn_GradingMap").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_GradingMap.jsx")');
        });
        $("#btn_ShadowsColor").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_ShadowsColor.jsx")');
        });
        $("#btn_HighlightsColor").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_HighlightsColor.jsx")');
        });
        $("#btn_ColorClone").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_ColorClone.jsx")');
        });
        $("#btn_ExclusionGrading").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Color/color_ExclusionGrading.jsx")');
        });
        $("#btn_MidTonesToneContract").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Contrast/Contrast_MidTonesToneContract.jsx")');
        });
        $("#btn_MidTonesColorContract").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Contrast/Contrast_MidTonesColorContract.jsx")');
        });
        $("#btn_MatteEfect").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Contrast/Contrast_MatteEfect.jsx")');
        });
        $("#btn_AutoHistogram").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Contrast/Contrast_AutoHistogram.jsx")');
        });
        $("#btn_MoreContrast").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Contrast/Contrast_MoreContrast.jsx")');
        });
        $("#btn_MakeMoreBrighter").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Contrast/Contrast_MakeMoreBrighter.jsx")');
        });
        $("#btn_FilmicContrast").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Contrast/Contrast_FilmicContrast.jsx")');
        });
        $("#btn_Vignette").click(function () {
            csInterface.evalScript('evalFile("' + extensionRoot + 'Contrast/Contrast_Vignette.jsx")');
        });
    }
    init();

}());