/*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */
/*global $, window, location, CSInterface, SystemPath, themeManager*/

(function () {
	'use strict';
    var csInterface = new CSInterface();
    var filePath = csInterface.getSystemPath(SystemPath.EXTENSION);

	
	function init() {            
        themeManager.init();
        
        $('#btn_devTools').click(function(){
            csInterface.openURLInDefaultBrowser('http://localhost:8088/');
        });

        $('#footer').click(function(){
            csInterface.openURLInDefaultBrowser('http://dandkagency.com/?pk_campaign=Velositey%20v2%20Panel/');
        });

        $('.btn_add').click(function(){
            var element = $(this).attr("value");
            csInterface.evalScript('addElement("' + filePath + '","' + element + '")');
        });

        $('#btn_mapicon').click(function(){
            csInterface.evalScript('mapicon("' + filePath + '")');
        });

        $('#btn_favicon').click(function(){
            csInterface.evalScript('favicon("' + filePath + '")');
        });

        $('#btn_newTemplate').click(function(){
            csInterface.evalScript('newTemplate()');
        });

        $('#btn_saveIcon').click(function(){
            csInterface.evalScript('saveIcon()');
        });

        $(document).ready(function() {
            $(".tabs-menu a").click(function(event) {
                event.preventDefault();
                $("button.current").removeClass( "current" );
                $(this).children().addClass("current");
                
                var tab = $(this).attr("href");
                $(".tab-content").not(tab).css("display", "none");
                $(tab).fadeIn();
            });
        });
    }
	init();
}());
    
