$(document).ready(function() {
    $(".valoloota").fancybox();
    $(".galotsikkokuva img").imageFrame('rounded');
    $("#galleria li").quickpaginate({ perpage: 4, showcounter: true, pager : $("#galleriakontrolli")});
    $('#bgimg').cycle('fade');
    function OpenContainerFromToggler(togglers, containers)
    {
        var that = this;

        this.togglers = togglers;
        this.containers = containers;

        this.init = function()
        {
            // At init, hide all containers
            $(this.containers).hide();
            // Set pointer cursor for togglers
            $(this.togglers).css('cursor', 'pointer');

            // Bind click events to titles
            $(this.togglers).click(function() {
                // Hide ALL containers
                $(that.containers)
                    //.not($('+ '+ that.containers +'', this))
                    .slideUp();

                // Display only the hidable element below the clicked element
                $('+'+that.containers +':hidden', this)
                    .slideDown();
            });
        }
    }
    new OpenContainerFromToggler('div.raceinfo', 'div.racesummary').init();

});
