jQuery.fn.gwfaq = function(params) {
        var options = {
                   header: 'h5',
                   content: 'ul',
                   imgplus:'fileadmin/templates/images/icon_plus.gif',
                   imgminus:'fileadmin/templates/images/icon_minus.gif'
        }
        var op = jQuery.extend(options, params);
        var $el = $(this);
        return this.each(function(){
                   var $question = $(op.header,this);
                   var $response = $(op.content,this);
                   
                   $question.css("cursor", "pointer") ;
                   $question.prepend('<img src="'+op.imgplus+'" />  ');                   
                   if ($(this).find(op.header).length) {
                               $response.hide();
                               
                   }                   
                   $question.bind("click",function(event){
                               var $currentItem = $(this);
                               
                               var add = true;
                               var $slide = $currentItem.nextAll().filter(function(i){
                                           if($(this).is(op.header)) {
                                                       add = false;
                                           }
                                           return add;
                               });     
                                                    
                               $el.find(op.header).each(function(){                                    
                                    $(this).children()[0].src = op.imgplus;
                                     
                               });                               
                               $x = $($(this).next()[0]);
                               if($x && $x.css('display') =='none'){
                                    var $self = $slide.slideDown("slow");
                                    $currentItem.children()[0].src = op.imgminus;
                                     console.debug($self);   
                               }else{
                                    var $self = $slide.slideUp("slow");
                                    $currentItem.children()[0].src = op.imgplus;
                                    console.debug('up: '+$self);   
                               }                                  
                               $el.find(op.content).not($self).slideUp("slow");
                               
                   });
        });
};

var imgplus ='fileadmin/templates/images/icon_plus.gif';
var imgminus='fileadmin/templates/images/icon_minus.gif';
function ToggleBlock(block,img){
    //$(block).css(400);
    $content = $(block);
    if($content.css('display')=='none'){
        $content.show(400);
        $(img).attr('src',imgminus );
    }else{
        $content.hide(400);
        $(img).attr('src',imgplus );
    }
}
