////////////////////////////
// http://adipalaz.awardspace.com/experiments/jquery/accordion4.html
// * When using this script, please keep the above url intact.
///////////////////////////
(function($) {
//Jonas Raoni Soares Silva - http://jsfromhell.com/string/capitalize [rev. #2]
String.prototype.capitalize = function(){
    return this.replace(/\S+/g, function(a){
        return a.charAt(0).toUpperCase() + a.slice(1).toLowerCase();
    });
};

$.fn.wrapper = function(){
    return this.each(function() {
        if ($(this).next('div.collapse').attr("id")) {
            var $destination = $(this).next('div.collapse').attr("id"),
                $title = 'Zobrazit/Skrýt&nbsp;';
        } else {
            var $destination = '',
            $title = 'Zobrazit/Skrýt';
        }
        $(this).wrapInner('<a style="display:block" href=#' + $destination + ' title=' + $title + '></a>');
    });
};
})(jQuery);
////////////////////////////
$(function() {
    $('#outer h4.expand').wrapper();
   
    //Queued Slide Effects 
    $('#outer div.expandbox').find('h4.expand:eq(0)').addClass('open').end()
    .find('div.collapse:gt(0)').hide().end()
    .find('h4.expand').each(function() {
          $(this).click(function() {

              var $thisCllps = $(this).next('div.collapse');
              var $cllpsVisible = $(this).siblings('h4.expand').next('div.collapse:visible');
              
              ($cllpsVisible.length) ? $(this).toggleClass('open').siblings('h4.expand').removeClass('open')
                  .next('div.collapse:visible').slideUp('fast', function() {
                  $thisCllps.slideDown('fast');
                  }) : $(this).toggleClass('open').next('div.collapse').slideToggle();
              return false;
          });
     });

});
