$(document).ready(function($){

	

	$(".style-options .checkbox[data-href]").on("click" , function(e) {
		window.location.href = $(this).attr("data-href");
	});
	
	$('.toggle').each(function(){ 
		var status = $(this).attr("data-status") == "active" ? true : false;
			
		$(this).toggles({
			text: {
				on: 'ON',
				off: 'OFF'
			  },
			on	: status

		}).on("toggle" , function(e,active) {
			window.location.href = $(this).attr("data-url");
		});
	});


	$('#options-toggle').on('click', function(e){
        e.preventDefault();
        $(this).parent().removeClass('bouncing').toggleClass('active');

		/*$(this).find("icon").removeClass("animated infinite");

		if ($(this).parent().hasClass('active')){
			$("html").addClass("with-configurator");
		} else {
			$("html").removeClass("with-configurator");
		}*/
    });

    
	/*$('#options-reset').on('click', function(e){
        e.preventDefault();
        $(this).parent().removeClass('bouncing');
    });*/

	/*if ($(".style-options").hasClass("active")) {
		$("html").addClass("with-configurator");
	}*/


    $(".style-options .inner-options").niceScroll({
        cursorcolor:"#9a9a9a",
        horizrailenabled:false
    });

    $(".style-options .inner-options").mouseover(function() {
        $(".style-options .inner-options").niceScroll().resize();
    });


    $('.inner-options > .options-tabs-container').easytabs({
        updateHash      : false,
        tabActiveClass  : "active",
        animate         : false
    });


    $('.content-options .options-tabs-container').easytabs({
        updateHash      : false,
        tabActiveClass  : "active",
        animate         : false,
		transitionIn	: "none",
		transitionOut	: "none"

    });

	$(".options-tabs-container[data-default]").each(function(){ 
		$($(this).attr("data-default")).trigger("click");
	});

/*
    $('.style-options a[data-toggle=xtooltip]').tooltip({
        placement: 'left',
        html: 'true',
        container: '.style-options'
    });

*/

	$("input[name=cbgalpha]").blur(function(e) {
		window.location.href=$(this).attr("data-url") + "?config[cbg:alpha]=" + $(this).val();
	});

	$("input[name=cbgcolor]").change(function(e) {
		window.location.href=$(this).attr("data-url") + "?config[cbg:color]=" + $(this).val();
	});


	$("input[name=mbgalpha]").blur(function(e) {
		window.location.href=$(this).attr("data-url") + "?config[mbg:alpha]=" + $(this).val();
	});

	$("input[name=mbgcolor]").change(function(e) {
		window.location.href=$(this).attr("data-url") + "?config[mbg:color]=" + $(this).val();
	});

});