rem: if ( !itm || itm.length() == 0 || itm.match(/[A-Za-z]/)) sortfn = ts_sort_default; 
add:  if ( !itm || (typeof itm == "string" && (itm == "" || itm.match(/[A-Za-z]/))) ) sortfn = ts_sort_default; 
context: function ts_resortTable(lnk){	// get the span	var span;	for (var ci=0;ci<lnk.childNodes.length;ci++) {		if (lnk.childNodes[ci].tagName && lnk.childNodes[ci].tagName.toLowerCase() == 'span') span = lnk.childNodes[ci];	}	var spantext = ts_getInnerText(span);	var td = lnk.parentNode;	var column = td.cellIndex;	var tr = td.parentNode;	if ( column == 0 ) {		for (var tri=0;tri<tr.childNodes.length;tri++) {			if (td==tr.childNodes[tri]) {				column = tr.childNodes[0] ? tri : tri - 1;			}		}	}	var table = getParent(td,'TABLE');	// Work out a type for the column	if (table.rows.length <= 1) return;	var regexp = new RegExp( "&.+;", "g" );	var itm = ts_getInnerText(table.rows[1].cells[column]).replace(regexp,"");	sortfn = ts_sort_numeric;	if (itm.match(/^\d\d[\/]\d\d[\/]\d\d/)) sortfn = ts_sort_date;	if (itm.match(/^[$]/)) sortfn = ts_sort_currency;	if ( !itm || itm.length() == 0 || itm.match(/[A-Za-z]/)) sortfn = ts_sort_default;	SORT_COLUMN_INDEX = column;	var firstRow = new Array();	var newRows = new Array();	var bottomRows = new Array();	for (i=0;i<table.rows[0].length;i++)		firstRow[i] = table.rows[0][i];	for (j=1;j<table.rows.length;j++)	{		if (!table.rows[j].className || (table.rows[j].className && (table.rows[j].className.indexOf('sortbottom') == -1)))		{			newRows.push(table.rows[j]);			table.rows[j].setAttribute('sortindex',j);		}		else			bottomRows.push(table.rows[j]);	}	newRows.sort(sortfn);	if (span.getAttribute('sortdir') == 'down')	{		ARROW = '<br>&uarr;';		newRows.reverse();		span.setAttribute('sortdir','up');	}	else	{		ARROW = '<br>&darr;';		span.setAttribute('sortdir','down');	}	// We append rows that already exist to the tbody, so it moves them rather than creating new ones	for (i=0;i<newRows.length;i++) table.tBodies[0].appendChild(newRows[i]);	// do sortbottom rows only	for (i=0;i<bottomRows.length;i++) table.tBodies[0].appendChild(bottomRows[i]);	// Delete any other arrows there may be showing	var allspans = document.getElementsByTagName("span");	for (var ci=0;ci<allspans.length;ci++)	{		if (allspans[ci].className == 'sortarrow')		{			if (getParent(allspans[ci],"table") == getParent(lnk,"table")) { // in the same table as us?				allspans[ci].innerHTML = '<br>&nbsp;';		}	}	if ( document.location.href.indexOf( ".php" ) == -1 )	{		for ( var i = 1; i < table.rows.length; ++i )		{			if ( i % 2 == 0 )				table.rows[i].style.backgroundColor = "#e0e0ff";			else				table.rows[i].style.backgroundColor = "#ffffff";		}	}}	span.innerHTML = ARROW;}
meta: 4541	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/4541/33cfacc8d6ef94cf019c620e927e984bb2ba6458/sorttable.js/buggy/src/html/sorttable.js