(function($){$.extend({tablesorter:newfunction(){varg=[],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:"mmddyyyy",onRenderHeader:null,selectorHeaders:'thead th',tableClass:'tablesorter',debug:false};functionlog(s){if(typeofconsole!=="undefined"&&typeofconsole.debug!=="undefined"){console.log(s)}else{alert(s)}}functionbenchmark(s,d){log(s+","+(newDate().getTime()-d.getTime())+"ms")}this.benchmark=benchmark;functiongetElementText(a,b,c){vard="",te=a.textExtraction;if(!b){return""}if(!a.supportsTextContent){a.supportsTextContent=b.textContent||false}if(te==="simple"){if(a.supportsTextContent){d=b.textContent}else{if(b.childNodes[0]&&b.childNodes[0].hasChildNodes()){d=b.childNodes[0].innerHTML}else{d=b.innerHTML}}}else{if(typeof(te)==="function"){d=te(b)}elseif(typeof(te)==="object"&&te.hasOwnProperty(c)){d=te[c](b)}else{d=$(b).text()}}returnd}functiongetParserById(a){vari,l=g.length;for(i=0;i<l;i++){if(g[i].id.toLowerCase()===a.toLowerCase()){returng[i]}}returnfalse}functiongetNodeFromRowAndCellIndex(a,b,c){returna[b].cells[c]}functiontrimAndGetNodeText(a,b,c){return$.trim(getElementText(a,b,c))}functiondetectParserForColumn(a,b,c,d){vari,l=g.length,node=false,nodeValue='',keepLooking=true;while(nodeValue===''&&keepLooking){c++;if(b[c]){node=getNodeFromRowAndCellIndex(b,c,d);nodeValue=trimAndGetNodeText(a.config,node,d);if(a.config.debug){log('Checking if value was empty on row:'+c)}}else{keepLooking=false}}for(i=1;i<l;i++){if(g[i].is(nodeValue,a,node)){returng[i]}}returng[0]}functionbuildParserCache(a,b){if(a.tBodies.length===0){return}varc=a.tBodies[0].rows,list,cells,l,h,i,p,parsersDebug="";if(c[0]){list=[];cells=c[0].cells;l=cells.length;for(i=0;i<l;i++){p=false;h=$(b[i]);if($.metadata&&(h.metadata()&&h.metadata().sorter)){p=getParserById(h.metadata().sorter)}elseif((a.config.headers[i]&&a.config.headers[i].sorter)){p=getParserById(a.config.headers[i].sorter)}elseif(h.attr('class')&&h.attr('class').match('sorter-')){p=getParserById(h.attr('class').match(/sorter-(\w+)/)[1]||'')}if(!p){p=detectParserForColumn(a,c,-1,i)}if(a.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n"}list.push(p)}}if(a.config.debug){log(parsersDebug)}returnlist}functionbuildCache(a){varb=a.tBodies[0],totalRows=(b&&b.rows.length)||0,totalCells=(b.rows[0]&&b.rows[0].cells.length)||0,g=a.config.parsers,cache={row:[],normalized:[]},i,j,c,cols,cacheTime;if(a.config.debug){cacheTime=newDate()}for(i=0;i<totalRows;++i){c=$(b.rows[i]);cols=[];if(c.hasClass(a.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(g[j].format(getElementText(a.config,c[0].cells[j],j),a,c[0].cells[j],j))}cols.push(cache.normalized.length);cache.normalized.push(cols);cols=null}if(a.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime)}a.config.cache=cache;returncache}functiongetWidgetById(a){vari,w,l=widgets.length;for(i=0;i<l;i++){w=widgets[i];if(w&&w.hasOwnProperty('id')&&w.id.toLowerCase()===a.toLowerCase()){returnw}}}functionapplyWidget(a){varc=a.config.widgets,i,w,l=c.length;for(i=0;i<l;i++){w=getWidgetById(c[i]);if(w&&w.hasOwnProperty('format')){w.format(a)}}}functionappendToTable(a,b){varc=a.config,r=b.row,n=b.normalized,totalRows=n.length,checkCell=totalRows?(n[0].length-1):0,rows=[],i,j,l,pos,appendTime;if(c.debug){appendTime=newDate()}for(i=0;i<totalRows;i++){pos=n[i][checkCell];rows.push(r[pos]);if(!c.appender||!c.removeRows){l=r[pos].length;for(j=0;j<l;j++){a.tBodies[0].appendChild(r[pos][j])}}}if(c.appender){c.appender(a,rows)}rows=null;if(c.debug){benchmark("Rebuilt table:",appendTime)}applyWidget(a);setTimeout(function(){$(a).trigger("sortEnd",a)},0)}functi