rem: if(td.hasAttribute('sortdir')) sortdir = parseInt(td.getAttribute('sortdir')); 
add: if(hasAttr(td, 'sortdir')) sortdir = parseInt(td.getAttribute('sortdir')); 
context: function ts_resortTable(lnk, cellIdx) {    // 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 table = getParent(td,'TABLE');    var tableLen = table.rows.length; //IWD: supposedly this also helps with speed    var column = cellIdx || td.cellIndex; //IWD: cellIndex is always 0 is Safari    SORT_COLUMN_INDEX = column;        //IWD: we always sort by fsv    var firstRow = new Array();    var newRows = new Array();    for (i=0;i<table.rows[0].length;i++) { firstRow[i] = table.rows[0][i]; }    for (j=1;j<tableLen;j++) { newRows[j-1] = table.rows[j]; }    //IWD: we use different sort functions b/c missing values always sort to the end    var sortfn = ts_sort_fsv_up;    // Sort determined by column    var sortdir = 1;    if(td.hasAttribute('sortdir')) sortdir = parseInt(td.getAttribute('sortdir'));    if(sortdir == -1) {        ARROW = '&nbsp;&nbsp;&uarr;';        sortfn = ts_sort_fsv_down; //IWD    } else {        ARROW = '&nbsp;&nbsp;&darr;';        sortfn = ts_sort_fsv_up; //IWD    }    /* Alternating sort    if (span.getAttribute("sortdir") == 'down') {        ARROW = '&nbsp;&nbsp;&uarr;';        span.setAttribute('sortdir','up');        sortfn = ts_sort_fsv_down; //IWD    } else {        ARROW = '&nbsp;&nbsp;&darr;';        span.setAttribute('sortdir','down');        sortfn = ts_sort_fsv_up; //IWD    }*/        newRows.sort(sortfn);        //IWD: This speeds up Mozilla; see top.    if(REMOVE_BEFORE_SORT)    {        var tableNextSib = table.nextSibling;        var tableParent = table.parentNode;        tableParent.removeChild(table);    }    // We appendChild rows that already exist to the tbody, so it moves them rather than creating new ones    //IWD: I prefer sorttop over sortbottom    // do sorttop rows only    for (i=0;i<newRows.length;i++) { if (newRows[i].className && (newRows[i].className.indexOf('sorttop') != -1)) table.tBodies[0].appendChild(newRows[i]);}    // don't do sorttop rows    for (i=0;i<newRows.length;i++) { if (!newRows[i].className || (newRows[i].className && (newRows[i].className.indexOf('sorttop') == -1))) table.tBodies[0].appendChild(newRows[i]);}    // don't do sortbottom rows    //for (i=0;i<newRows.length;i++) { if (!newRows[i].className || (newRows[i].className && (newRows[i].className.indexOf('sortbottom') == -1))) table.tBodies[0].appendChild(newRows[i]);}    // do sortbottom rows only    //for (i=0;i<newRows.length;i++) { if (newRows[i].className && (newRows[i].className.indexOf('sortbottom') != -1)) table.tBodies[0].appendChild(newRows[i]);}        if(REMOVE_BEFORE_SORT)    {        tableParent.insertBefore(table, tableNextSib)    }        // 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 = '&nbsp;&nbsp;&nbsp;';            }        }    }            span.innerHTML = ARROW;}
meta: 5448	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/5448/d55a6dcb29ed960088121c38568caf220319527f/sorttable.js/clean/public_html/js/sorttable.js