(function(d){function h(b,a,c){b.width(a.width());if(!c.forceClass&&a.children("thead").length>0){a=a.children("thead").eq(0).children();c=jQuery("<thead/>");b.append(c);b=c}else a=a.find("."+c.markerClass);a.each(function(){var e=d(this),f=e.clone();f.children().remove();e.children().each(function(){var g=d(this),i=g.clone();i.width(g.width());f.append(i)});b.append(f)})}function j(b,a,c){b.width(a.width());var e;if(!c.forceClass&&a.children("thead").length>0){a=a.children("thead").eq(0).children().eq(0);
e=b.children("thead").eq(0).children().eq(0)}else{a=a.find("."+c.markerClass).eq(0);e=b.children().eq(0)}e=e.children().eq(0);a.children().each(function(f,g){e.width(d(g).width());e=e.next()})}function k(b,a){var c=d(b),e=d(window).scrollTop(),f=c.offset().top,g=c.height()-a.height();c=c.children("tfoot");if(c.length>0)g-=c.height();return f<=e&&e<=f+g}d.fn.floatHeader=function(b){b=d.extend({fadeOut:200,fadeIn:200,forceClass:false,markerClass:"floating",floatClass:"floatHeader",recalculate:false,
IE6Fix_DetectScrollOnBody:true},b);return this.each(function(){var a=d(this),c=a.clone();c.children().remove();a.floatBox=d('<div class="'+b.floatClass+'"style="display:none"></div>');a.floatBox.append(c);a.IEWindowWidth=document.documentElement.clientWidth;a.IEWindowHeight=document.documentElement.clientHeight;h(c,a,b);if(d.browser.msie){if(d.browser.version>7)b.IE6Fix_DetectScrollOnBody=false}else b.IE6Fix_DetectScrollOnBody=false;(b.IE6Fix_DetectScrollOnBody?d("body"):d(window)).scroll(function(){if(a.floatBoxVisible){if(!k(a,
a.floatBox)){var e=a.offset();a.floatBox.css("position","absolute");a.floatBox.css("top",e.top);a.floatBox.css("left",e.left);a.floatBoxVisible=false;if(b.cbFadeOut)b.cbFadeOut(a.floatBox);else{a.floatBox.stop(true,true);a.floatBox.fadeOut(b.fadeOut)}}}else if(k(a,a.floatBox)){a.floatBoxVisible=true;d.browser.msie&&d.browser.version<7?a.floatBox.css("position","absolute"):a.floatBox.css("position","fixed");if(b.cbFadeIn)b.cbFadeIn(a.floatBox);else{a.floatBox.stop(true,true);a.floatBox.fadeIn(b.fadeIn)}}if(a.floatBoxVisible){d.browser.msie&&
d.browser.version<=7?a.floatBox.css("top",d(window).scrollTop()):a.floatBox.css("top",0);a.floatBox.css("left",a.offset().left-d(window).scrollLeft());b.recalculate&&j(c,a,b)}});d.browser.msie&&d.browser.version<=7?d(window).resize(function(){if(a.IEWindowWidth!=document.documentElement.clientWidth||a.IEWindowHeight!=document.documentElement.clientHeight){a.IEWindowWidth=document.documentElement.clientWidth;a.IEWindowHeight=document.documentElement.clientHeight;c.children().remove();h(c,a,b)}}):d(window).resize(function(){c.children().remove();
h(c,a,b)});d(a).after(a.floatBox);this.fhRecalculate=function(){j(c,a,b)};this.fhInit=function(){c.children().remove();h(c,a,b)}})}})(jQuery);

