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