var FixedColumns;(function(n,t){FixedColumns=function(t,i){if(!this instanceof FixedColumns){alert("FixedColumns warning: FixedColumns must be initialised with the 'new' keyword.");return}typeof i=="undefined"&&(i={}),this.s={dt:t.fnSettings(),iTableColumns:t.fnSettings().aoColumns.length,aiWidths:[],bOldIE:n.browser.msie&&(n.browser.version=="6.0"||n.browser.version=="7.0")},this.dom={scroller:null,header:null,body:null,footer:null,grid:{wrapper:null,dt:null,left:{wrapper:null,head:null,body:null,foot:null},right:{wrapper:null,head:null,body:null,foot:null}},clone:{left:{header:null,body:null,footer:null},right:{header:null,body:null,footer:null}}},this.s.dt.oFixedColumns=this,this._fnConstruct(i)},FixedColumns.prototype={fnUpdate:function(){this._fnDraw(!0)},fnRedrawLayout:function(){this._fnGridLayout()},fnRecalculateHeight:function(n){n._DTTC_iHeight=null,n.style.height="auto"},fnSetRowHeight:function(t,i){var r=n(t).children(":first"),u=r.outerHeight()-r.height();n.browser.mozilla||n.browser.opera?t.style.height=i+"px":n(t).children().height(i-u)},_fnConstruct:function(i){var u,c,f,r=this,s;if(typeof this.s.dt.oInstance.fnVersionCheck!="function"||this.s.dt.oInstance.fnVersionCheck("1.8.0")!==!0){alert("FixedColumns "+FixedColumns.VERSION+" required DataTables 1.8.0 or later. Please upgrade your DataTables installation");return}if(this.s.dt.oScroll.sX===""){this.s.dt.oInstance.oApi._fnLog(this.s.dt,1,"FixedColumns is not needed (no x-scrolling in DataTables enabled), so no action will be taken. Use 'FixedHeader' for column fixing when scrolling is not enabled");return}this.s=n.extend(!0,this.s,FixedColumns.defaults,i),this.dom.grid.dt=n(this.s.dt.nTable).parents("div.dataTables_scroll")[0],this.dom.scroller=n("div.dataTables_scrollBody",this.dom.grid.dt)[0];var h=n(this.dom.grid.dt).width(),e=0,o=0;for(n("tbody>tr:eq(0)>td",this.s.dt.nTable).each(function(t){f=n(this).outerWidth(),r.s.aiWidths.push(f),t<r.s.iLeftColumns&&(e+=f),r.s.iTableColumns-r.s.iRightColumns<=t&&(o+=f)}),this.s.iLeftWidth===null&&(this.s.iLeftWidth=this.s.sLeftWidth=="fixed"?e:e/h*100),this.s.iRightWidth===null&&(this.s.iRightWidth=this.s.sRightWidth=="fixed"?o:o/h*100),this._fnGridSetup(),u=0;u<this.s.iLeftColumns;u++)this.s.dt.oInstance.fnSetColumnVis(u,!1);for(u=this.s.iTableColumns-this.s.iRightColumns;u<this.s.iTableColumns;u++)this.s.dt.oInstance.fnSetColumnVis(u,!1);n(this.dom.scroller).scroll(function(){r.dom.grid.left.body.scrollTop=r.dom.scroller.scrollTop,r.s.iRightColumns>0&&(r.dom.grid.right.body.scrollTop=r.dom.scroller.scrollTop)}),n(t).resize(function(){r._fnGridLayout.call(r)}),s=!0,this.s.dt.aoDrawCallback=[{fn:function(){r._fnDraw.call(r,s),r._fnGridHeight(r),s=!1},sName:"FixedColumns"}].concat(this.s.dt.aoDrawCallback),this._fnGridLayout(),this._fnGridHeight(),this.s.dt.oInstance.fnDraw(!1)},_fnGridSetup:function(){var i=this,t;this.dom.body=this.s.dt.nTable,this.dom.header=this.s.dt.nTHead.parentNode,this.dom.header.parentNode.parentNode.style.position="relative",t=n('<div class="DTFC_ScrollWrapper" style="position:relative; clear:both;"><div class="DTFC_LeftWrapper" style="position:absolute; top:0; left:0;"><div class="DTFC_LeftHeadWrapper" style="position:relative; top:0; left:0; overflow:hidden;"><\/div><div class="DTFC_LeftBodyWrapper" style="position:relative; top:0; left:0; overflow:hidden;"><\/div><div class="DTFC_LeftFootWrapper" style="position:relative; top:0; left:0; overflow:hidden;"><\/div><\/div><div class="DTFC_RightWrapper" style="position:absolute; top:0; left:0;"><div class="DTFC_RightHeadWrapper" style="position:relative; top:0; left:0; overflow:hidden;"><\/div><div class="DTFC_RightBodyWrapper" style="position:relative; top:0; left:0; overflow:hidden;"><\/div><div class="DTFC_RightFootWrapper" style="position:relative; top:0; left:0; overflow:hidden;"><\/div><\/div><\/div>')[0],nLeft=t.childNodes[0],nRight=t.childNodes[1],this.dom.grid.wrapper=t,this.dom.grid.left.wrapper=nLeft,this.dom.grid.left.head=nLeft.childNodes[0],this.dom.grid.left.body=nLeft.childNodes[1],this.s.iRightColumns>0&&(this.dom.grid.right.wrapper=nRight,this.dom.grid.right.head=nRight.childNodes[0],this.dom.grid.right.body=nRight.childNodes[1]),this.s.dt.nTFoot&&(this.dom.footer=this.s.dt.nTFoot.parentNode,this.dom.grid.left.foot=nLeft.childNodes[2],this.s.iRightColumns>0&&(this.dom.grid.right.foot=nRight.childNodes[2])),t.appendChild(nLeft),this.dom.grid.dt.parentNode.insertBefore(t,this.dom.grid.dt),t.appendChild(this.dom.grid.dt),this.dom.grid.dt.style.position="absolute",this.dom.grid.dt.style.top="0px",this.dom.grid.dt.style.left=this.s.iLeftWidth+"px",this.dom.grid.dt.style.width=n(this.dom.grid.dt).width()-this.s.iLeftWidth-this.s.iRightWidth+"px"},_fnGridLayout:function(){var t=this.dom.grid,u=n(t.wrapper).width(),i=0,r=0,f=0;i=this.s.sLeftWidth=="fixed"?this.s.iLeftWidth:this.s.iLeftWidth/100*u,r=this.s.sRightWidth=="fixed"?this.s.iRightWidth:this.s.iRightWidth/100*u,f=u-i-r,t.left.wrapper.style.width=i+"px",t.dt.style.width=f+"px",t.dt.style.left=i+"px",this.s.iRightColumns>0&&(t.right.wrapper.style.width=r+"px",t.right.wrapper.style.left=u-r+"px")},_fnGridHeight:function(){var t=this.dom.grid,i=n(this.dom.grid.dt).height();t.wrapper.style.height=i+"px",t.left.body.style.height=n(this.dom.scroller).height()+"px",t.left.wrapper.style.height=i+"px",this.s.iRightColumns>0&&(t.right.wrapper.style.height=i+"px",t.right.body.style.height=n(this.dom.scroller).height()+"px")},_fnDraw:function(t){this._fnCloneLeft(t),this._fnCloneRight(t),this.s.fnDrawCallback!==null&&this.s.fnDrawCallback.call(this,this.dom.clone.left,this.dom.clone.right),n(this).trigger("draw",{leftClone:this.dom.clone.left,rightClone:this.dom.clone.right})},_fnCloneRight:function(n){if(!(this.s.iRightColumns<=0)){for(var r=this,u,i=[],t=this.s.iTableColumns-this.s.iRightColumns;t<this.s.iTableColumns;t++)i.push(t);this._fnClone(this.dom.clone.right,this.dom.grid.right,i,n)}},_fnCloneLeft:function(n){if(!(this.s.iLeftColumns<=0)){for(var r=this,u,i=[],t=0;t<this.s.iLeftColumns;t++)i.push(t);this._fnClone(this.dom.clone.left,this.dom.grid.left,i,n)}},_fnCopyLayout:function(t,i){for(var s=[],h=[],c=[],f,u,a,e,o,r=0,l=t.length;r<l;r++){for(f=[],f.nTr=n(t[r].nTr).clone(!0)[0],u=0,a=this.s.iTableColumns;u<a;u++)n.inArray(u,i)!==-1&&(e=n.inArray(t[r][u].cell,c),e===-1?(o=n(t[r][u].cell).clone(!0)[0],h.push(o),c.push(t[r][u].cell),f.push({cell:o,unique:t[r][u].unique})):f.push({cell:h[e],unique:t[r][u].unique}));s.push(f)}return s},_fnClone:function(t,i,r,u){var o=this,f,l,s,v,nt,tt,h,c,a,b,y,p,g,k,e,d,w;if(u){for(t.header!==null&&t.header.parentNode.removeChild(t.header),t.header=n(this.dom.header).clone(!0)[0],t.header.className+=" DTFC_Cloned",t.header.style.width="100%",i.head.appendChild(t.header),e=this._fnCopyLayout(this.s.dt.aoHeader,r),b=n(">thead",t.header),b.empty(),f=0,l=e.length;f<l;f++)b[0].appendChild(e[f].nTr);this.s.dt.oApi._fnDrawHead(this.s.dt,e,!0)}else for(e=this._fnCopyLayout(this.s.dt.aoHeader,r),y=[],this.s.dt.oApi._fnDetectHeader(y,n(">thead",t.header)[0]),f=0,l=e.length;f<l;f++)for(s=0,v=e[f].length;s<v;s++)y[f][s].cell.className=e[f][s].cell.className,n("span.DataTables_sort_icon",y[f][s].cell).each(function(){this.className=n("span.DataTables_sort_icon",e[f][s].cell)[0].className});if(this._fnEqualiseHeights("thead",this.dom.header,t.header),this.s.sHeightMatch=="auto"&&n(">tbody>tr",o.dom.body).css("height","auto"),t.body!==null&&(t.body.parentNode.removeChild(t.body),t.body=null),t.body=n(this.dom.body).clone(!0)[0],t.body.className+=" DTFC_Cloned",t.body.style.paddingBottom=this.s.dt.oScroll.iBarWidth+"px",t.body.style.marginBottom=this.s.dt.oScroll.iBarWidth*2+"px",t.body.getAttribute("id")!==null&&t.body.removeAttribute("id"),n(">thead>tr",t.body).empty(),n(">tfoot",t.body).remove(),p=n("tbody",t.body)[0],n(p).empty(),this.s.dt.aiDisplay.length>0){for(g=n(">thead>tr",t.body)[0],a=0;a<r.length;a++)h=r[a],c=this.s.dt.aoColumns[h].nTh,c.innerHTML="",oStyle=c.style,oStyle.paddingTop="0",oStyle.paddingBottom="0",oStyle.borderTopWidth="0",oStyle.borderBottomWidth="0",oStyle.height=0,oStyle.width=o.s.aiWidths[h]+"px",g.appendChild(c);n(">tbody>tr",o.dom.body).each(function(t){var i=this.cloneNode(!1),u=o.s.dt.oFeatures.bServerSide===!1?o.s.dt.aiDisplay[o.s.dt._iDisplayStart+t]:t;for(a=0;a<r.length;a++)h=r[a],typeof o.s.dt.aoData[u]._anHidden[h]!="undefined"&&(c=n(o.s.dt.aoData[u]._anHidden[h]).clone(!0)[0],i.appendChild(c));p.appendChild(i)})}else n(">tbody>tr",o.dom.body).each(function(){c=this.cloneNode(!0),c.className+=" DTFC_NoData",n("td",c).html(""),p.appendChild(c)});if(t.body.style.width="100%",i.body.appendChild(t.body),this._fnEqualiseHeights("tbody",o.dom.body,t.body),this.s.dt.nTFoot!==null){if(u){for(t.footer!==null&&t.footer.parentNode.removeChild(t.footer),t.footer=n(this.dom.footer).clone(!0)[0],t.footer.className+=" DTFC_Cloned",t.footer.style.width="100%",i.foot.appendChild(t.footer),e=this._fnCopyLayout(this.s.dt.aoFooter,r),k=n(">tfoot",t.footer),k.empty(),f=0,l=e.length;f<l;f++)k[0].appendChild(e[f].nTr);this.s.dt.oApi._fnDrawHead(this.s.dt,e,!0)}else for(e=this._fnCopyLayout(this.s.dt.aoFooter,r),d=[],this.s.dt.oApi._fnDetectHeader(d,n(">tfoot",t.footer)[0]),f=0,l=e.length;f<l;f++)for(s=0,v=e[f].length;s<v;s++)d[f][s].cell.className=e[f][s].cell.className;this._fnEqualiseHeights("tfoot",this.dom.footer,t.footer)}w=this.s.dt.oApi._fnGetUniqueThs(this.s.dt,n(">thead",t.header)[0]),n(w).each(function(n){h=r[n],this.style.width=o.s.aiWidths[h]+"px"}),o.s.dt.nTFoot!==null&&(w=this.s.dt.oApi._fnGetUniqueThs(this.s.dt,n(">tfoot",t.footer)[0]),n(w).each(function(n){h=r[n],this.style.width=o.s.aiWidths[h]+"px"}))},_fnGetTrNodes:function(n){for(var i=[],t=0,r=n.childNodes.length;t<r;t++)n.childNodes[t].nodeName.toUpperCase()=="TR"&&i.push(n.childNodes[t]);return i},_fnEqualiseHeights:function(t,i,r){if(this.s.sHeightMatch!="none"||t==="thead"||t==="tfoot")for(var p=this,e,w,s,h,v=i.getElementsByTagName(t)[0],y=r.getElementsByTagName(t)[0],l=n(">"+t+">tr:eq(0)",i).children(":first"),c=l.outerHeight()-l.height(),f=this._fnGetTrNodes(v),o=this._fnGetTrNodes(y),u=0,a=o.length;u<a;u++){if(this.s.sHeightMatch=="semiauto"&&typeof f[u]._DTTC_iHeight!="undefined"&&f[u]._DTTC_iHeight!==null){n.browser.msie&&n(o[u]).children().height(f[u]._DTTC_iHeight-c);continue}s=f[u].offsetHeight,h=o[u].offsetHeight,e=h>s?h:s,this.s.sHeightMatch=="semiauto"&&(f[u]._DTTC_iHeight=e),n.browser.msie&&n.browser.version<8?(n(o[u]).children().height(e-c),n(f[u]).children().height(e-c)):(o[u].style.height=e+"px",f[u].style.height=e+"px")}}},FixedColumns.defaults={iLeftColumns:1,iRightColumns:0,fnDrawCallback:null,sLeftWidth:"fixed",iLeftWidth:null,sRightWidth:"fixed",iRightWidth:null,sHeightMatch:"semiauto"},FixedColumns.prototype.CLASS="FixedColumns",FixedColumns.VERSION="2.0.3"})(jQuery,window,document)