/** Scrollable HTML table adapted from http://www.webtoolkit.info/ **/
function ScrollableTable(table,tableHeight,tableWidth){init=function(){$(containerEl).css("overflow","hidden");$(tableEl).css("width",newWidth+"px");var headHeight=$(thead)?$(thead).height():0,footHeight=$(tfoot)?$(tfoot).height():0,bodyHeight=$(tbody).height(),x;if(jQuery.browser.msie)$(containerEl)[0].style.overflowY="auto";if(bodyHeight>=newHeight-(headHeight+footHeight))if(jQuery.browser.msie)$(tableEl).css("width",newWidth-scrollWidth+"px");else if(jQuery.browser.safari)$(tbody).css("overflow","auto");else $(tbody).css("overflow-y","auto");else if(jQuery.browser.safari)$(tbody).css("overflow","hidden");else $(tbody).css("overflow-y","hidden");if(jQuery.browser.msie){if(thead){var thrs=$("tr",thead);for(x=0;x$(containerEl).width())$(tbody).css("overflow-x","auto");else $(tbody).css("overflow-x","hidden");var offH=$(tableEl)[0].offsetHeight;var newBodyHeight=newHeight-headHeight-footHeight;$(tbody).css("height",newBodyHeight+"px")}};var tableEl=table,scrollWidth=17,originalHeight=$(tableEl).height(),originalWidth=$(tableEl).width(),newHeight=parseInt(tableHeight),newWidth=tableWidth?parseInt(tableWidth):originalWidth;$(tableEl).css("overflow","auto");$(tableEl).wrap("");var containerEl=$(tableEl).parent();$(containerEl).css("height",newHeight+"px");$(containerEl).css("width",newWidth+"px");var thead=$("thead",tableEl),tfoot=$("tfoot",tableEl),tbody=$("tbody",tableEl);if(!tbody)return;init()}jQuery.fn.Scrollable=function(a,b){this.each(function(){var c=new ScrollableTable(this,a,b)})}