(function($){
    $.fn.jExpand = function(){
        var element = this;
        
        $(element).find("tr").hide(); //初期化
        $(element).find("tr.parent").show();	//ヘッダと親の行だけ表示
        $(element).find("tr.head").show();

        $(element).find("tr.parent").click(function() {
        	var childClass = $(this).next("tr").attr("class");	//最初の子の行のクラス名を取得
        	var shisetsuRow = $(element).find("tr." + childClass)
        	if(shisetsuRow.css("display") == "none"){
        		shisetsuRow.show();
        	}
        	else{shisetsuRow.hide();}
        });
		
/*
        $(element).find("tr:odd").addClass("odd");
        $(element).find("tr:not(.odd)").hide();
        $(element).find("tr:first-child").show();

        $(element).find("tr.odd").click(function() {
            $(this).next("tr").toggle();
        });
        */
        
    }    
})(jQuery); 
