<!--
/**
 * 掲示板ソートスクリプト
 * @auther 作成者不明
 */

function hilite(obj){
	obj.style.backgroundColor="#CCCCFF";
}
function normal(obj){
	obj.style.backgroundColor="white";
}


var x=new Array();
var nodeArray=new Array();
var n;
function init(){
	stackList();
	
	n=document.getElementsByTagName('tr').length-1;
	/**
	 * start -> edited by JKC.
	 */
	if (! (objTbody = document.getElementById('tbd1')))
		return;
	n = objTbody.getElementsByTagName('tr').length;
	/**
	 * end edit.
	 */
	for(i=0;i<n;i++){
		nodeArray[i]=document.getElementById("tr"+i);
	}
}
function numericSort(k){
	for(i=0;i<n;i++){
		xval=nodeArray[i].childNodes[k].firstChild.nodeValue;
		x[i]=parseFloat(xval);
	}
	sort();
	show();
}
function stringSort(k){
	for(i=0;i<n;i++){
		xval=nodeArray[i].childNodes[k].firstChild.nodeValue;
		x[i]=xval;
	}
	sort();
	show();
}
var downward=true;
function sort(){
	complete=false;
	while(!complete){
		complete=true;
		for(i=0;i<n-1;i++){
			if(downward){
			if(x[i]>x[i+1]){
				buf=x[i];x[i]=x[i+1];x[i+1]=buf;
				buf=nodeArray[i];nodeArray[i]=nodeArray[i+1];nodeArray[i+1]=buf;
				complete=false;
			}
			}else{
			if(x[i]<x[i+1]){
				buf=x[i];x[i]=x[i+1];x[i+1]=buf;
				buf=nodeArray[i];nodeArray[i]=nodeArray[i+1];nodeArray[i+1]=buf;
				complete=false;
			}
			}
		}
	}
}
function show(){
	tbody=document.getElementById('tbd1')
	for(i=0;i<n;i++){
	tbody.removeChild(nodeArray[i]);
	}
	for(i=0;i<n;i++){
	tbody.appendChild(nodeArray[i]);
	}
}

window.onload = init;
//-->

