(function($){$.extend({tablesorter:newfunction(){varparsers=[],widgets=[],tbl;this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:false,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",onRenderHeader:null,selectorHeaders:"thead th",tableClass:"tablesorter",debug:false};functionlog(s){if(typeofconsole!=="undefined"&&typeofconsole.debug!=="undefined")console.log(s);elsealert(s)}functionbenchmark(s,d){log(s+","+((newDate).getTime()-d.getTime())+"ms")}this.benchmark=benchmark;functiongetElementText(config,node,cellIndex){vartext="",te=config.textExtraction;if(!node)return"";if(!config.supportsTextContent)config.supportsTextContent=node.textContent||false;if(te==="simple")if(config.supportsTextContent)text=node.textContent;elseif(node.childNodes[0]&&node.childNodes[0].hasChildNodes())text=node.childNodes[0].innerHTML;elsetext=node.innerHTML;elseif(typeofte==="function")text=te(node);elseif(typeofte==="object"&&te.hasOwnProperty(cellIndex))text=te[cellIndex](node);elsetext=$(node).text();returntext}functiongetParserById(name){vari,l=parsers.length;for(i=0;i<l;i++)if(parsers[i].id.toLowerCase()===name.toLowerCase())returnparsers[i];returnfalse}functiongetNodeFromRowAndCellIndex(rows,rowIndex,cellIndex){returnrows[rowIndex].cells[cellIndex]}functiontrimAndGetNodeText(config,node,cellIndex){return$.trim(getElementText(config,node,cellIndex))}functiondetectParserForColumn(table,rows,rowIndex,cellIndex){vari,l=parsers.length,node=false,nodeValue="",keepLooking=true;while(nodeValue===""&&keepLooking){rowIndex++;if(rows[rowIndex]){node=getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex);nodeValue=trimAndGetNodeText(table.config,node,cellIndex);if(table.config.debug)log("Checking if value was empty on row:"+rowIndex)}elsekeepLooking=false}for(i=1;i<l;i++)if(parsers[i].is(nodeValue,table,node))returnparsers[i];returnparsers[0]}functionbuildParserCache(table,$headers){if(table.tBodies.length===0)return;varrows=table.tBodies[0].rows,list,cells,l,i,p,parsersDebug="";if(rows[0]){list=[];cells=rows[0].cells;l=cells.length;for(i=0;i<l;i++){p=false;if($.metadata&&$($headers[i]).metadata()&&$($headers[i]).metadata().sorter)p=getParserById($($headers[i]).metadata().sorter);elseif(table.config.headers[i]&&table.config.headers[i].sorter)p=getParserById(table.config.headers[i].sorter);elseif($($headers[i]).attr("class").match("sorter-"))p=getParserById($($headers[i]).attr("class").match(/sorter-(\w+)/)[1]||"");if(!p)p=detectParserForColumn(table,rows,-1,i);if(table.config.debug)parsersDebug+="column:"+i+" parser:"+p.id+"\n";list.push(p)}}if(table.config.debug)log(parsersDebug);returnlist}functionbuildCache(table){vartotalRows=table.tBodies[0]&&table.tBodies[0].rows.length||0,totalCells=table.tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length||0,parsers=table.config.parsers,cache={row:[],normalized:[]},i,j,c,cols,cacheTime;if(table.config.debug)cacheTime=newDate;for(i=0;i<totalRows;++i){c=$(table.tBodies[0].rows[i]);cols=[];if(c.hasClass(table.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue}cache.row.push(c);for(j=0;j<totalCells;++j)cols.push(parsers[j].format(getElementText(table.config,c[0].cells[j],j),table,c[0].cells[j]));cols.push(cache.normalized.length);cache.normalized.push(cols);cols=null}if(table.config.debug)benchmark("Building cache for "+totalRows+" rows:",cacheTime);returncache}functiongetWidgetById(name){vari,l=widgets.length;for(i=0;i<l;i++)if(widgets[i].id.toLowerCase()===name.toLowerCase())returnwidgets[i]}functionapplyWidget(table){varc=table.config.widgets,i,l=c.length;for(i=0;i<l;i++)getWidgetById(c[i]).format(table)}functionappendToTable(table,cache){if(cache.row.length===0)return;varc=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=n[0