$(document).ready(function() {
	
	if($("#wrap").length) {
        $(".gztopbo").css({'height':'0'});				
	}

	$(".gztopic .top").click(function () { 
        var starthoehe = $(this).parent().find(".inbod").height();
        var startbohoehe = $(this).parent().find(".gztopbo").height();

        //alert("Innen: "+starthoehe+" Aussen:"+startbohoehe);

        var temposi = $(this);
        var posi;
        var lastID = $(".gztopic .top").length - 1;



        if(starthoehe != startbohoehe) {

            $(".gztopic").each(function(i){
                var hoehe = $(this).find(".inbod").height();
    	        $(this).children(".gztopbo").animate({
        	        "height": hoehe+"px"
        	        }, 300, function() {
                         if (i == lastID) {
                            posi = temposi.position();
                             //$(window).animate({scrollTop : 0},'slow');
                            $(window).scrollTop(posi.top);
                        }
        	    });
            });
        }

		return false;
	});	

	$(".min a").click(function () { 
        $(this).parent().parent().parent().animate({"height": "0"}, 300);		
		return false;
	});	
        
});
