$(document).ready(function() {

    // popup01
	/*
    var left = Math.round( ( $(window).width() / 2 ) - ( $(".popup01").width() / 2 ) );
    var top = Math.round( ( $(window).height() / 2 ) - ( $(".popup01").height() / 2 ) );
    $(".popup01").css({"left": left, "top": top, "opacity": "0.92"});

    $(".popup01 .close").click(function(){
        $(".popup01").css('display', 'none');
    });
*/
    // popup02
    /*
    var left = Math.round( ( $(window).width() / 2 ) - ( $(".popup02").width() / 2 ) );
    var top = Math.round( ( $(window).height() / 2 ) - ( $(".popup02").height() / 2 ) );
    $(".popup02").css({"left": left, "top": top, "opacity": "0.92"});

    $(".popup02 .close").click(function(){
        $(".popup02").css('display', 'none');
    });
	*/
    // step by step drop-down menu on the left
	/*
    $("#select1").change(function(){
        if( !$(this).val() )
            $("#select2, #select3").attr("disabled", "disabled");
        else {
            $("#select2").removeAttr("disabled");
            if ( $("#select2").val() )
                $("#select3").removeAttr("disabled");
        }
    });

    $("#select2").change(function(){
        if( !$(this).val() )
            $("#select3").attr("disabled", "disabled");
        else
            $("#select3").removeAttr("disabled");
    });


    $(".distributors select:eq(0)").change(function(){
        if( !$(this).val() )
            $(".distributors select:eq(1), .distributors select:eq(2)").attr("disabled", "disabled");
        else {
            $(".distributors select:eq(1)").removeAttr("disabled");
            if ( $(".distributors select:eq(1)").val() )
                $(".distributors select:eq(2)").removeAttr("disabled");
        }
    });

    $(".distributors select:eq(1)").change(function(){
        if( !$(this).val() )
            $(".distributors select:eq(2)").attr("disabled", "disabled");
        else
            $(".distributors select:eq(2)").removeAttr("disabled");
    });
    
*/
    $("#jcarousel").jcarousel({
        scroll: 1,
        animation: 'slow',
        buttonNextHTML: null,
        buttonPrevHTML: null,
        initCallback: carousel_initCallback
    });

    function carousel_initCallback(carousel) {

        $('ul.tabs li').bind('click', function() {
            $('ul.tabs li').removeClass();
            $(this).addClass('active');
            carousel.scroll( jQuery.jcarousel.intval( $(this).text() ) );
            return false;
        });
    };
	$(".popup02 input[type='text'], .popup01 input[type='text']").valRep();

});
