text: /* jQuery UI TinyTbl, (c) 2012 Michael Keck <http://www.michaelkeck.de/>, 2012-09-16 - 2.1.1, http://jquery.org/license */
  (function(e){e.widget("ui.tinytbl",{options:{cols:0,direction:"ltr",tbodycss:"ui-widget-content",tfoot:!0,tfootcss:"ui-widget-header",thead:!0,theadcss:"ui-widget-header",height:"auto",width:"auto",focus:!1,renderer:!1},_init:function(){var t="undefined",n=this,r=function(e){return typeof e!==t&&!isNaN(parseInt(e,10))?parseInt(e,10):!1};if(typeof n.csn===t||!n.csn){var i="ui-tinytbl",s="-first",o="-last",u="row",a="col";n.csn={tbl:i,tb:i+"-tb",tf:i+"-tf",th:i+"-th",colb:i+s+a,cole:i+o+a,rowb:i+s+u,rowe:i+o+u}}if(!r(n.sbw)){var f=e('<div style="position:absolute;top:-10000px;left:-10000px;width:100px;height:100px;overflow:scroll;"></div>').appendTo("body"),l=f.width()-f[0].clientWidth,c=f.height()-f[0].clientHeight;f.remove(),n.sbw=l,n.sbh=c+5}},_ra:function(t,n){var r=this,i=r.element.data(),s=i.opt,o=0,u="tbody",a="td,th",f=n.clone(),l=e(u,i.tb3),c=n.clone(),h=e(u,i.tb4);e(a,c).each(function(t){t<s.cols&&e(this).remove()}),e(a,f).each(function(t){t>s.cols-1&&e(this).remove()}),t!=="prepend"?(l.append(f),h.append(c),o=1):(l.prepend(f),h.prepend(c)),r._rs(u),r._sr(u),i.tb2.scrollTop(o>0?i.size.hr:0)},_rd:function(t){var n=this,r=n.element.data(),i="tbody";e(t,e(i,r.tb3)).remove(),e(t,e(i,r.tb4)).remove(),n._rs(i)},_rs:function(t){var n=this,r=n.csn,i=n.element.data(),s=i.opt,o,u,a=function(t){var n=e("tr",t),i=e("tfoot",t).size()>0&&!s.tf,o=e("thead",t).size()>0&&!s.th;if(n.length<1)return;n.each(function(){e(this).removeClass(r.rowb).removeClass(r.rowe)}),!o&&!i?(n.first().addClass(r.rowb),n.last().addClass(r.rowe)):(o||e("tbody tr",t).first().addClass(r.rowb),i?e("thead tr",t).last().addClass(r.rowe):e("tbody tr",t).last().addClass(r.rowe)),n.each(function(){var t=e("td,th",this);e(t).removeClass(r.colb).removeClass(r.cole),e(t[0]).addClass(r.colb),e(t[t.length-1]).addClass(r.cole)})};t||(t="tbody"),t=(""+t).toLowerCase();switch(t){case"tfoot":case"foot":o=i.tf3,u=i.tf4;break;case"thead":case"head":o=i.th3,u=i.th4;break;default:o=i.tb3,u=i.tb4}a(o),a(u)},_sc:function(t){var n=this,r=n.element.data(),i=r.opt,s,o;t||(t="tbody"),t=(""+t).toLowerCase();switch(t){case"tfoot":case"foot":s=r.tf3,o=r.tf4;break;case"thead":case"head":s=r.th3,o=r.th4;break;default:s=r.tb3,o=r.tb4}e("tr",o).each(function(){var t=e("td,th",this);t.each(function(t){t<i.cols&&e(this).remove()})}),e("tr",s).each(function(){var t=e("td,th",this);t.each(function(t){t>i.cols-1&&e(this).remove()})}),n._rs(t)},_sr:function(t){var n=this.element,r=n.data(),i=r.opt,s,o,u="td,th",a="tr";if(!i.cols)return;t||(t="tbody"),t=(""+t).toLowerCase();switch(t){case"tfoot":case"foot":s=r.tf3,o=r.tf4;break;case"thead":case"head":s=r.th3,o=r.th4;break;default:s=r.tb3,o=r.tb4}var f={l:[],r:[]};e(a,o).each(function(t){f.l[t]=e(this).first(u).height()}),e(a,s).each(function(t){f.r[t]=e(this).first(u).height()}),e(a,o).each(function(t){var n=f.r[t];f.l[t]>f.r[t]&&(n=f.l[t]),e(u,this).first().css({height:n+"px"})}),e(a,s).each(function(t){var n=f.l[t];f.r[t]>f.l[t]&&(n=f.r[t]),e(u,this).first().css({height:n+"px"})}),n.data({size:e.extend(r.size,{hl:s.height(),hr:o.height()})})},_tc:function(t){t||(t="tbody"),t=(""+t).toLowerCase();var n=0,r=this,i=r.element.data(),s=i.opt,o,u,a,f="table",l="colgroup",c=function(t){var n="table";e(n,t).attr("cellpadding",i.padding),e(n,t).attr("cellspacing",i.spacing),e(n,t).attr("border","0")};switch(t){case"tfoot":case"foot":s.tf&&(t="tfoot",n=s.tf,o="<"+f+"><"+t+(n.id?' role="'+n.id+'"':"")+(n.csn?' class="'+n.csn+'"':"")+">"+e(t,i.cln).html()+"</"+t+"></"+f+">",u=i.tf3,a=i.tf4);break;case"thead":case"head":s.th&&(t="thead",n=s.th,o="<"+f+"><"+t+(n.id?' role="'+n.id+'"':"")+(n.csn?' class="'+n.csn+'"':"")+">"+e(t,i.cln).html()+"</"+t+"></"+f+">",u=i.th3,a=i.th4);break;default:t="tbody",u=i.tb3,a=i.tb4}t!=="tbody"?n&&(a.append(o),s.cols&&(u.append(o),e(l,u).remove(),e(f,u).prepend(i.size.cl).css({width:i.size.wl+"px"}),c(u),u.css({width:i.size.wl+"px"})),r._sc(t),e(l,a).remove(),e(f,a).prepend(i.size.cr).css({width:i.size.wr+"px"}),c(a),a.css({width:i.size.wr+"px"}),this._sr(t)):(s.cols&&(u.append(a.html()),e(l,u).remove(),e(f,u).prepend(i.size.cl).css({width:i.size.wl+"px"}),e(t,u).attr("id")&&e(t,u).attr("role",e(t,u).attr("id")||"").removeAttr("id"),c(u),u.css({width:i.size.wl+"px"})),r._sc(t),e(l,a).remove(),e(f,a).prepend(i.size.cr).css({width:i.size.wr+"px"}),e(t,a).attr("id")&&e(t,a).attr("role",e(t,a).attr("id")||"").removeAttr("id"),c(a),a.css({width:i.size.wr+"px"}),r._sr(t))},_td:function(){var e=this,t=e.element.data(),n=t.opt,r;r={hl:0,hr:n.height-t.th2.height()-t.tf2.height(),ws:n.width-t.tb1.width()-1,wf:0},r.hr<100&&(r.hr=100),r.hl=r.hr,r.ws<100&&(r.ws=100),r.wf=r.ws,t.tb2.width()>r.ws&&(r.hl=r.hl-e.sbw),t.tb2.height()>r.hr&&(r.wf=r.wf-e.sbw),t.tbl.css({width:n.width+"px",height:n.height+"px"}),t.th2.css({width:r.wf+"px"}),t.tf2.css({width:r.wf+"px"}),t.tb1.css({height:r.hl+"px"}),t.tb2.css({width:r.ws+"px",height:r.hr+"px"})},_ti:function(){var t=this,n=t.element.data(),r=n.opt,i,s="table";n.tb4.append("<"+s+">"+n.cln.html()+"</"+s+">"),r.tf&&(i="tfoot",e(i,n.tb4).remove(),t._tc(i)),r.th&&(i="thead",e(i,n.tb4).remove(),t._tc(i)),t._tc("tbody"),e(s,n.tbl).each(function(){e(this).css({"border-collapse":"collapse","table-layout":"fixed"})})},_ts:function(){var e=this,t=e.element.data();if(!t.tb2)return;var n=t.tb2.scrollLeft(),r=t.tb2.scrollTop();t.tb1&&t.tb1.scrollTop(r),t.th2&&t.th2.scrollLeft(n),t.tf2&&t.tf2.scrollLeft(n)},_create:function(){var t=document,n=window,r,i,s,o,u,a,f,l,c,h={},p=this,d,v,m={},g=function(e){return e=(""+e).replace(/[^0-9\.]/gi,""),isNaN(parseFloat(e))?0:parseFloat(e)},y=function(e){return e.parent().get(0).tagName!=="body"&&e.parent().get(0).tagName!=="html"},b=function(e){return e==="auto"||(""+e).lastIndexOf("%")!==-1};a=p.element,l=p.options,l.direction=(""+l.direction).substring(0,1).toLowerCase(),l.direction=="r"?l.rtl=!0:(l.direction="",l.rtl=!1),(""+l.width).lastIndexOf("%")!==-1&&g(l.width)>=100&&(l.width="auto"),(""+l.height).lastIndexOf("%")!==-1&&g(l.height)>=100&&(l.height="auto");var w=e("body"),E=n.innerHeight||self.innerHeight||t.documentElement&&t.documentElement.clientWidth||t.body.clientWidth,S=n.innerWidth||self.innerWidth||t.documentElement&&t.documentElement.clientWidth||t.body.clientWidth;m={size:{cl:"",cr:"",wl:0,wr:0,hl:0,hr:0}};if((""+a.get(0).tagName).toLowerCase()!=="table")return;v=e("tr",a);if(v.length<1)return;d=e("th,td",v[0]);if(d.length<1)return;l.renderer?a.parent().get(0).tagName!=="body"&&a.parent().get(0).tagName!=="html"&&(a.parent().is(":visible")||(c=a.parent(),c.hasClass("ui-tabs-hide")&&c.removeClass("ui-tabs-hide").addClass("temp-ui-tinytbl-ui-tabs-hide"),c.css("display")=="none"?c.css({display:"block"}).addClass("temp-ui-tinytbl-display-none"):c.css("display")!=="block"&&c.css("display")!=="static"&&c.css({display:"block"}).addClass("temp-ui-tinytbl-display-block"))):a.parent().get(0).tagName!=="body"&&a.parent().get(0).tagName!=="html"&&(a.parent().is(":visible")||typeof console!="undefined"&&typeof console.log!="undefined"&&console.log("Info:","Please make shure that the parent element of your table is visible before create it.")),e("tbody",a).size()>0?(l.tfoot&&(r="tfoot",e(r,a).size()<1?l.tf=!1:l.tfoot&&(l.tf={id:e(r,a).attr("id")||0,csn:e(r,a).attr("class")||0})),l.thead&&(r="thead",e(r,a).size()<1?l.th=!1:l.thead&&(l.th={id:e(r,a).attr("id")||0,csn:e(r,a).attr("class")||0}))):(l.tf=!1,l.th=!1),s=0,l.cols&&(s=g(l.cols)),s>0&&s<d.length?l.fixed=s-1:(l.fixed=-1,l.cols=!1);if(!l.th&&!l.tf&&!l.cols)return;h={c:'<col style="width:{w}px" width="{w}" />',g:"colgroup",l:"",r:""},l.cols?d.each(function(t){o=e(this).outerWidth(),t>l.fixed?(m.size.wr+=o,h.r+=h.c.replace(/{w}/g,o)):(m.size.wl+=o,h.l+=h.c.replace(/{w}/g,o))}):d.each(function(){o=e(this).outerWidth(),m.size.wr+=o,h.r+=h.c.replace(/{w}/g,o)}),m.size.cl=h.l!==""?"<"+h.g+">"+h.l+"</"+h.g+">":"",m.size.cr=h.r!==""?"<"+h.g+">"+h.r+"</"+h.g+">":"",m.padding=a.attr("cellpadding")||"0",m.spacing=a.attr("cellspacing")||"0",r={a:"auto",m:"margin",p:"padding",b:"border",w:"Width",t:"Top",f:"Bottom",l:"Left",r:"Rigth"},p._init(),s=0,h="visible",b(l.height)?(s=E,y(a)&&(w=a.parent(),s=w.height(),l.height==r.a&&w.css("overflow")!=h&&w.css("overflowY")!=h&&(s-=p.sbh)),l.height!==r.a&&(s=Math.floor(s*.01*g(l.height))),s-=g(w.css(r.m+r.t))+g(w.css(r.m+r.f))+g(w.css(r.p+r.t))+g(w.css(r.p+r.f))+g(w.css(r.b+r.t+r.w))+g(w.css(r.b+r.f+r.w))):s=g(l.height),l.height=s,s=0,b(l.width)?(s=S,y(a)&&(w=a.parent(),s=w.width()),l.width!==r.a&&(s=Math.floor(s*.01*g(l.width))),s-=g(w.css(r.m+r.l))+g(w.css(r.m+r.r))+g(w.css(r.p+r.l))+g(w.css(r.p+r.r))+g(w.css(r.b+r.l+r.w))+g(w.css(r.b+r.r+r.w))):s=g(l.width),l.width=s,l.height<100&&(l.height=100),l.width<200&&(l.width=200),i=p.csn,f=a.clone();var x='<div class="',T='">',N="</div>";u=e(x+i.tbl+(l.rtl?"-rtl":"")+(a.attr("class")?" "+a.attr("class"):"")+(a.attr("id")?'" role="'+a.attr("id"):"")+T+N),a.empty().css({display:"none"}),a.after(u),h={tb:l.tbodycss?" "+l.tbodycss:"",tf:l.tfootcss?" "+l.tfootcss:"",th:l.theadcss?" "+l.theadcss:"",tc:x+i.tbl+"-content"+T+N,fl:' style="float:'+(l.rtl?"right":"left"),cb:'<div style="clear:both">'+N},h.div="",l.th&&(h.div+=x+i.th+T+x+i.th+"-left"+h.th+'"'+h.fl+T+h.tc+N+x+i.th+"-right"+h.th+'"'+h.fl+T+h.tc+N+h.cb+N),h.div+=x+i.tb+T+x+i.tb+"-left"+h.tb+'"'+h.fl+T+h.tc+N+x+i.tb+"-right"+h.tb+'"'+h.fl+T+h.tc+N+h.cb+N,l.tf&&(h.div+=x+i.tf+T+x+i.tf+"-left"+h.tf+'"'+h.fl+T+h.tc+N+x+i.tf+"-right"+h.tf+'"'+h.fl+T+h.tc+N+h.cb+N),u.append(h.div),h={l:"-left",r:"-right",c:" ."+i.tbl+"-content",h:"."+i.th,f:"."+i.tf,b:"."+i.tb},m=e.extend(m,{tbl:u,th0:e(h.h,u),th1:e(h.h+h.l,u),th3:e(h.h+h.l+h.c,u),th2:e(h.h+h.r,u),th4:e(h.h+h.r+h.c,u),tb0:e(h.b,u),tb1:e(h.b+h.l,u),tb3:e(h.b+h.l+h.c,u),tb2:e(h.b+h.r,u),tb4:e(h.b+h.r+h.c,u),tf0:e(h.f,u),tf1:e(h.f+h.l,u),tf3:e(h.f+h.l+h.c,u),tf2:e(h.f+h.r,u),tf4:e(h.f+h.r+h.c,u),cln:f,opt:l}),a.data(m),p._ti(),h="hidden",h={x:{"overflow-x":h},a:{overflow:h}},m.th2.css(h.x),m.tf2.css(h.x),m.tb1.css(h.a),m.tb2.css({overflow:"auto"}).scroll(function(e){p._ts(e)}),p._td(),l.renderer&&a.parent().get(0).tagName!=="body"&&a.parent().get(0).tagName!=="html"&&(c=a.parent(),c.hasClass("temp-ui-tinytbl-ui-tabs-hide")?c.removeClass("temp-ui-tinytbl-ui-tabs-hide").addClass("ui-tabs-hide"):c.hasClass("temp-ui-tinytbl-display-none")?c.css({display:"none"}).removeClass("temp-ui-tinytbl-display-none"):c.hasClass("temp-ui-tinytbl-display-block")&&c.css({display:""}).removeClass("temp-ui-tinytbl-display-block")),l.focus&&m.tb2.focus()},append:function(e){this._ra("append",e)},prepend:function(e){this._ra("prepend",e)},remove:function(e){this._rd(e)},destroy:function(){var e=this.element,t=e.data("tbl"),n=e.data("cln").html();e.html(n),e.css({display:"block"}),t.remove(),e.removeData()},focus:function(){var e=this.element.data();e.tb2.focus()}}),e.extend(e.ui.tinytbl,{version:"2.1.1"})})(jQuery);