/************************************************************************************************************ (C) www.dhtmlgoodies.com, November 2005 This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website. Terms of use: You are free to use this script as long as the copyright message is kept intact. However, you may not redistribute, sell or repost it without our permission. Thank you! www.dhtmlgoodies.com Alf Magne Kalleland ************************************************************************************************************/ var tableWidget_okToSort = true; var tableWidget_arraySort = new Array(); tableWidget_tableCounter = 1; var activeColumn = new Array(); var currentColumn = false; function getnumbers2(nid) { if(!nid)return n='' x=nid for(i=0;i47) n+=x.charAt(i); } return(n) } function sortNumeric(a,b){ if(!a)return 1 if(!b)return 1 a=getnumbers2(a); b=getnumbers2(b); if(!a)return 1 if(!b)return 1 a = a.replace(/,/,'.'); b = b.replace(/,/,'.'); if(!a)return 1 if(!b)return 1 a = a.replace(/[^\d\.\/]/g,''); b = b.replace(/[^\d\.\/]/g,''); if(!a)return 1 if(!b)return 1 if(a.indexOf('/')>=0)a = eval(a); if(!a)return 1 if(!b)return 1 if(b.indexOf('/')>=0)b = eval(b); if(!a)return 1 if(!b)return 1 return a/1 - b/1; } function sortString(a, b) { if(!b)return 1; if(!a)return 1; a = a.replace(/<\S[^><]*>/g,''); b = b.replace(/<\S[^><]*>/g,''); if(!b)return 1; if(!a)return 1; if ( a.toUpperCase() < b.toUpperCase() ) return -1; if(!a)return 1 if(!b)return 1 if ( a.toUpperCase() > b.toUpperCase() ) return 1; if(!a)return 1 if(!b)return 1 return 0; } function sortTable() { if(!tableWidget_okToSort)return; tableWidget_okToSort = false; /* Getting index of current column */ var obj = this; var indexThis = 0; while(obj.previousSibling){ obj = obj.previousSibling; if(obj.tagName=='TD')indexThis++; } if(this.getAttribute('direction') || this.direction){ direction = this.getAttribute('direction'); if(navigator.userAgent.indexOf('Opera')>=0)direction = this.direction; if(direction=='ascending'){ direction = 'descending'; this.setAttribute('direction','descending'); this.direction = 'descending'; }else{ direction = 'ascending'; this.setAttribute('direction','ascending'); this.direction = 'ascending'; } }else{ direction = 'ascending'; this.setAttribute('direction','ascending'); this.direction = 'ascending'; } var tableObj = this.parentNode.parentNode.parentNode; var tBody = tableObj.getElementsByTagName('TBODY')[0]; var widgetIndex = tableObj.getAttribute('tableIndex'); if(!widgetIndex)widgetIndex = tableObj.tableIndex; if(currentColumn)currentColumn.className=''; document.getElementById('col' + widgetIndex + '_' + (indexThis+1)).className='highlightedColumn'; currentColumn = document.getElementById('col' + widgetIndex + '_' + (indexThis+1)); var sortMethod = tableWidget_arraySort[widgetIndex][indexThis]; // N = numeric, S = String if(activeColumn[widgetIndex] && activeColumn[widgetIndex]!=this){ if(activeColumn[widgetIndex])activeColumn[widgetIndex].removeAttribute('direction'); } activeColumn[widgetIndex] = this; var cellArray = new Array(); var cellObjArray = new Array(); for(var no=1;no=0;no--){ for(var no2=0;no2