# GMR table sub routine
# ver 0.717(10/09/19)
#
#table_job :ジョブ表示
#table_prod：合成スキル表示
#table_stat:ステータス表示
#table_limit:シンプル表示
#table_limit2:アイコン表示
#table_full2:フル表示
#table_full3:フル２表示
#table_mission:ミッション進行度表示
#table_assault:アサルト表示
#table_history:履歴表示
#table_custom;カスタムフィールド表示
#table_weaponskill;WS習得一覧
#table_usable_ws;利用可能WS一覧
#table_synergy;練成一覧
#table_jade;ジェイド一覧（禁断
#table_atma;アートマ一覧（禁断
#table_sjade;ジェイド一覧（死闘
#table_satma;アートマ一覧（死闘
#table_mmm9;MMM警備課調練室実績一覧


sub table_job {
	print "<table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH><TH width=8%><a href='$script?limit=$limit&level=$level&sort=15&mode=r'>$index[1]</a></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH><TH width=10%>$index[7]</TH>";
	for ($j=0;$j<$job_max;$j++){
		$jn=$j+38;
		print "<TH width=2%><a href='$script?limit=$limit&level=$level&sort=$jn&mode=r'>$joblist[$j]</a></TH>";
	}
	print "<TH width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
	
	$count=0;
	
	$number=1;
	foreach $i (@all){
		
		($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
		if($class_edit==0){
			$class =~ s/&lt;/</g;
			$class =~ s/&gt;/>/g;
		}
		
		if($count==$c_max){
			print "<table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH><TH width=8%><a href='$script?limit=$limit&level=$level&sort=15&mode=r'>$index[1]</a></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH><TH width=10%>$index[7]</TH>";
			for ($j=0;$j<$job_max;$j++){
				$jn=$j+38;
				print "<TH width=2%><a href='$script?limit=$limit&level=$level&sort=$jn&mode=r'>$joblist[$j]</a></TH>";
			}
			print "<TH width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
			$count=0;
		}
		
		
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		
		
		$bgn="";
		
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		if($point eq ""){$point=0;}
		
		print "<TR$bgn><TD align=center>$no</TD><TD align=center>$class</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		
		if(($anon ne "on") || ($anon_mode != 1 )){
			
			if($lev[$mainjob]<10){
				$main_level="0$lev[$mainjob]";
			} else {
				$main_level=$lev[$mainjob];
			}
			
			
			if($supportjob <99){
				$mod_level=int($lev[$mainjob]/2);
				if($mod_level==0){$mod_level=1;}
				if($mod_level>$lev[$supportjob]){$mod_level=$lev[$supportjob];}
				
				if($mod_level<10){
					$mod_level="0$mod_level";
				}
				print "<TD align=center>$joblist[$mainjob]$main_level/$joblist[$supportjob]$mod_level</TD>";
			} else {
				print "<TD align=center>$joblist[$mainjob]$main_level</TD>";
			}
			
			
				for ($j=0;$j<$job_max;$j++){
					$bg="";
			
					if($level ==1){
						$bg=" bgcolor=$color[int($lev[$j]/10)]";
					} else {
					if($j == $mainjob){$bg=" bgcolor=$maincolor";}
					if($j == $supportjob){$bg=" bgcolor=$supportcolor";}
					}
					
					print "<TD$bg align=center>$lev[$j]</TD>";
			}
		} else {
			for ($j=0;$j<$job_max+1;$j++){
				print"<TD align=center>-</TD>";
			}
		}
		
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		print "<TD align=center>$date</TD></TR>\n";
		
		$count++;
		$number++;
		
	}
	
	print "</table>";
}

sub table_prod{
	print "<table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH><TH width=8%><a href='$script?limit=$limit&level=$level&sort=15&mode=r'>$index[1]</a></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>";
	for ($j=0;$j<$prod_max;$j++){
		$jn=$j+22;
		print "<TH width=2%><a href='$script?limit=$limit&level=$level&sort=$jn&mode=r'>$prodlist[$j]</a></TH>";
	}
	print "<TH width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
	
	$count=0;
	
	$number=1;
	foreach $i (@all){
		
		($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
		@prod_r = split(/,/,$etc[1]);
		
		if($class_edit==0){
			$class =~ s/&lt;/</g;
			$class =~ s/&gt;/>/g;
		}
		
		
		if($count==$c_max){
			print "</table><table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH><TH width=8%><a href='$script?limit=$limit&level=$level&sort=15&mode=r'>$index[1]</a></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>";
			for ($j=0;$j<$prod_max;$j++){
				$jn=$j+22;
				print "<TH width=2%><a href='$script?limit=$limit&level=$level&sort=$jn&mode=r'>$prodlist[$j]</a></TH>";
			}
			print "<TH width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
			$count=0;
		}
		
		
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		
		
		$bgn="";
		
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		
		print "<TR$bgn><TD align=center>$no</TD><TD align=center>$class</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		
		if(($anon ne "on") || ($anon_mode != 1 )){
			for ($j=0;$j<$prod_max-1;$j++){
				$bg=" bgcolor=$color[$prod_r[$j]]";
				print "<TD$bg align=center title='$ranklist[$prod_r[$j]]'>$prod[$j]<BR>($ranklist[$prod_r[$j]])</TD>";
			}
			($syn,@synt) = split( /\,/, $prod[9]);
			$temprank = sprintf( "%d", $syn / 10 );
			$bg=" bgcolor=$color[$temprank]";
			print "<TD$bg align=center title='$ranklist[$temprank]'>$syn<BR>($ranklist[$temprank])</TD>";
		} else {
			for ($j=0;$j<$prod_max;$j++){
				print"<TD align=center>-</TD>";
			}
		}
		
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		print "<TD align=center>$date</TD></TR>\n";
		
		$count++;
		$number++;
		
	}
	print "</table>";
}


sub table_stat{
	
	print "<table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=15&mode=r'>$index[1]</a></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=4'>$index[3]</a></TH><TH width=5%><a href='$script?limit=$limit&level=$level&sort=5'>$index[4]</a></TH><TH width=5%><a href='$script?limit=$limit&level=$level&sort=14&mode=r'>$index[5]</a></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=18&mode=r'>$index[6]</a></TH><TH width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TR>";
	
	$count=0;
	
	$number=1;
	foreach $i (@all){
		
		 ($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
		
		if($class_edit==0){
			$class =~ s/&lt;/</g;
			$class =~ s/&gt;/>/g;
		}
		
		if($count==$c_max){
			print "</table><table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=15&mode=r'>$index[1]</a></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=4'>$index[3]</a></TH><TH width=5%><a href='$script?limit=$limit&level=$level&sort=5'>$index[4]</a></TH><TH width=5%><a href='$script?limit=$limit&level=$level&sort=14&mode=r'>$index[5]</a></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=18&mode=r'>$index[6]</a></TH><TH width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TR>";
			$count=0;
		}
		
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		
		$bgn="";
		
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		if($point eq ""){$point=0;}
		
		print "<TR$bgn><TD align=center>$no</TD><TD align=center>$class</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		
		if($iconuse eq "yes"){
			print "<TD align=center><img src=$icondir$facelist[$race]$facetypelist[$etc[0]]\.gif></TD>";
		} else {
			print "<TD align=center>$racelist[$race]</TD>";
		}
		
		print "<TD align=center>$relmlist[$relm]</TD><TD align=right>$point</TD><TD align=center>$mrank</TD>";
		
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		print "<TD align=center>$date</TD></TR>\n";
		
		$count++;
		$number++;
	}
	print "</table>";
	
}

sub table_limit {
	print "<table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=15&mode=r'>$index[1]</a></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH><TH width=10%>$index[7]</TH><TH>$index[9]</TH><TH width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";

$count=0;

$number=1;
foreach $i (@all){

	 ($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
	
	if($class_edit==0){
		$class =~ s/&lt;/</g;
		$class =~ s/&gt;/>/g;
	}
	
	if($count==$c_max){
		print "</table><table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=15&mode=r'>$index[1]</a></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH><TH width=10%>$index[7]</TH><TH>$index[9]</TH><TH width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
		$count=0;
	}
	
	$bgn="";
	
	$diary="";
	$diaryfile="$diarydir$name.$diaryletter";
	if(-e "$diaryfile"){
		$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
		if((-M $diaryfile)<1){
			$diary.="<img src='$upgif' border=0>";
		}
		$diary.="</a>";
	}
	
	if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
	if($class eq ""){$class="&nbsp";}
	
	print "<TR$bgn><TD align=center>$no</TD><TD align=center>$class</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
	
	if(($anon ne "on") || ($anon_mode != 1 )){
		
		if($lev[$mainjob]<10){
			$main_level="0$lev[$mainjob]";
		} else {
			$main_level=$lev[$mainjob];
		}
		
		
		if($supportjob <99){
			$mod_level=int($lev[$mainjob]/2);
			if($mod_level==0){$mod_level=1;}
			if($mod_level>$lev[$supportjob]){$mod_level=$lev[$supportjob];}
		
			if($mod_level<10){
				$mod_level="0$mod_level";
			}
			print "<TD align=center>$joblist[$mainjob]$main_level/$joblist[$supportjob]$mod_level</TD>";
		} else {
			print "<TD align=center>$joblist[$mainjob]$main_level</TD>";
		}
		
	} else {
		print"<TD align=center>-</TD>";
	}
	
	$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
	
	print "<TD>$comment</TD><TD align=center>$date</TD></TR>\n";
	
	$count++;
	$number++;
	
}

print "</table>";
}

sub table_limit2 {
	print "<table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH><TH width=2%>$index[3]</TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=15&mode=r'>$index[1]</a></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH><TH width=10%>$index[7]</TH><TH>$index[9]</TH><TH width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
	
	$count=0;
	
	$number=1;
	foreach $i (@all){
	
		 ($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
	
		if($class_edit==0){
			$class =~ s/&lt;/</g;
			$class =~ s/&gt;/>/g;
		}
		
		if($count==$c_max){
			print "</table><table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH><TH width=2%>$index[3]</TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=15&mode=r'>$index[1]</a></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH><TH width=10%>$index[7]</TH><TH>$index[9]</TH><TH width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
			$count=0;
		}
		
		$bgn="";
		
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		
		print "<TR$bgn><TD align=center>$no</TD>";
		if($iconuse eq "yes"){
			print "<TD align=center><img src=$icondir$facelist[$race]$facetypelist[$etc[0]]\.gif></TD>";
		} else {
			print "<TD align=center>$racelist[$race]</TD>";
		}
		print "<TD align=center>$class</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		
		if(($anon ne "on") || ($anon_mode != 1 )){
			
			if($lev[$mainjob]<10){
				$main_level="0$lev[$mainjob]";
			} else {
				$main_level=$lev[$mainjob];
			}
			
			
			if($supportjob <99){
				$mod_level=int($lev[$mainjob]/2);
				if($mod_level==0){$mod_level=1;}
				if($mod_level>$lev[$supportjob]){$mod_level=$lev[$supportjob];}
				
				if($mod_level<10){
					$mod_level="0$mod_level";
				}
				print "<TD align=center>$joblist[$mainjob]$main_level/$joblist[$supportjob]$mod_level</TD>";
			} else {
				print "<TD align=center>$joblist[$mainjob]$main_level</TD>";
			}
			
		} else {
			print"<TD align=center>-</TD>";
		}
		
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		
		print "<TD>$comment</TD><TD align=center>$date</TD></TR>\n";
		
		$count++;
		$number++;
	}
	print "</table>";
}

sub table_full2{
	
	if($job_max>$prod_max){
		$maxcell=$job_max;
	} else {
		$maxcell=$prod_max;
	}
	
	
	print "<table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2% rowspan=2>$index[0]</TH><TH width=8% rowspan=2><a href='$script?limit=$limit&level=$level&sort=15&mode=r'>$index[1]</a></TH><TH width=10% rowspan=2><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH><TH width=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=4'>$index[3]</a></TH><TH width=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=5'>$index[4]</a></TH><TH width=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=14&mode=r'>$index[5]</a></TH><TH width=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=18&mode=r'>$index[6]</a></TH><TH width=10% rowspan=2>$index[7]</TH>";
	for ($j=0;$j<$maxcell;$j++){
		$jn=$j+38;
		if($j<$job_max){
			print "<TH width=2%><a href='$script?limit=$limit&level=$level&sort=$jn&mode=r'>$joblist[$j]</a></TH>";
		} else {
			print "<TH> </TH>";
		}
	}
	
	print "<TH width=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
	print "<TR bgcolor=$indexcolor>";
	for ($j=0;$j<$maxcell;$j++){
		$jn=$j+22;
		if($j<$prod_max){
			print "<TH width=2%><a href='$script?limit=$limit&level=$level&sort=$jn&mode=r'>$prodlist[$j]</a></TH>";
		} else {
			print "<TH> </TH>";
		}
	}
	print "</TR>";
	
	$count=0;
	
	$number=1;
	foreach $i (@all){
		
		($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
		@prod_r = split(/,/,$etc[1]);
		
		if($class_edit==0){
			$class =~ s/&lt;/</g;
			$class =~ s/&gt;/>/g;
		}
		
		if($count==$c_max){
			print "</table><table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2% rowspan=2>$index[0]</TH><TH width=8% rowspan=2><a href='$script?limit=$limit&level=$level&sort=15&mode=r'>$index[1]</a></TH><TH width=10% rowspan=2><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH><TH width=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=4'>$index[3]</a></TH><TH width=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=5'>$index[4]</a></TH><TH width=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=14&mode=r'>$index[5]</a></TH><TH width=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=18&mode=r'>$index[6]</a></TH><TH width=10% rowspan=2>$index[7]</TH>";
		for ($j=0;$j<$maxcell;$j++){
			$jn=$j+38;
			if($j<$job_max){
				print "<TH width=2%><a href='$script?limit=$limit&level=$level&sort=$jn&mode=r'>$joblist[$j]</a></TH>";
			} else {
				print "<TH> </TH>";
			}
		}
		
		print "<TH width=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
		print "<TR bgcolor=$indexcolor>";
		for ($j=0;$j<$maxcell;$j++){
			$jn=$j+22;
			if($j<$prod_max){
			print "<TH width=2%><a href='$script?limit=$limit&level=$level&sort=$jn&mode=r'>$prodlist[$j]</a></TH>";
			} else {
				print "<TH> </TH>";
			}
		}
		print "</TR>";
		
		$count=0;
		}
		
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		
		$bgn="";
		
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		if($point eq ""){$point=0;}
		
		print "<TR$bgn><TD rowspan=2 align=center>$no</TD><TD rowspan=2 align=center>$class</TD><TD rowspan=2><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		
		if($iconuse eq "yes"){
			print "<TD align=center rowspan=2><img src=$icondir$facelist[$race]$facetypelist[$etc[0]]\.gif></TD>";
		} else {
			print "<TD align=center rowspan=2>$racelist[$race]</TD>";
		}
		
		print "<TD rowspan=2 align=center>$relmlist[$relm]</TD><TD align=right rowspan=2>$point</TD><TD rowspan=2 align=center>$mrank</TD>";
		
		if(($anon ne "on") || ($anon_mode != 1 )){
			
			if($lev[$mainjob]<10){
				$main_level="0$lev[$mainjob]";
			} else {
				$main_level=$lev[$mainjob];
			}
			
			
			if($supportjob <99){
				$mod_level=int($lev[$mainjob]/2);
				if($mod_level==0){$mod_level=1;}
				if($mod_level>$lev[$supportjob]){$mod_level=$lev[$supportjob];}
				
				if($mod_level<10){
					$mod_level="0$mod_level";
				}
				print "<TD rowspan=2 align=center>$joblist[$mainjob]$main_level/$joblist[$supportjob]$mod_level</TD>";
			} else {
				print "<TD rowspan=2 align=center>$joblist[$mainjob]$main_level</TD>";
			}
			
				for ($j=0;$j<$maxcell;$j++){
					$bg="";
					if($j<$job_max){
					if($level ==1){
						$bg=" bgcolor=$color[int($lev[$j]/10)]";
					} else {
					if($j == $mainjob){$bg=" bgcolor=$maincolor";}
					if($j == $supportjob){$bg=" bgcolor=$supportcolor";}
					}
					
					print "<TD$bg align=center>$lev[$j]</TD>";
					} else {
						print "<TD align=center>　</TD>";
					}
				}
		} else {
			for ($j=0;$j<$maxcell+1;$j++){
				print"<TD align=center>-</TD>";
			}
		}
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		print "<TD rowspan=2 align=center>$date</TD></TR>\n";
		
		print "<TR bgcolor='$skillcolor'>";
		
		if(($anon ne "on") || ($anon_mode != 1 )){
		
			for ($j=0;$j<$maxcell;$j++){
				if($j<$prod_max-1){
					$bg=" bgcolor=$color[$prod_r[$j]]";
					print "<TD$bg align=center title='$ranklist[$prod_r[$j]]'>$prod[$j]</TD>";
				} elsif ( $j == $prod_max-1 ){
					($syn,@synt)=split(/\,/, $prod[9] );
					$temprank = sprintf( "%d", $syn / 10 );
					$bg=" bgcolor=$color[$temprank]";
					print "<TD$bg align=center title='$ranklist[$temprank]'>$syn</TD>";
				} else {
					print "<TD align=center>　</TD>";
				}
			}
		} else {
			for ($j=0;$j<$maxcell+1;$j++){
				print"<TD align=center>-</TD>";
			}
		}
		
		print "</TR>";
		$count++;
		$number++;
	}
	print "</table>";
}



sub table_full3{
	
	if($job_max>$prod_max){
		$maxcell=$job_max;
	} else {
		$maxcell=$prod_max;
	}
	
	
	print <<"EOM";
<table cellpading=0 width=100% class=tbl>
<TR bgcolor=$indexcolor>
<TH width=2% rowspan=3>$index[0]</TH>
<TH width=8% rowspan=3><a href='$script?limit=$limit&level=$level&sort=15&mode=r'>$index[1]</a></TH>
<TH width=10% rowspan=3><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>
<TH width=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=4'>$index[3]</a></TH>
<TH width=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=5'>$index[4]</a></TH>
<TH width=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=14&mode=r'>$index[5]</a></TH>
<TH width=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=18&mode=r'>$index[6]</a></TH>
<TH width=10% rowspan=2>$index[7]</TH>
EOM
	for ($j=0;$j<$maxcell;$j++){
		$jn=$j+38;
		if($j<$job_max){
		print "<TH width=2%><a href='$script?limit=$limit&level=$level&sort=$jn&mode=r'>$joblist[$j]</a></TH>";
		} else {
			print "<TH> </TH>";
		}
	}
	
	print "<TH width=5% rowspan=3><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
	print "<TR bgcolor=$indexcolor>";
	for ($j=0;$j<$maxcell;$j++){
		$jn=$j+22;
	    if($j<$prod_max){
	        print "<TH width=2%><a href='$script?limit=$limit&level=$level&sort=$jn&mode=r'>$prodlist[$j]</a></TH>";
	    } elsif ($j == $prod_max) {
	        print "<TH colspan=3>Next Exp</TH><TH colspan=".($maxcell - $prod_max - 3).">Total Exp.</TH>";
	    }
	}
	print "</TR>";
	
	print "<TR bgcolor=$indexcolor><TH colspan=".($job_max+5).">$index[9]</TH></TR>";
	$count=0;
	
	$number=1;
	foreach $i (@all){	
		
		($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
		@prod_r = split(/,/,$etc[1]);
		
		if($class_edit==0){
			$class =~ s/&lt;/</g;
			$class =~ s/&gt;/>/g;
		}
		
		if($count==$c_max){
			print <<"EOM";
</table>
<table cellpading=0 width=100% class=tbl>
<TR bgcolor=$indexcolor><TH width=2% rowspan=3>$index[0]</TH>
<TH width=8% rowspan=3><a href='$script?limit=$limit&level=$level&sort=15&mode=r'>$index[1]</a></TH>
<TH width=10% rowspan=3><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>
<TH width=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=4'>$index[3]</a></TH>
<TH width=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=5'>$index[4]</a></TH>
<TH width=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=14&mode=r'>$index[5]</a></TH>
<TH width=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=18&mode=r'>$index[6]</a></TH>
<TH width=10% rowspan=2>$index[7]</TH>
EOM
			for ($j=0;$j<$maxcell;$j++){
				$jn=$j+38;
				if($j<$job_max){
				print "<TH width=2%><a href='$script?limit=$limit&level=$level&sort=$jn&mode=r'>$joblist[$j]</a></TH>";
				} else {
					print "<TH> </TH>";
				}
			}
			
			print "<TH width=5% rowspan=3><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
			print "<TR bgcolor=$indexcolor>";
			for ($j=0;$j<$maxcell;$j++){
				$jn=$j+22;
				if($j<$prod_max){
					print "<TH width=2%><a href='$script?limit=$limit&level=$level&sort=$jn&mode=r'>$prodlist[$j]</a></TH>";
				}
				elsif ($j == $prod_max) {
					print "<TH colspan=3>Next Exp</TH><TH colspan=".($maxcell - $prod_max - 3).">Total Exp.</TH>";
				}
			}
			print "</TR>";
			print "<TR bgcolor=$indexcolor><TH colspan=".($job_max+5).">$index[9]</TH></TR>";
			
			$count=0;
		}
		
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		
		$bgn="";
		
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		if($point eq ""){$point=0;}
		
		print "<TR$bgn><TD rowspan=3 align=center>$no</TD><TD rowspan=3 align=center>$class</TD><TD rowspan=3><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		if($iconuse eq "yes"){
			print "<TD rowspan=2 align=center><img src=$icondir$facelist[$race]$facetypelist[$etc[0]]\.gif></TD>";
		} else {
			print "<TD rowspan=2 align=center>$racelist[$race]</TD>";
		}
		
		print "<TD rowspan=2 align=center>$relmlist[$relm]</TD><TD align=right rowspan=2>$point</TD><TD rowspan=2 align=center>$mrank</TD>";
		
		if(($anon ne "on") || ($anon_mode != 1 )){
			
			if($lev[$mainjob]<10){
				$main_level="0$lev[$mainjob]";
			} else {
				$main_level=$lev[$mainjob];
			}
			
			
			if($supportjob <99){
				$mod_level=int($lev[$mainjob]/2);
				if($mod_level==0){$mod_level=1;}
				if($mod_level>$lev[$supportjob]){$mod_level=$lev[$supportjob];}
			
				if($mod_level<10){
					$mod_level="0$mod_level";
				}
				print "<TD rowspan=2 align=center>$joblist[$mainjob]$main_level/$joblist[$supportjob]$mod_level</TD>";
			} else {
				print "<TD rowspan=2 align=center>$joblist[$mainjob]$main_level</TD>";
			}
			$totalexp = 0;
			
			for ($j=0;$j<$maxcell;$j++){
				$bg="";
				if($j<$job_max){
				$totalexp += expr_exp($lev[$j]);
				if($level ==1){
					$bg=" bgcolor=$color[int($lev[$j]/10)]";
				} else {
				if($j == $mainjob){$bg=" bgcolor=$maincolor";}
				if($j == $supportjob){$bg=" bgcolor=$supportcolor";}
				}
				
				print "<TD$bg align=center>$lev[$j]</TD>";
				} else {
					print "<TD align=center>　</TD>";
				}
			}
		} else {
			for ($j=0;$j<$maxcell+1;$j++){
				print"<TD align=center>-</TD>";
			}
		}
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		print "<TD rowspan=3 align=center>$date</TD></TR>\n";
		
		print "<TR bgcolor='$skillcolor'>";
		
		if(($anon ne "on") || ($anon_mode != 1 )){
		
			$mpointexp="";
			if($prod[12] =~m /イント<\/TD><TD bgcolor=.+>([0-9]+)<\/TD>/ ){
				$mpointexp=$1*10000;
			}
			if($prod[12] =~m /use<\/TD><TD bgcolor=.+>([0-9]+)<\/TD>/ ){
				$mpointexp = $1*10000;
			}
			if($mpointexp>0){
				if($mexpmode == 1){
					$totalexp=$totalexp+$mpointexp;
				} else {
					$totalexp="$totalexp+".$mpointexp;
				}
			}
		
		
		    for ($j=0;$j<$maxcell;$j++){
		        if($j<$prod_max-1){
					$bg=" bgcolor=$color[$prod_r[$j]]";
					print "<TD$bg align=center title='$ranklist[$prod_r[$j]]'>$prod[$j]</TD>";
				} elsif ( $j == $prod_max-1 ){
					($syn,@synt)=split(/\,/, $prod[9] );
					$temprank = sprintf( "%d", $syn / 10 );
					$bg=" bgcolor=$color[$temprank]";
					print "<TD$bg align=center title='$ranklist[$temprank]'>$syn</TD>";
		        } elsif ($j == $prod_max) {
		            print "<TD colspan=3 align=right>".expr_needexp($lev[$mainjob])."&nbsp;</TD><TD colspan=".($maxcell - $prod_max - 3)." align=right>".$totalexp."&nbsp;</TD>";
		        }
		    }
		} else {
			for ($j=0;$j<$maxcell+1;$j++){
			print"<TD align=center>-</TD>";
			}
		}
		
		print "</TR>";
		
		print "<TR$bgn><TD colspan=".($job_max+5).">$comment</TD></TR>";
		
		$count++;
		$number++;
	
	}
	
	print "</table>";

}

sub table_skill {
	print "<table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH><TH width=6%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>";
	for ($j=0;$j<$#skilllist+1;$j++){
		$jn=$j+38;
		print "<TH width=2%>$skilllist[$j]</TH>";
	}
	print "<TH width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
	
	$count=0;
	
	$number=1;
	foreach $i (@all){
		
		 ($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
		if($class_edit==0){
			$class =~ s/&lt;/</g;
			$class =~ s/&gt;/>/g;
		}
		($tempskill,$tempws)=split( /\//,$etc[2]);
		@skill = split(/,/,$tempskill);
		
		for ($j=0;$j<$#skilllist+1;$j++){
			$skillmax[$j] = -1;
			for ($k=0;$k<$job_max;$k++){
				if (int($lev[$k]) > 0) {
					$askill = expr_skillcap($k, $j, $lev[$k]);
					if ($askill > $skillmax[$j]) {
						$skillmax[$j] = $askill;
						$skillmaxjob[$j] = $k;
					}
				}
			}
		}
		
		
		if($count==$c_max){
			print "<table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH><TH width=6%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>";
			for ($j=0;$j<$#skilllist+1;$j++){
				$jn=$j+38;
				print "<TH width=2%>$skilllist[$j]</TH>";
			}
			print "<TH width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
			$count=0;
		}
		
		
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		
		$bgn="";
		
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		if($point eq ""){$point=0;}
		
		print "<TR$bgn><TD align=center>$no</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		
		if(($anon ne "on") || ($anon_mode != 1 )){
		
			for ($j=0;$j<$#skilllist+1;$j++){
				if ($skillmax[$j] > int($skill[$j])) {
					print "<td align=center>$skill[$j]</td>";
				} else {
					print "<td align=center><font color=blue>$skill[$j]</font></td>";
				}
			}
		} else {
			for ($j=0;$j<$#skilllist+1;$j++){
				print"<TD align=center>-</TD>";
			}
		}
		
		$date=substr($time,0,8);
		print "<TD align=center>$date</TD></TR>\n";
		
		$count++;
		$number++;
	}
	print "</table>";
}

sub table_level {
	$levels[0..99] = ();
	@bgnc = ();
	$maxlevel = 1;
	foreach $i (@all){
		($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
		for ($j=0;$j<$job_max;$j++){
			if (0 < $lev[$j]) {
				@leveljobs[0..$job_max] = split(/\t/, $levels[$lev[$j]]);
				$namel=substr($name,0,6). "..";
				$leveljobs[$j] .= "<a href='$script?function=profdetail&name=$name'>$namel</a><br>";
				$levels[$lev[$j]] = join("\t", @leveljobs);
				if ($name eq $c_name) {
					$bgn=" bgcolor=$mydata";
					$bgnc[$lev[$j]] = $bgn;
				}
				if ($lev[$j] > $maxlevel){
					$maxlevel = $lev[$j];
				}
			}
		}
	}
	if($maxlevel>99){$maxlevel=99;}
	print "<table cellpading=0 width=100% class=tbl>\n";
	if( ($maxlevel +1) % $c_max == 0){
		$count = 0;
	}
	else{
		$count = ( $c_max - ( ($maxlevel + 1) % $c_max ) ) % $c_max;
	}
	print "<TR bgcolor=$indexcolor><TH>LV</TH>";
	for ($j=0;$j<$job_max;$j++){
		print "<TH>$joblist[$j]</TH>";
	}
	print "</TR>\n";
	for ($lv=$maxlevel; $lv>1; $lv--) {
		if ($count == $c_max) {
			print "<TR bgcolor=$indexcolor><TH>LV</TH>";
			for ($j=0;$j<$job_max;$j++){
				print "<TH>$joblist[$j]</TH>";
			}
			print "</TR>\n";
			$count = 0;
		}
		if ($levels[$lv] eq "") {print "<tr></tr>\n";} else {
			$bgn = $bgnc[$lv]; 
			if ($bgn eq "") {$bgn = " bgcolor=$otherdata";}
			print "<TR$bgn><TD align=center>$lv</TD>";
			@leveljobs = split(/\t/, $levels[$lv]);
			for ($j=0;$j<$job_max;$j++){
				print "<td>$leveljobs[$j]</td>";
			}
			print "</tr>\n";
		}
		$count++;
	}
	print "</table>";
}


#1;

#tablelimit3

sub table_limit3 {
	
	$sort=16;
	$mode=r;
	&sort_table;
	
	print "<table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH><TH width=2%>$index[3]</TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=15&mode=r'>$index[1]</a></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH><TH width=10%>$index[7]</TH><TH>$index[9]</TH><TH width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
	
	$count=0;
	
	$number=1;
	foreach $i (@all){
		
		($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
		
		if($class_edit==0){
			$class =~ s/&lt;/</g;
			$class =~ s/&gt;/>/g;
		}
		
		
		if($count==$c_max){
			print "</table><table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH><TH width=2%>$index[3]</TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=15&mode=r'>$index[1]</a></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH><TH width=10%>$index[7]</TH><TH>$index[9]</TH><TH width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
		
		$count=0;
		}
		
		$bgn="";
		
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		
		
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		
		
		print "<TR$bgn><TD align=center>$no</TD>";
		if($iconuse eq "yes"){
			print "<TD align=center><img src=$icondir$facelist[$race]$facetypelist[$etc[0]]\.gif></TD>";
		} else {
			print "<TD align=center>$racelist[$race]</TD>";
		}
		print "<TD align=center>$class</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		
		if(($anon ne "on") || ($anon_mode != 1 )){
		
		if($lev[$mainjob]<10){
			$main_level="0$lev[$mainjob]";
		} else {
			$main_level=$lev[$mainjob];
		}
		
		
		if($supportjob <99){
			$mod_level=int($lev[$mainjob]/2);
			if($mod_level==0){$mod_level=1;}
			if($mod_level>$lev[$supportjob]){$mod_level=$lev[$supportjob];}
		
		if($mod_level<10){
			$mod_level="0$mod_level";
		}
			print "<TD align=center>$joblist[$mainjob]$main_level/$joblist[$supportjob]$mod_level</TD>";
		} else {
			print "<TD align=center>$joblist[$mainjob]$main_level</TD>";
		}
		
		
		} else {
			print"<TD align=center>-</TD>";
		}
		
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		
		print "<TD>$comment</TD><TD align=center>$date</TD></TR>\n";
		
		$count++;
		$number++;
		
	}
	
	print "</table>";
}


#udon

sub table_mission {
	
	print <<"EOM";
<table cellpading=0 width=100% class=tbl>
<TR bgcolor=$indexcolor>
<TH width=2% >$index[0]</TH>
<TH width=10% ><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=19'>Crystalline Prophecy</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=20'>Moogle Kupo d'Etat</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=21'>Shantotto Ascension</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=18'>Altana</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=22'>Campaign</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=15'>Aht Urhgan</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=0'>Promathia</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=1'>Zilart</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=2'>Sandoria</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=3'>Bastok</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=4'>Windurst</a></TH>
<TH widtH=7% ><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH>
</TR>
EOM

	$count=0;
	
	$number=1;
	foreach $i (@all){
	
		 ($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
		
		if($class_edit==0){
			$class =~ s/&lt;/</g;
			$class =~ s/&gt;/>/g;
		}
		
		if($count==$c_max){
			print <<"EOM";
</table>
<table cellpading=0 width=100% class=tbl>
<TR bgcolor=$indexcolor>
<TH width=2% >$index[0]</TH>
<TH width=10% ><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=19'>Crystalline Prophecy</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=20'>Moogle Kupo d'Etat</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=21'>Shantotto Ascension</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=18'>Altana</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=22'>Campaign</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=15'>Aht Urhgan</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=0'>Promathia</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=1'>Zilart</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=2'>Sandoria</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=3'>Bastok</a></TH>
<TH width=7% ><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=4'>Windurst</a></TH>
<TH widtH=5% ><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH>
</TR>
EOM
			$count=0;
		}
		
		$bgn="";
		
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
	
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		
		
		print "<TR$bgn><TD align=center>$no</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>\n";
		
	    @mission = split(/,/,$prod[15]);
		    
		print"<TD align=center>$addcplist[$mission[19]]($mission[19])</TD>\n";	# 石の見る夢
		print"<TD align=center>$addmklist[$mission[20]]($mission[20])</TD>\n";	# 戦慄！モグ祭りの夜
		print"<TD align=center>$addsslist[$mission[21]]($mission[21])</TD>\n";	# シャントット帝国の陰謀
		print"<TD align=center>$allist[$mission[18]]($mission[18])</TD>\n";		# アルタナ
		print"<TD align=center>$alrank[$mission[22]]($mission[22])</TD>\n";		# カンパニエ叙勲
		print"<TD align=center>$amlist[$mission[15]]($mission[15])</TD>\n";		# アトルガン
		print"<TD align=center>$pmlist[$mission[0]]($mission[0])</TD>\n";			# プロマシア
		print"<TD align=center>$jmlist[$mission[1]]($mission[1])</TD>\n";			# ジラート
		print"<TD align=center>$smlist[$mission[2]]($mission[2])</TD>\n";			# サンドリア
		print"<TD align=center>$bmlist[$mission[3]]($mission[3])</TD>\n";			# バストゥーク
		print"<TD align=center>$wmlist[$mission[4]]($mission[4])</TD>\n";			# ウィンダス
		
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		
		print "<TD align=center>$date</TD></TR>\n";
		
		$count++;
		$number++;
	}
	print "</table>";
}


#udon

sub table_dynamis {
	
	print <<"EOM";
<table cellpading=0 width=100% class=tbl>
<TR bgcolor=$indexcolor>
<TH width=2% >$index[0]</TH>
<TH width=10% ><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>
<TH width=5%><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=5'>San</a></TH>
<TH width=5%><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=6'>Bas</a></TH>
<TH width=5%><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=7'>Win</a></TH>
<TH width=5%><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=8'>Jeu</a></TH>
<TH width=5%><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=9'>Bos</a></TH>
<TH width=5%><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=10'>Xar</a></TH>
<TH width=5%><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=11'>Val</a></TH>
<TH width=5%><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=12'>Bub</a></TH>
<TH width=5%><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=13'>Quf</a></TH>
<TH width=5%><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=14'>Tav</a></TH>
<TH widtH=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH>
</TR>
EOM

	$count=0;
	
	$number=1;
	foreach $i (@all){
	
		 ($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
		
		if($class_edit==0){
			$class =~ s/&lt;/</g;
			$class =~ s/&gt;/>/g;
		}
		
		if($count==$c_max){
			print <<"EOM";
</table>
<table cellpading=0 width=100% class=tbl>
<TR bgcolor=$indexcolor>
<TH width=2% >$index[0]</TH>
<TH width=10% ><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>
<TH width=5%><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=5'>San</a></TH>
<TH width=5%><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=6'>Bas</a></TH>
<TH width=5%><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=7'>Win</a></TH>
<TH width=5%><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=8'>Jeu</a></TH>
<TH width=5%><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=9'>Bos</a></TH>
<TH width=5%><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=10'>Xar</a></TH>
<TH width=5%><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=11'>Val</a></TH>
<TH width=5%><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=12'>Bub</a></TH>
<TH width=5%><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=13'>Quf</a></TH>
<TH width=5%><a href='$script?limit=$limit&level=$level&sort=37&mode=r&function=14'>Tav</a></TH>
<TH widtH=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH>
</TR>
EOM
			$count=0;
		}
		
		$bgn="";
		
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
	
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		
		
		print "<TR$bgn><TD align=center>$no</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		
	    @mission = split(/,/,$prod[15]);
		    
		# 5:デュナミス-サンドリア　～　14:デュナミス-タブナジア
		for($j=5;$j<15;$j++){
			print "<TD align=center>$maru[$mission[$j]]</TD>\n";
		}
		
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		
		print "<TD align=center>$date</TD></TR>\n";
		
		$count++;
		$number++;
	}
	print "</table>";
}


sub table_assault2 {
	
	print "<table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH><TH>Assault</TH><TH widtH=5% ><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
	
	$count=0;
	
	$number=1;
	foreach $i (@all){
	
		 ($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
		
		if($class_edit==0){
			$class =~ s/&lt;/</g;
			$class =~ s/&gt;/>/g;
		}
		
		
		if($count==$c_max){
			print "<table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH><TH>Assault</TH><TH widtH=5% ><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>\n";
			$count=0;
		}
		
		$bgn="";
		
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		
		print "<TR$bgn><TD align=center>$no</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		
		@mission = split(/,/,$prod[15]);
		
		@assault= split (//,$mission[16]);
		$assault[0]=hex($assault[0]);
		
		print "<TD>";
		
		for($j=0;$j<5;$j++){
			if($assault[$j]==1){print "■";} else {print "＿";}
		}
		print "六門院開通　ルジャワン マムージャ レベロス ペリキア イルシシ<BR>";
		for($j=5;$j<20;$j=$j+3){
			if($assault[$j]==1){print "■";} else {print "＿";}
		}
		print "二級傭兵アサルト<BR>";
		for($j=6;$j<20;$j=$j+3){
			if($assault[$j]==1){print "■";} else {print "＿";}
		}
		print "一級傭兵アサルト<BR>";
		for($j=7;$j<20;$j=$j+3){
			if($assault[$j]==1){print "■";} else {print "＿";}
		}
		print "上級傭兵アサルト</TD>";
		
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		
		print "<TD align=center>$date</TD></TR>\n";
		
		$count++;
		$number++;
		
	}
	
	print "</table>";
}


sub table_assault {

	print "<table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2% rowspan=2>$index[0]</TH><TH width=10% rowspan=2><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH><th width=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=0'>$assaultword[1]</a></TH><TH width=3% rowspan=2><a href='$script?limit=$limit&level=$level&sort=37&function=17&mode=r'>$assaultword[7]</a></TH><TH widtH=10% colspan=6>$assaultword[0]</TH><TH widtH=6% colspan=10>$assaultword[2]</TH><TH widtH=6% colspan=10>$assaultword[3]</TH><TH widtH=6% colspan=10>$assaultword[4]</TH><TH widtH=6% colspan=10>$assaultword[5]</TH><TH widtH=6% colspan=10>$assaultword[6]</TH><TH widtH=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH>";
	print "</TR><TR bgcolor=$indexcolor><TH width=2%><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=1'>Leu</a></TH><TH width=2%><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=2'>Mam</a></TH><TH width=2%><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=3'>Leb</a></TH><TH width=2%><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=4'>Per</a></TH><TH width=2%><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=5'>Ilr</a></TH><TH width=2%><a href='$script?limit=$limit&level=$level&sort=37&function=17&mode=r'>Nyz</a></TH>";
	print "<TH title='$aslist[6]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=6'>$assaultword[8]</a></TH><TH title='$aslist[7]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=7'>$assaultword[9]</a></TH><TH title='$aslist[8]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=8'>$assaultword[10]</a></TH><TH title='$aslist[21]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=21'>$assaultword[11]</a></TH><TH title='$aslist[22]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=22'>$assaultword[12]</a></TH><TH title='$aslist[31]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=31'>$assaultword[13]</a></TH><TH title='$aslist[32]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=32'>$assaultword[14]</a></TH><TH title='$aslist[41]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=41'>$assaultword[15]</a></TH><TH title='$aslist[46]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=46'>$assaultword[16]</a></TH><TH title='$aslist[51]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=51'>$assaultword[17]</a></TH>";
	print "<TH title='$aslist[9]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=9'>$assaultword[8]</a></TH><TH title='$aslist[10]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=10'>$assaultword[9]</a></TH><TH title='$aslist[11]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=11'>$assaultword[10]</a></TH><TH title='$aslist[23]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=23'>$assaultword[11]</a></TH><TH title='$aslist[24]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=24'>$assaultword[12]</a></TH><TH title='$aslist[33]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=33'>$assaultword[13]</a></TH><TH title='$aslist[34]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=34'>$assaultword[14]</a></TH><TH title='$aslist[42]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=42'>$assaultword[15]</a></TH><TH title='$aslist[47]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=47'>$assaultword[16]</a></TH><TH title='$aslist[52]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=52'>$assaultword[17]</a></TH>";
	print "<TH title='$aslist[12]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=12'>$assaultword[8]</a></TH><TH title='$aslist[13]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=13'>$assaultword[9]</a></TH><TH title='$aslist[14]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=14'>$assaultword[10]</a></TH><TH title='$aslist[25]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=25'>$assaultword[11]</a></TH><TH title='$aslist[26]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=26'>$assaultword[12]</a></TH><TH title='$aslist[35]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=35'>$assaultword[13]</a></TH><TH title='$aslist[36]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=36'>$assaultword[14]</a></TH><TH title='$aslist[43]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=43'>$assaultword[15]</a></TH><TH title='$aslist[48]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=48'>$assaultword[16]</a></TH><TH title='$aslist[53]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=53'>$assaultword[17]</a></TH>";
	print "<TH title='$aslist[15]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=15'>$assaultword[8]</a></TH><TH title='$aslist[16]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=16'>$assaultword[9]</a></TH><TH title='$aslist[17]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=17'>$assaultword[10]</a></TH><TH title='$aslist[27]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=27'>$assaultword[11]</a></TH><TH title='$aslist[28]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=28'>$assaultword[12]</a></TH><TH title='$aslist[37]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=37'>$assaultword[13]</a></TH><TH title='$aslist[38]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=38'>$assaultword[14]</a></TH><TH title='$aslist[44]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=44'>$assaultword[15]</a></TH><TH title='$aslist[49]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=49'>$assaultword[16]</a></TH><TH title='$aslist[54]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=54'>$assaultword[17]</a></TH>";
	print "<TH title='$aslist[18]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=18'>$assaultword[8]</a></TH><TH title='$aslist[19]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=19'>$assaultword[9]</a></TH><TH title='$aslist[20]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=20'>$assaultword[10]</a></TH><TH title='$aslist[29]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=29'>$assaultword[11]</a></TH><TH title='$aslist[30]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=30'>$assaultword[12]</a></TH><TH title='$aslist[39]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=39'>$assaultword[13]</a></TH><TH title='$aslist[40]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=40'>$assaultword[14]</a></TH><TH title='$aslist[45]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=45'>$assaultword[15]</a></TH><TH title='$aslist[50]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=50'>$assaultword[16]</a></TH><TH title='$aslist[55]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=55'>$assaultword[17]</a></TH></TR>";

	$count=0;
	$number=1;
	foreach $i (@all){
	
		 ($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
		if($class_edit==0){
			$class =~ s/&lt;/</g;
			$class =~ s/&gt;/>/g;
		}
	
		if($count==$c_max){
			print "</table>";
			print "<table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2% rowspan=2>$index[0]</TH><TH width=10% rowspan=2><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH><th width=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=0'>$assaultword[1]</a></TH><TH width=3% rowspan=2><a href='$script?limit=$limit&level=$level&sort=37&function=17&mode=r'>$assaultword[7]</a></TH><TH widtH=10% colspan=6>$assaultword[0]</TH><TH widtH=6% colspan=10>$assaultword[2]</TH><TH widtH=6% colspan=10>$assaultword[3]</TH><TH widtH=6% colspan=10>$assaultword[4]</TH><TH widtH=6% colspan=10>$assaultword[5]</TH><TH widtH=6% colspan=10>$assaultword[6]</TH><TH widtH=5% rowspan=2><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH>";
			print "</TR><TR bgcolor=$indexcolor><TH width=2%><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=1'>Leu</a></TH><TH width=2%><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=2'>Mam</a></TH><TH width=2%><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=3'>Leb</a></TH><TH width=2%><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=4'>Per</a></TH><TH width=2%><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=5'>Ilr</a></TH><TH width=2%><a href='$script?limit=$limit&level=$level&sort=37&function=17&mode=r'>Nyz</a></TH>";
			print "<TH title='$aslist[6]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=6'>$assaultword[8]</a></TH><TH title='$aslist[7]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=7'>$assaultword[9]</a></TH><TH title='$aslist[8]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=8'>$assaultword[10]</a></TH><TH title='$aslist[21]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=21'>$assaultword[11]</a></TH><TH title='$aslist[22]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=22'>$assaultword[12]</a></TH><TH title='$aslist[31]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=31'>$assaultword[13]</a></TH><TH title='$aslist[32]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=32'>$assaultword[14]</a></TH><TH title='$aslist[41]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=41'>$assaultword[15]</a></TH><TH title='$aslist[46]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=46'>$assaultword[16]</a></TH><TH title='$aslist[51]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=51'>$assaultword[17]</a></TH>";
			print "<TH title='$aslist[9]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=9'>$assaultword[8]</a></TH><TH title='$aslist[10]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=10'>$assaultword[9]</a></TH><TH title='$aslist[11]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=11'>$assaultword[10]</a></TH><TH title='$aslist[23]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=23'>$assaultword[11]</a></TH><TH title='$aslist[24]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=24'>$assaultword[12]</a></TH><TH title='$aslist[33]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=33'>$assaultword[13]</a></TH><TH title='$aslist[34]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=34'>$assaultword[14]</a></TH><TH title='$aslist[42]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=42'>$assaultword[15]</a></TH><TH title='$aslist[47]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=47'>$assaultword[16]</a></TH><TH title='$aslist[52]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=52'>$assaultword[17]</a></TH>";
			print "<TH title='$aslist[12]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=12'>$assaultword[8]</a></TH><TH title='$aslist[13]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=13'>$assaultword[9]</a></TH><TH title='$aslist[14]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=14'>$assaultword[10]</a></TH><TH title='$aslist[25]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=25'>$assaultword[11]</a></TH><TH title='$aslist[26]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=26'>$assaultword[12]</a></TH><TH title='$aslist[35]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=35'>$assaultword[13]</a></TH><TH title='$aslist[36]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=36'>$assaultword[14]</a></TH><TH title='$aslist[43]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=43'>$assaultword[15]</a></TH><TH title='$aslist[48]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=48'>$assaultword[16]</a></TH><TH title='$aslist[53]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=53'>$assaultword[17]</a></TH>";
			print "<TH title='$aslist[15]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=15'>$assaultword[8]</a></TH><TH title='$aslist[16]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=16'>$assaultword[9]</a></TH><TH title='$aslist[17]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=17'>$assaultword[10]</a></TH><TH title='$aslist[27]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=27'>$assaultword[11]</a></TH><TH title='$aslist[28]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=28'>$assaultword[12]</a></TH><TH title='$aslist[37]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=37'>$assaultword[13]</a></TH><TH title='$aslist[38]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=38'>$assaultword[14]</a></TH><TH title='$aslist[44]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=44'>$assaultword[15]</a></TH><TH title='$aslist[49]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=49'>$assaultword[16]</a></TH><TH title='$aslist[54]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=54'>$assaultword[17]</a></TH>";
			print "<TH title='$aslist[18]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=18'>$assaultword[8]</a></TH><TH title='$aslist[19]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=19'>$assaultword[9]</a></TH><TH title='$aslist[20]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=20'>$assaultword[10]</a></TH><TH title='$aslist[29]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=29'>$assaultword[11]</a></TH><TH title='$aslist[30]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=30'>$assaultword[12]</a></TH><TH title='$aslist[39]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=39'>$assaultword[13]</a></TH><TH title='$aslist[40]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=40'>$assaultword[14]</a></TH><TH title='$aslist[45]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=45'>$assaultword[15]</a></TH><TH title='$aslist[50]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=50'>$assaultword[16]</a></TH><TH title='$aslist[55]'><a href='$script?limit=$limit&level=$level&sort=37&function=16&mode=r&page=55'>$assaultword[17]</a></TH></TR>";
		
			$count=0;
		}
	
		$bgn="";
		
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		
		print "<TR$bgn><TD align=center>$no</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		
		@mission = split(/,/,$prod[15]);
		
		@assault= split (//,$mission[16]);
		$assault[0]=hex($assault[0]);
		
		print"<TD align=center>$asrank[$assault[0]]</td>";
		if($mission[17]>0){
			print "<TD align=center>$nzlist[$mission[17]]</TD>";
		} else {
			print "<TD align=center>-</TD>";
		}
	
		print "<TD align=center>$maru[$assault[1]]</TD>";
		print "<TD align=center>$maru[$assault[2]]</TD>";
		print "<TD align=center>$maru[$assault[3]]</TD>";
		print "<TD align=center>$maru[$assault[4]]</TD>";
		print "<TD align=center>$maru[$assault[5]]</TD>";
		print "<TD align=center>";
		if($mission[17]==0){print "$maru[0]";} else {print "$maru[1]";}
		print "</TD>";
		print "<TD align=center>$maru[$assault[6]]</TD>";
		print "<TD align=center>$maru[$assault[7]]</TD>";
		print "<TD align=center>$maru[$assault[8]]</TD>";
		print "<TD align=center>$maru[$assault[21]]</TD>";
		print "<TD align=center>$maru[$assault[22]]</TD>";
		print "<TD align=center>$maru[$assault[31]]</TD>";
		print "<TD align=center>$maru[$assault[32]]</TD>";
		print "<TD align=center>$maru[$assault[41]]</TD>";
		print "<TD align=center>$maru[$assault[46]]</TD>";
		print "<TD align=center>$maru[$assault[51]]</TD>";
		
		print "<TD align=center>$maru[$assault[9]]</TD>";
		print "<TD align=center>$maru[$assault[10]]</TD>";
		print "<TD align=center>$maru[$assault[11]]</TD>";
		print "<TD align=center>$maru[$assault[23]]</TD>";
		print "<TD align=center>$maru[$assault[24]]</TD>";
		print "<TD align=center>$maru[$assault[33]]</TD>";
		print "<TD align=center>$maru[$assault[34]]</TD>";
		print "<TD align=center>$maru[$assault[42]]</TD>";
		print "<TD align=center>$maru[$assault[47]]</TD>";
		print "<TD align=center>$maru[$assault[52]]</TD>";
		
		print "<TD align=center>$maru[$assault[12]]</TD>";
		print "<TD align=center>$maru[$assault[13]]</TD>";
		print "<TD align=center>$maru[$assault[14]]</TD>";
		print "<TD align=center>$maru[$assault[25]]</TD>";
		print "<TD align=center>$maru[$assault[26]]</TD>";
		print "<TD align=center>$maru[$assault[35]]</TD>";
		print "<TD align=center>$maru[$assault[36]]</TD>";
		print "<TD align=center>$maru[$assault[43]]</TD>";
		print "<TD align=center>$maru[$assault[48]]</TD>";
		print "<TD align=center>$maru[$assault[53]]</TD>";
		
		print "<TD align=center>$maru[$assault[15]]</TD>";
		print "<TD align=center>$maru[$assault[16]]</TD>";
		print "<TD align=center>$maru[$assault[17]]</TD>";
		print "<TD align=center>$maru[$assault[27]]</TD>";
		print "<TD align=center>$maru[$assault[28]]</TD>";
		print "<TD align=center>$maru[$assault[37]]</TD>";
		print "<TD align=center>$maru[$assault[38]]</TD>";
		print "<TD align=center>$maru[$assault[44]]</TD>";
		print "<TD align=center>$maru[$assault[49]]</TD>";
		print "<TD align=center>$maru[$assault[54]]</TD>";
		
		print "<TD align=center>$maru[$assault[18]]</TD>";
		print "<TD align=center>$maru[$assault[19]]</TD>";
		print "<TD align=center>$maru[$assault[20]]</TD>";
		print "<TD align=center>$maru[$assault[29]]</TD>";
		print "<TD align=center>$maru[$assault[30]]</TD>";
		print "<TD align=center>$maru[$assault[39]]</TD>";
		print "<TD align=center>$maru[$assault[40]]</TD>";
		print "<TD align=center>$maru[$assault[45]]</TD>";
		print "<TD align=center>$maru[$assault[50]]</TD>";
		print "<TD align=center>$maru[$assault[55]]</TD>";
		
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		
		print "<TD align=center>$date</TD></TR>\n";
		
		$count++;
		$number++;
	}
	print "</table>";
}

sub table_history{
	
	#履歴表示
	if(!open(IN,"$historyfile")){&header; &error_message('datafile error2449','data file access failed.');}
	@list=<IN>;
	close IN;
	
	@list=reverse(@list);
	
	$items="";
	$item="";
	$count=0;
	if($language ne "English"){
		print "<table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH>変更内容</TH><TH>内容</TH><TH width=10%>時間</TH></TR>";
	} else {
		print "<table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH>Abstracts</TH><TH>Contents</TH><TH width=10%>Time</TH></TR>";
	}
	
	foreach $i(@list){
		($dummy,$rname,$rtitle,$rtime,$rmaxno,$rbody)=split(/\t/,$i);
		$rbody =~ s/&/&amp;/g;
		$rbody =~ s/"/&quot;/g;
		$rbody =~ s/'/&apos;/g;
		$rbody =~ s/&amp;sbquo;/&sbquo;/g;
		$rbody =~ s/&amp;lt;/&lt;/g;
		$rbody =~ s/&amp;gt;/&gt;/g;
		$rtime =~ s/T/ /g;
		$rtime =~ s/\+09:00//g;
		
		if($language ne "English"){
			
			if($dummy eq "DWRITE"){
				$rstitle="$rtitle : $rname さんの日記[$rmaxno]更新";
				$rsource="$rname/diary/$rmaxno";
				$link="$script?function=prof&amp;name=$rname&amp;mode=$rmaxno";
			}
			if($dummy eq "NEWREG"){
				$rstitle="$rtitle : $rname さん[$rmaxno]新規登録";
				$rsource="$rname/newreg/$rmaxno";
				$link="$script?function=profdetail&amp;name=$rname";
				$rbody="新規登録";
			}
			if($dummy eq "DMODIF"){
				$rstitle="$rtitle : $rname さんの日記[$rmaxno]修正";
				$rsource="$rname/dmodif/$rmaxno";
				$link="$script?function=prof&amp;name=$rname&amp;mode=$rmaxno&amp;mod";
				$rbody="日記修正";
			}
			if($dummy eq "PROFED"){
				$rstitle="$rname さんプロフィール変更";
				$rsource="$rname/profed/$rmaxno";
				$link="$script?function=profdetail&amp;name=$rname";
				$rbody =~ s/\//<BR>\n/g;
			}
			if($dummy eq "MERIED"){
				$rstitle="$rname さんメリットポイント 変更";
				$rsource="$rname/profed/$rmaxno";
				$link="$script?function=profdetail&amp;name=$rname";
				$rbody =~ s/\//<BR>\n/g;
			#	$rbody = "メリットポイントに変更がありました。";
			}
			if($dummy eq "CUSTED"){
				$rstitle="$rname さん$custom_field[0] 変更";
				$rsource="$rname/profed/$rmaxno";
				$link="$script?function=profdetail&amp;name=$rname";
				$rbody =~ s/\//<BR>\n/g;
			#	$rbody = "$custom_field[0]変更";
			}
			if($dummy eq "DERASE"){
				$rstitle="$rname さんの日記[$rmaxno]が削除";
				$rsource="$rname/derase/$rmaxno";
				$link="$script?function=prof&amp;name=$rname&amp;del";
				$rbody="deleted";
			}
			
			if($dummy eq "RESDIA"){
				($n1,$n2)=split(/ /,$rname);
				$rstitle="$n2 さんの日記[$rmaxno]に$n1さんがレス";
				$rsource="$n1$n2$rtitle/resdia/$rmaxno";
				$link="$script?function=prof&amp;name=$n2&amp;mode=$rmaxno&amp;$rtitle";
			}
			if( $dummy eq 'EDTRIG'){
				$rstitle="$rname さんがトリガー情報 $rtitle を変更";
			}
			if( $dummy eq 'DELTRIG'){
				$rstitle="$rname さんがトリガー情報 $rtitle を削除";
			}
		} else {
			
			if($dummy eq "DWRITE"){
				$rstitle="$rtitle : $rname 's new diary[$rmaxno]";
				$rsource="$rname/diary/$rmaxno";
				$link="$script?function=prof&amp;name=$rname&amp;no=$rmaxno";
			}
			if($dummy eq "NEWREG"){
				$rstitle="$rtitle : $rname is new comer [$rmaxno]";
				$rsource="$rname/newreg/$rmaxno";
				$link="$script?function=profdetail&amp;name=$rname";
				$rbody="New Regist";
			}
			if($dummy eq "DMODIF"){
				$rstitle="$rtitle : $rname 's diary modified[$rmaxno]";
				$rsource="$rname/dmodif/$rmaxno";
				$link="$script?function=prof&amp;name=$rname&amp;mode=$rmaxno&amp;mod";
				$rbody="Diary modified";
			}
			if($dummy eq "PROFED"){
				$rstitle="$rname chaged profile.";
				$rsource="$rname/profed/$rmaxno";
				$link="$script?function=profdetail&amp;name=$rname";
				$rbody =~ s/\//<BR>\n/g;
			}
			if($dummy eq "MERIED"){
				$rstitle="$rname changed merit point status.";
				$rsource="$rname/profed/$rmaxno";
				$link="$script?function=profdetail&amp;name=$rname";
				$rbody =~ s/\//<BR>\n/g;
			}
			if($dummy eq "DERASE"){
				$rstitle="$rname 's diary  deleted[$rmaxno]";
				$rsource="$rname/derase/$rmaxno";
				$link="$script?function=prof&amp;name=$rname&amp;del";
				$rbody="deleted";
			}
			
			if($dummy eq "RESDIA"){
				($n1,$n2)=split(/ /,$rname);
				$rstitle="Respose for $n2 's diary [$rmaxno] from $n1";
				$rsource="$n1$n2$rtitle/resdia/$rmaxno";
				$link="$script?function=prof&amp;name=$n2&amp;mode=$rmaxno&amp;$rtitle";
			}
			if( $dummy eq 'EDTRIG'){
				$rstile="$rname modified trigger, $rtitle ";
			}
			if( $dummy eq 'DELTRIG'){
				$rstile="$rname deleted trigger,  $rtitle ";
			}
		}
	
		@rbodylines = split(/<BR>/,$rbody);
		if ($#rbodylines > 8)
		{
			$rbody = join("<BR>", @rbodylines[0..5])."(and more)";
		}
	
		print "<TR bgcolor=$otherdata><TD><a href='$link'>$rstitle</a></TD><TD>$rbody</TD><TD>$rtime</TD></TR>";
		$count++;
	
	}
	print "</Table>";
	
}

sub table_custom {
	
	if($custom_control[0]){
		print "未入力者非表\示モード";
	}
	
	print "<table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>";

	for($j=1;$j<$#custom_field+1;$j++){
	
		$sort="&";
		if($custom_sort[$j]>1){$sort .= "mode=r&";}
		if($custom_sort[$j]==1 || $custom_sort[$j] ==3){$sort .= "no=1";}
		
		#ソートコード 0:設定ナシ 1:数字 2:リバース 3:数字リバース)
		print "<TH><a href='$script?limit=$limit&level=$level&sort=33&function=$j$sort'>$custom_field[$j]</a></TH>";
	}
	
		print "<TH width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
	
	$count=0;
	
	$number=1;
	foreach $i (@all){
	
		 ($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
		@custom=split(/,/,$prod[11]);
	
		if($count==$c_max){
			print "<table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>";
			for($j=1;$j<$#custom_field+1;$j++){
				print "<TH><a href='$script?limit=$limit&level=$level&sort=33&mode=r&function=$j'>$custom_field[$j]</a></TH>";
			}
			print "<TH width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
			$count=0;
		}
		
		$bgn="";
		
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		
		if($custom_control[0]){
			$match=0;
			for($j=1;$j<$#custom_field+1;$j++){
				$match += ($custom[$j] == 0);
			}
		} else {
			$match=0;
		}
		if($match != $#custom_field){
			print "<TR$bgn><TD align=center>$no</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
			
			for($j=1;$j<$#custom_field+1;$j++){
				if($custom_pulldown[$j]==0){
					print "<TD>$custom[$j]</TD>";
				} else {
					print "<TD>".${"custom_list$j"}[$custom[$j]]."</TD>";
				}
			}
			
			$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
			
			print "<TD align=center>$date</TD></TR>\n";
			$count++;
			$number++;
		}
	}
	
	print "</table>";
}

sub table_weaponskill {
	
	print <<"EOM";
<table cellpading=0 width=100% class=tbl>
<TR bgcolor=$indexcolor>
<TH rowspan=2 width=2%>$index[0]</TH>
<TH rowspan=2 width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>
EOM
	$nskill = -1;
	$str1 = "";
	$str2 = "";
	for($j=0;$j<=$#mwslist;$j++){
		( $wskill, $wname, $wtype, $wcond ) = split( /\,/, $mwslist[ $j ] );
#		print "nskill = $nskill,  wskill=$wskill,  wtype=$wtype, wcond=$wcond<br>\n";
		if( $nskill != $wskill ) {
			if( $nskill != -1 ){
				$str1 .= "<TH colspan=$skillc>$skilllist[$nskill]</TH>\n";
			}
			$skillc = 1;
			$nskill = $wskill;
		}
		else{
			$skillc++;
		}
		$str2 .= "<TH valign=bottom width=3% style=\"writing-mode: tb-rl; word-break:break-all\">$wname</TH>\n";
	}
	$str1 .= "<TH colspan=$skillc>$skilllist[$nskill]</TH>\n";
	print "$str1\n";
	print "<TH rowspan=2 width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>\n";
	print "<TR bgcolor=$indexcolor>$str2</TR>\n";
	
	$count=0;
	
	$number=1;
	foreach $i (@all){
		
		($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
		($tempskill, $tempws)=split(/\//,$etc[2]);
		@skill = split( /\,/, $tempskill );
		@ws = split( //, $tempws );
		
		if($count==$c_max){
			print "</table>\n";
			print <<"EOM";
<table cellpading=0 width=100% class=tbl>
<TR bgcolor=$indexcolor>
<TH rowspan=2 width=2%>$index[0]</TH>
<TH rowspan=2 width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>
EOM
			print "$str1";
			print "<TH rowspan=2 width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>\n";
			print "<TR bgcolor=$indexcolor>$str2</TR>\n";
			$count=0;
		}
		
		$bgn="";
		
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		
		print "<TR$bgn><TD align=center>$no</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		for($j=0;$j<=$#mwslist;$j++){
			if( $ws[ $j] ){
				print "<TD align=center>$maru[ $ws[ $j] ]</TD>\n";
			}
			else{
				print "<TD align=center>-</TD>\n";
			}
		}
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		print "<TD align=center>$date</TD></TR>\n";
		$count++;
		$number++;
	}
	
	print "</table>";
}


sub table_weaponskill2 {
	
	foreach $i (@all){
		
		($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
		if($class_edit==0){
			$class =~ s/&lt;/</g;
			$class =~ s/&gt;/>/g;
		}
		if( $c_name eq $name ){
			$self = $i;
		}
	}
	($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$self);
	($tempskill,$tempws)=split( /\//,$etc[2]);
	@skill = split( /\,/, $tempskill );
	@ws = split( //, $tempws );
	
	$nskill = -1;
	$skillcount = 0;
	$str2 = "";
	print "<table cellpading=0 width=100% class=tbl>\n";
	$str1 = <<"EOM";
<TR bgcolor=$indexcolor>
<TH width=3%  rowspan=2>$wsparam[0]</TH>
<TH width=3%  rowspan=2>$wsparam[1]</TH>
<TH width=10% rowspan=2>$wsparam[2]</TH>
<TH width=3%  rowspan=2>$wsparam[3]</TH>
<TH width=10% rowspan=2>$wsparam[4]</TH>
<TH width=10% rowspan=2>$wsparam[5]</TH>
<TH width=10% rowspan=2>$wsparam[6]</TH>
<TH width=15% colspan=3>$wsparam[7]</TH>
<TH width=15% rowspan=2>$wsparam[8]</TH>
<TH width=15% rowspan=2>$wsparam[9]</TH>
</TR>
<TR bgcolor=$indexcolor>
<TH width=5%>TP100</TH>
<TH width=5%>TP200</TH>
<TH width=5%>TP300</TH>
</TR>
<TR>
EOM

	for( $i=0; $i<=$#wslist; $i++ ){
		( $wskill,$wskillnum,$wcond,$wname,$watacknum,$wopt,$wcomment,$wtp,$wtp100,$wtp200,$wtp300,$wchain,$wstatus) = split( /\,/, $wslist[$i] );
		if( $nskill != $wskill ){
#			print "$skilllist[$nskill] → $skilllist[$wskill]（$skill[$wskill]）<br>\n";
			if( $nskill != -1 ){
				print "<TR><TD colspan=12>&nbsp;</TD></TR><TR  bgcolor=$indexcolor><TH colspan=12>$skilllist[$nskill] （$skill[$nskill]）</TH></TR>\n";
				if( $skillcount > 0 ){
					print "$str1\n";
					print "$str2\n";
				}
				$str2 = "";
			}
			$nskill = $wskill;
			$skillcount = 0;
		}
#		print "$wname（$wskillnum,$wcond） →$skilllist[$wskill]($skill[$wskill]） →";
		$wok = 0;
		if( $skill[$wskill] >= $wskillnum ){
#			print "スキル値OK →";
			if(  $wcond eq 'SP' ) {
#				print "SP →";
				@wspjoblist = split( /\,/, $spjoblist[ $wskill ] );
				foreach $j ( @wspjoblist ){
					$capskill = &expr_skillcap( $j, $wskill, $lev[$j] );
					if( $capskill > $skill[$wskill] ){
						$capskill = $skill[$wskill];
					}
#					print "$joblist[$j]（$capskill）→";
					if( $wskillnum <= $capskill ){
						$wok = 1;
#						print "OK";
					}
				}
			}
			elsif ( ( $wcond eq 'ク' ) or ( $wcond eq 'ミ' ) or ( $wcond eq 'Quest' ) or ( $wcond eq 'Myth' ) ){
#				print "クエorミシック →";
				for( $j=0; $j<=$#mwslist; $j++ ){
					( $mwskill, $mwname, $mwtype, $mwjob, $mwcond ) = split( /\,/, $mwslist[ $j ] );
					if( ( $mwname eq $wname ) and ( $ws[$j] == 1 ) ){
#						print "$mwname($ws[$j]) →OK";
						$wok = 1;
					}
				}
			}
			else {
#				print "通常orEX →OK →";
				$wok = 1;
			}
			if( $wok ){
#				print "wok";
				$skillcount++;
				if ( $wtp200 == 0 ){
					$wtp200 = $wtp100;
				}
				if( $wtp300 == 0 ){
					$wtp300 = $wtp100;
				}
				
				$tp = sprintf( "<TD>%1.2f</TD><TD>%1.2f</TD><TD>%1.2f</TD>", $wtp100, $wtp200, $wtp300 );
				$str2 .= "<TR bgcolor=$otherdata><TD>$wskillnum</TD><TD>$wcond</TD><TD>$wname</TD><TD>$watacknum</TD><TD>$wopt</TD><TD>$wcomment</TD><TD>$wtp</TD>$tp<TD>$wchain</TD><TD>$wstatus</TD></TR>\n";
#				print 
			}
		}
#		print "<BR>\n";
	}
	print "<TR><TD colspan=12>&nbsp;</TD></TR><TR bgcolor=$indexcolor><TH colspan=12>$skilllist[$nskill] （$skill[$nskill]）</TH></TR>\n";
	if( $skillcount > 0 ){
		print "$str1\n";
		print "$str2\n";
	}
	print "<TR><TD colspan=12>&nbsp;</TD></TR></table>\n";
}

sub table_synergy{
	print "<table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH><TH width=8%><a href='$script?limit=$limit&level=$level&sort=15&mode=r'>$index[1]</a></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>";
	print "<TH width=2%><a href='$script?limit=$limit&level=$level&sort=31&mode=r&function=-1'>練成</a></TH>\n";
	for ($j=0;$j<=$#synergytech;$j++){
		print "<TH width=2%><a href='$script?limit=$limit&level=$level&sort=31&mode=r&function=$j'>$synergytech[$j]</a></TH>";
	}
	print "<TH width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
	
	$count=0;
	
	$number=1;
	foreach $i (@all){
		
		($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
		@prod_r = split(/,/,$etc[1]);
		($syn,@synt) = split( /,/, $prod[9]);
		if($class_edit==0){
			$class =~ s/&lt;/</g;
			$class =~ s/&gt;/>/g;
		}
		
		
		if($count==$c_max){
			print "</table><table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH><TH width=8%><a href='$script?limit=$limit&level=$level&sort=15&mode=r'>$index[1]</a></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>";
			print "<TH width=2%><a href='$script?limit=$limit&level=$level&sort=31&mode=r'>練成</a></TH>\n";
			for ($j=0;$j<=$#synergytech;$j++){
				print "<TH width=2%><a href='$script?limit=$limit&level=$level&sort=31&mode=r'>$synergytech[$j]</a></TH>";
			}
			print "<TH width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
			$count=0;
		}
		
		
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		
		
		$bgn="";
		
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		
		print "<TR$bgn><TD align=center>$no</TD><TD align=center>$class</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>\n";
		
		$temprank = sprintf( "%d", $syn / 10 );
		$bg=" bgcolor=$color[$temprank]";
		print "<TD$bg align=center title='$ranklist[$temprank]'>$syn<BR>($ranklist[$temprank])</TD>\n";
		
		if(($anon ne "on") || ($anon_mode != 1 )){
			for ($j=0;$j<=$#synergytech;$j++){
				$bg=" bgcolor=$color[$synt[$j]]";
				print "<TD$bg align=center title='$synt[$j]'>$synt[$j]</TD>\n";
			}
		} else {
			for ($j=0;$j<=$#synergytech;$j++){
				print"<TD align=center>-</TD>";
			}
		}
		
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		print "<TD align=center>$date</TD></TR>\n";
		
		$count++;
		$number++;
		
	}
	print "</table>";
}

#table_jade;ジェイド一覧
#table_atma;アートマ一覧
#table_mmm9;MMM警備課調練室実績一覧

sub table_jade {
	$str2 = "<TR bgcolor=$indexcolor>";
	$str1 = <<"EOM";
<table cellpading=0 width=100% class=tbl>
<TR bgcolor=$indexcolor>
<TH rowspan=2 width=2%>$index[0]</TH>
<TH rowspan=2 width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>
EOM
	for($i=0;$i<=$#abyssname;$i++){
		@templist = @{$jadelist[$i]};
		$itemnum = $#templist+1;
		$listlength[$j] = $#templist;
		$str1 .= "<TH colspan=$itemnum>$abyssname[$i]</TH>\n";
		for( $k=0; $k<$itemnum; $k++ ){
			$str2 .= "<TH valign=bottom width=1% style=\"writing-mode: tb-rl; word-break:break-all\">$templist[$k]</TH>";
		}
	}
	$str1 .= "<TH rowspan=2 width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>\n";
	$str2 .= "</TR>\n";
	print "$str1\n$str2\n";
	
	$count=0;
	$number=1;
	foreach $i (@all){
		($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
		@elist = split(/\,/, $prod[15]);
		
		@mission = split(/,/,$prod[15]);
		@jades = split(/\//,$mission[23]);
		@atmas = split(/\//,$mission[24]);
		@mmm9cs = split( /\//,$mission[25]);
		
		if($count==$c_max){
			print "</table>\n$str1\n$str2\n";
			$count = 0;
		}
		
		$bgn="";
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		print "<TR$bgn><TD align=center>$no</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		
		for( $j=0; $j<=$#abyssname; $j++ ){
			@jade = split( //, $jades[$j] );
			for ( $k=0; $k<=$#{$jadelist[$j]}; $k++ ){
				print "<TD align=center>$maru[ $jade[$k] ]</TD>\n";
			}
		}
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		print "<TD align=center>$date</TD></TR>\n";
		$count++;
		$number++;
	}
	print "</table>\n";
		
}


sub table_atma {
	$str2 = "<TR bgcolor=$indexcolor>";
	$str1 = <<"EOM";
<table cellpading=0 width=100% class=tbl>
<TR bgcolor=$indexcolor>
<TH rowspan=2 width=2%>$index[0]</TH>
<TH rowspan=2 width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>
EOM
	for($i=1;$i<=$#abyssname;$i++){
		@templist = @{$atmalist[$i]};
		$itemnum = $#templist+1;
		$listlength[$j] = $#templist;
		$str1 .= "<TH colspan=$itemnum>$abyssname[$i]</TH>\n";
		for( $k=0; $k<$itemnum; $k++ ){
			$str2 .= "<TH valign=bottom width=2% style=\"writing-mode: tb-rl; word-break:break-all\">$templist[$k]</TH>";
		}
	}
	$str1 .= "<TH rowspan=2 width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>\n";
	$str2 .= "</TR>\n";
	print "$str1\n$str2\n";
	
	$count=0;
	$number=1;
	foreach $i (@all){
		($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
		@elist = split(/\,/, $prod[15]);
		
		@mission = split(/,/,$prod[15]);
		@jades = split(/\//,$mission[23]);
		@atmas = split(/\//,$mission[24]);
		@mmm9cs = split( /\//,$mission[25]);
		
		if($count==$c_max){
			print "</table>\n$str1\n$str2\n";
			$count = 0;
		}
		
		$bgn="";
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		print "<TR$bgn><TD align=center>$no</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		
		for( $j=1; $j<=$#abyssname; $j++ ){
			@atma = split( //, $atmas[$j] );
			for ( $k=0; $k<=$#{$atmalist[$j]}; $k++ ){
				print "<TD align=center>$maru[ $atma[ $k ] ]</TD>\n";
			}
		}
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		print "<TD align=center>$date</TD></TR>\n";
		$count++;
		$number++;
	}
	print "</table>\n";
		
}

sub table_sjade {
	$str2 = "<TR bgcolor=$indexcolor>";
	$str1 = <<"EOM";
<table cellpading=0 width=100% class=tbl>
<TR bgcolor=$indexcolor>
<TH rowspan=2 width=2%>$index[0]</TH>
<TH rowspan=2 width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>
EOM
	for($i=0;$i<=$#abyssname2;$i++){
		@templist = @{$jadelist2[$i]};
		$itemnum = $#templist+1;
		$listlength[$j] = $#templist;
		$str1 .= "<TH colspan=$itemnum>$abyssname2[$i]</TH>\n";
		for( $k=0; $k<$itemnum; $k++ ){
			$str2 .= "<TH valign=bottom width=1% style=\"writing-mode: tb-rl; word-break:break-all\">$templist[$k]</TH>";
		}
	}
	$str1 .= "<TH rowspan=2 width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>\n";
	$str2 .= "</TR>\n";
	print "$str1\n$str2\n";
	
	$count=0;
	$number=1;
	foreach $i (@all){
		($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
		@elist = split(/\,/, $prod[15]);
		
		@mission = split(/,/,$prod[15]);
		@jades = split(/\//,$mission[26]);
		@atmas = split(/\//,$mission[27]);
		
		if($count==$c_max){
			print "</table>\n$str1\n$str2\n";
			$count = 0;
		}
		
		$bgn="";
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		print "<TR$bgn><TD align=center>$no</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		
		for( $j=0; $j<=$#abyssname2; $j++ ){
			@jade = split( //, $jades[$j] );
			for ( $k=0; $k<=$#{$jadelist2[$j]}; $k++ ){
				print "<TD align=center>$maru[ $jade[$k] ]</TD>\n";
			}
		}
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		print "<TD align=center>$date</TD></TR>\n";
		$count++;
		$number++;
	}
	print "</table>\n";
		
}


sub table_satma {
	$str2 = "<TR bgcolor=$indexcolor>";
	$str1 = <<"EOM";
<table cellpading=0 width=100% class=tbl>
<TR bgcolor=$indexcolor>
<TH rowspan=2 width=2%>$index[0]</TH>
<TH rowspan=2 width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>
EOM
	for($i=1;$i<=$#abyssname2;$i++){
		@templist = @{$atmalist2[$i]};
		$itemnum = $#templist+1;
		$listlength[$j] = $#templist;
		$str1 .= "<TH colspan=$itemnum>$abyssname2[$i]</TH>\n";
		for( $k=0; $k<$itemnum; $k++ ){
			$str2 .= "<TH valign=bottom width=2% style=\"writing-mode: tb-rl; word-break:break-all\">$templist[$k]</TH>";
		}
	}
	$str1 .= "<TH rowspan=2 width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>\n";
	$str2 .= "</TR>\n";
	print "$str1\n$str2\n";
	
	$count=0;
	$number=1;
	foreach $i (@all){
		($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
		@elist = split(/\,/, $prod[15]);
		
		@mission = split(/,/,$prod[15]);
		@jades = split(/\//,$mission[26]);
		@atmas = split(/\//,$mission[27]);
		
		if($count==$c_max){
			print "</table>\n$str1\n$str2\n";
			$count = 0;
		}
		
		$bgn="";
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		print "<TR$bgn><TD align=center>$no</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		
		for( $j=1; $j<=$#abyssname2; $j++ ){
			@atma = split( //, $atmas[$j] );
			for ( $k=0; $k<=$#{$atmalist2[$j]}; $k++ ){
				print "<TD align=center>$maru[ $atma[ $k ] ]</TD>\n";
			}
		}
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		print "<TD align=center>$date</TD></TR>\n";
		$count++;
		$number++;
	}
	print "</table>\n";
		
}



# return 1 to require
1;