function MakeScrollable(a, b) { var c = a.offsetWidth; var d = a.offsetHeight; var e = new Array; for (var f = 0; f < a.getElementsByTagName("TH").length; f++) { e[f] = a.getElementsByTagName("TH")[f].offsetWidth } a.parentNode.appendChild(document.createElement("div")); var g = a.parentNode; var h = document.createElement("table"); for (f = 0; f < a.attributes.length; f++) { if (a.attributes[f].specified && a.attributes[f].name != "id") { h.setAttribute(a.attributes[f].name, a.attributes[f].value) } } h.style.cssText = a.style.cssText; h.style.width = c + "px"; h.appendChild(document.createElement("tbody")); h.getElementsByTagName("tbody")[0].appendChild(a.getElementsByTagName("TR")[0]); var i = h.getElementsByTagName("TH"); var j = a.getElementsByTagName("TR")[0]; for (var f = 0; f < i.length; f++) { var k; if (e[f] > j.getElementsByTagName("TD")[f].offsetWidth) { k = e[f] } else { k = j.getElementsByTagName("TD")[f].offsetWidth } i[f].style.width = parseInt(k - 3) + "px"; j.getElementsByTagName("TD")[f].style.width = parseInt(k - 3) + "px" } g.removeChild(a); var l = document.createElement("div"); l.appendChild(h); g.appendChild(l); if (b.Width > 0) { c = b.Width } var m = document.createElement("div"); if (parseInt(d) > b.ScrollHeight) { c = parseInt(c) + 17 } m.style.cssText = "overflow:auto;height:" + b.ScrollHeight + "px;width:" + c + "px"; m.appendChild(a); g.appendChild(m) } (function (a) { a.fn.Scrollable = function (b) { var c = { ScrollHeight: 300, Width: 0, IsInUpdatePanel: false }; var b = a.extend(c, b); return this.each(function () { var c = a(this).get(0); var d = c.id; MakeScrollable(c, b); if (b.IsInUpdatePanel) { var e = Sys.WebForms.PageRequestManager.getInstance(); if (e != null) { e.add_endRequest(function (c, e) { MakeScrollable(a("#" + d).get(0), b) }) } } }) } })(jQuery);