var Window = Class.create();
Window.prototype = {initialize:(function (id, parameters) {this.hasEffectLib = String.prototype.parseColor != null;this.minWidth = parameters.minWidth || 100;this.minHeight = parameters.minHeight || 20;this.maxWidth = parameters.maxWidth;this.maxHeight = parameters.maxHeight;this.showEffect = parameters.showEffect || (this.hasEffectLib ? Effect.Appear : Element.show);this.hideEffect = parameters.hideEffect || (this.hasEffectLib ? Effect.Fade : Element.hide);this.showEffectOptions = parameters.showEffectOptions || parameters.effectOptions;this.hideEffectOptions = parameters.hideEffectOptions || parameters.effectOptions;this.draggable = parameters.draggable != null ? parameters.draggable : true;this.userData = parameters.userData;var resizable = parameters.resizable != null ? parameters.resizable : true;var closable = parameters.closable != null ? parameters.closable : true;var minimizable = parameters.minimizable != null ? parameters.minimizable : true;var maximizable = parameters.maximizable != null ? parameters.maximizable : true;var className = parameters.className != null ? parameters.className : "dialog";this.className = className;var parent = parameters.parent || document.getElementsByTagName("body").item(0);this.element = this.createWindow(id, className, parent, resizable, closable, minimizable, maximizable, parameters.title, parameters.url, parameters.onload);this.isIFrame = parameters.url != null;this.eventMouseDown = this.initDrag.bindAsEventListener(this);this.eventMouseUp = this.endDrag.bindAsEventListener(this);this.eventMouseMove = this.updateDrag.bindAsEventListener(this);this.eventKeyPress = this.keyPress.bindAsEventListener(this);this.eventOnLoad = this._getWindowBorderSize.bindAsEventListener(this);this.topbar = $(this.element.id + "_top");this.bottombar = $(this.element.id + "_bottom");Event.observe(this.topbar, "mousedown", this.eventMouseDown);Event.observe(this.bottombar, "mousedown", this.eventMouseDown);Event.observe(window, "load", this.eventOnLoad);if (this.draggable) {this.bottombar.addClassName("bottom_draggable");this.topbar.addClassName("top_draggable");}var offset = [0, 0];if (resizable) {this.sizer = $(this.element.id + "_sizer");Event.observe(this.sizer, "mousedown", this.eventMouseDown);}var width = parseFloat(parameters.width) || 200;var height = parseFloat(parameters.height) || 200;if (parameters.left != null) {this.element.setStyle({left:parseFloat(parameters.left) + offset[0] + "px"});this.useLeft = true;}if (parameters.right != null) {this.element.setStyle({right:parseFloat(parameters.right) + "px"});this.useLeft = false;}if (parameters.top != null) {this.element.setStyle({top:parseFloat(parameters.top) + "px"});this.useTop = true;}if (parameters.bottom != null) {this.element.setStyle({bottom:parseFloat(parameters.bottom) + "px"});this.useTop = false;}this.storedLocation = null;if (parameters.opacity) {this.setOpacity(parameters.opacity);}if (parameters.zIndex) {this.setZIndex(parameters.zIndex);}this.destroyOnClose = false;this._getWindowBorderSize();this.setSize(width, height);Windows.register(this);}), destroy:(function () {Windows.notify("onDestroy", this);Event.stopObserving(this.topbar, "mousedown", this.eventMouseDown);Event.stopObserving(this.bottombar, "mousedown", this.eventMouseDown);Event.stopObserving(window, "load", this.eventOnLoad);if (this.sizer) {Event.stopObserving(this.sizer, "mousedown", this.eventMouseDown);}if (this.iefix) {Element.hide(this.iefix);}Element.remove(this.element);Windows.unregister(this);}), setDelegate:(function (delegate) {this.delegate = delegate;}), getDelegate:(function () {return this.delegate;}), getContent:(function () {return $(this.element.id + "_content");}), setContent:(function (id, autoresize, autoposition) {var d = null;var p = null;if (autoresize) {d = Element.getDimensions(id);}if (autoposition) {p = Position.cumulativeOffset($(id));}var content = this.getContent();content.appendChild($(id));if (autoresize) {this.setSize(d.width, d.height);}if (autoposition) {this.setLocation(p[1] - this.heightN, p[0] - this.widthW);}}), setCookie:(function (name, expires, path, domain, secure) {name = name || this.element.id;this.cookie = [name, expires, path, domain, secure];var value = WindowUtilities.getCookie(name);if (value) {var values = value.split(",");var x = values[0].split(":");var y = values[1].split(":");var w = parseFloat(values[2]), h = parseFloat(values[3]);var mini = values[4];var maxi = values[5];this.setSize(w, h);if (mini == "true") {this.minimize();} else {if (maxi == "true") {this.doMaximize = true;}}this.useLeft = x[0] == "l";this.useTop = y[0] == "t";this.element.setStyle(this.useLeft ? {left:x[1]} : {right:x[1]});this.element.setStyle(this.useTop ? {top:y[1]} : {bottom:y[1]});}}), getId:(function () {return this.element.id;}), setDestroyOnClose:(function () {this.destroyOnClose = true;}), initDrag:(function (event) {this.pointer = [Event.pointerX(event), Event.pointerY(event)];this.doResize = false;var closeButton = $(this.getId() + "_close");if (closeButton && Position.within(closeButton, this.pointer[0], this.pointer[1])) {return;}this.toFront();if (this.sizer && Position.within(this.sizer, this.pointer[0], this.pointer[1])) {this.doResize = true;this.widthOrg = this.width;this.heightOrg = this.height;this.bottomOrg = parseFloat(this.element.getStyle("bottom"));this.rightOrg = parseFloat(this.element.getStyle("right"));Windows.notify("onStartResize", this);} else {if (!this.draggable) {return;}Windows.notify("onStartMove", this);}Event.observe(document, "mouseup", this.eventMouseUp);Event.observe(document, "mousemove", this.eventMouseMove);if (this.isIFrame) {var objBody = document.getElementsByTagName("body").item(0);var div = document.createElement("div");div.style.position = "absolute";div.style.top = this.heightN + "px";div.style.left = this.widthW + "px";div.style.zIndex = Windows.maxZIndex;div.style.height = this.height + "px";div.style.width = this.width + "px";this.element.appendChild(div);this.tmpDiv = div;}Event.stop(event);}), updateDrag:(function (event) {var pointer = [Event.pointerX(event), Event.pointerY(event)];var dx = pointer[0] - this.pointer[0];var dy = pointer[1] - this.pointer[1];if (this.doResize) {this.setSize(this.widthOrg + dx, this.heightOrg + dy);dx = this.width - this.widthOrg;dy = this.height - this.heightOrg;if (!this.useLeft) {this.element.setStyle({right:(this.rightOrg - dx) + "px"});}if (!this.useTop) {this.element.setStyle({bottom:(this.bottomOrg - dy) + "px"});}if (this.tmpDiv) {Element.setStyle(this.tmpDiv, {width:this.width + "px", height:this.height + "px"});}} else {this.pointer = pointer;if (this.useLeft) {this.element.setStyle({left:parseFloat(this.element.getStyle("left")) + dx + "px"});} else {this.element.setStyle({right:parseFloat(this.element.getStyle("right")) - dx + "px"});}if (this.useTop) {this.element.setStyle({top:parseFloat(this.element.getStyle("top")) + dy + "px"});} else {this.element.setStyle({bottom:parseFloat(this.element.getStyle("bottom")) - dy + "px"});}}if (this.iefix) {this._fixIEOverlapping();}this._removeStoreLocation();Event.stop(event);}), endDrag:(function (event) {if (this.doResize) {Windows.notify("onEndResize", this);} else {Windows.notify("onEndMove", this);}Event.stopObserving(document, "mouseup", this.eventMouseUp);Event.stopObserving(document, "mousemove", this.eventMouseMove);if (this.isIFrame) {this.tmpDiv.parentNode.removeChild(this.tmpDiv);this.tmpDiv = null;}this._saveCookie();Event.stop(event);}), keyPress:(function (event) {}), createWindow:(function (id, className, parent, resizable, closable, minimizable, maximizable, title, url, onload) {win = document.createElement("div");win.setAttribute("id", id);win.className = "dialog";if (!title) {title = "&nbsp;";}var content;if (url) {content = "<IFRAME name=\"" + id + "_content\"  id=\"" + id + "_content\" SRC=\"" + url + "\" onload=\"" + onload + "\" > </IFRAME>";} else {content = "<DIV id=\"" + id + "_content\" class=\"" + className + "_content\" onload=\"" + onload + "\"> </DIV>";}win.innerHTML = "\t\t<div class='" + className + "_close' id='" + id + "_close' onclick='Windows.close(\"" + id + "\")'> </div>\t\t<div class='" + className + "_minimize' id='" + id + "_minimize' onclick='Windows.minimize(\"" + id + "\")'> </div>\t\t<div class='" + className + "_maximize' id='" + id + "_maximize' onclick='Windows.maximize(\"" + id + "\")'> </div>\t\t<table id='" + id + "_header' class='" + className + "_header'>\t\t\t<tr id='" + id + "_row1'>\t\t\t\t<td>\t\t\t\t\t<table>\t\t\t\t\t\t<tr>\t\t\t\t\t\t\t<td id='" + id + "_nw' class='" + className + "_nw'><div class='" + className + "_nw'> </div></td>\t\t\t\t\t\t\t<td class='" + className + "_n'  valign='middle'><div id='" + id + "_top' class='" + className + "_title'>" + title + "</div></td>\t\t\t\t\t\t\t<td class='" + className + "_ne'> <div class='" + className + "_ne'></div></td>\t\t\t\t\t\t</tr>\t\t\t\t\t</table>\t\t\t\t</td>\t\t\t</tr>\t\t\t<tr id='" + id + "_row2'>\t\t\t\t<td>\t\t\t\t\t<table >\t\t\t\t\t\t<tr>\t\t\t\t\t\t\t<td class='" + className + "_w'><div class='" + className + "_w'> </div></td>\t\t\t\t\t\t\t<td class='" + className + "_content'>" + content + "</td>\t\t\t\t\t\t\t<td class='" + className + "_e'><div class='" + className + "_e'> </div></td>\t\t\t\t\t\t</tr>\t\t\t\t\t</table>\t\t\t\t</td>\t\t\t</tr>\t\t\t<tr id='" + id + "_row3'>\t\t\t\t<td>\t\t\t\t\t<table>\t\t\t\t\t\t<tr>\t\t\t\t\t\t\t<td class='" + className + "_sw' id='" + id + "_sw'><div class='" + className + "_sw'></div> </td>\t\t\t\t\t\t\t<td class='" + className + "_s'><div  id='" + id + "_bottom' class='" + className + "_s'></div></td>\t\t\t\t\t\t\t<td class='" + className + "_se'>" + (resizable ? "<div id='" + id + "_sizer' class='" + className + "_sizer'></div>" : "<div class='" + className + "_se'></div>") + "</td>\t\t\t\t\t\t</tr>\t\t\t\t\t</table>\t\t\t\t</td>\t\t\t</tr>\t\t</table>\t\t";Element.hide(win);parent.insertBefore(win, parent.firstChild);if (!closable) {Element.hide(id + "_close");}if (!minimizable) {Element.hide(id + "_minimize");}if (!maximizable) {Element.hide(id + "_maximize");}return win;}), setLocation:(function (top, left) {if (top < 0) {top = 0;}if (left < 0) {left = 0;}this.element.setStyle({top:top + "px"});this.element.setStyle({left:left + "px"});this.useLeft = true;this.useTop = true;}), setSize:(function (width, height) {if (width < this.minWidth) {width = this.minWidth;}if (height < this.minHeight) {height = this.minHeight;}if (this.maxHeight && height > this.maxHeight) {height = this.maxHeight;}if (this.maxWidth && width > this.maxWidth) {width = this.maxWidth;}this.width = width;this.height = height;this.element.setStyle({width:width + this.widthW + this.widthE + "px"});this.element.setStyle({height:height + this.heightN + this.heightS + "px"});var content = $(this.element.id + "_content");content.setStyle({height:height + "px"});content.setStyle({width:width + "px"});}), toFront:(function () {this.setZIndex(Windows.maxZIndex + 20);}), show:(function (modal) {if (modal) {WindowUtilities.disableScreen(this.className);this.modal = true;this.setZIndex(Windows.maxZIndex + 20);Windows.unsetOverflow(this);Event.observe(document, "keypress", this.eventKeyPress);}if (this.oldStyle) {this.getContent().setStyle({overflow:this.oldStyle});}this.setSize(this.width, this.height);if (this.showEffect != Element.show && this.showEffectOptions) {this.showEffect(this.element, this.showEffectOptions);} else {this.showEffect(this.element);}this._checkIEOverlapping();}), showCenter:(function (modal) {this.setSize(this.width, this.height);this.center();this.show(modal);}), center:(function () {var windowScroll = WindowUtilities.getWindowScroll();var pageSize = WindowUtilities.getPageSize();this.setLocation(windowScroll.top + (pageSize.windowHeight - (this.height + this.heightN + this.heightS)) / 2, windowScroll.left + (pageSize.windowWidth - (this.width + this.widthW + this.widthE)) / 2);this.toFront();}), hide:(function () {if (this.modal) {WindowUtilities.enableScreen();Windows.resetOverflow();Event.stopObserving(document, "keypress", this.eventKeyPress);}this.getContent().setStyle({overflow:"hidden"});this.oldStyle = this.getContent().getStyle("overflow");if (this.hideEffect != Element.hide && this.hideEffectOptions) {this.hideEffect(this.element, this.hideEffectOptions);} else {this.hideEffect(this.element);}if (this.iefix) {this.iefix.hide();}}), minimize:(function () {var r2 = $(this.getId() + "_row2");var r3 = $(this.getId() + "_row3");if (r2.visible()) {r2.hide();r3.hide();} else {r2.show();r3.show();}this._saveCookie();}), maximize:(function () {if (this.storedLocation != null) {this._restoreLocation();if (this.iefix) {this.iefix.hide();}} else {this._storeLocation();Windows.unsetOverflow(this);var windowScroll = WindowUtilities.getWindowScroll();var pageSize = WindowUtilities.getPageSize();this.element.setStyle(this.useLeft ? {left:windowScroll.left} : {right:windowScroll.left});this.element.setStyle(this.useTop ? {top:windowScroll.top} : {bottom:windowScroll.top});this.setSize(pageSize.windowWidth - this.widthW - this.widthE, pageSize.windowHeight - this.heightN - this.heightS);this.toFront();if (this.iefix) {this._fixIEOverlapping();}}this._saveCookie();}), isMinimized:(function () {var r2 = $(this.getId() + "_row2");return !r2.visible();}), isMaximized:(function () {return (this.storedLocation != null);}), setOpacity:(function (opacity) {if (Element.setOpacity) {Element.setOpacity(this.element, opacity);}}), setZIndex:(function (zindex) {this.element.setStyle({zIndex:zindex});Windows.updateZindex(zindex, this);}), setTitle:(function (newTitle) {if (!newTitle) {newTitle = "&nbsp;";}Element.update(this.element.id + "_top", newTitle);}), setStatusBar:(function (element) {var statusBar = $(this.getId() + "_bottom");if (typeof (element) == "object") {if (this.bottombar.firstChild) {this.bottombar.replaceChild(element, this.bottombar.firstChild);} else {this.bottombar.appendChild(element);}} else {this.bottombar.innerHTML = element;}}), _checkIEOverlapping:(function () {if (!this.iefix && (navigator.appVersion.indexOf("MSIE") > 0) && (navigator.userAgent.indexOf("Opera") < 0) && (this.element.getStyle("position") == "absolute")) {new Insertion.After(this.element.id, "<iframe id=\"" + this.element.id + "_iefix\" " + "style=\"display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);\" " + "src=\"javascript:false;\" frameborder=\"0\" scrolling=\"no\"></iframe>");this.iefix = $(this.element.id + "_iefix");}if (this.iefix) {setTimeout(this._fixIEOverlapping.bind(this), 50);}}), _fixIEOverlapping:(function () {Position.clone(this.element, this.iefix);this.iefix.style.zIndex = this.element.style.zIndex - 1;this.iefix.show();}), _getWindowBorderSize:(function (event) {var div = this._createHiddenDiv(this.className + "_n");this.heightN = Element.getDimensions(div).height;div.parentNode.removeChild(div);var div = this._createHiddenDiv(this.className + "_s");this.heightS = Element.getDimensions(div).height;div.parentNode.removeChild(div);var div = this._createHiddenDiv(this.className + "_e");this.widthE = Element.getDimensions(div).width;div.parentNode.removeChild(div);var div = this._createHiddenDiv(this.className + "_w");this.widthW = Element.getDimensions(div).width;div.parentNode.removeChild(div);if (this.doMaximize) {this.maximize();}}), _createHiddenDiv:(function (className) {var objBody = document.getElementsByTagName("body").item(0);var win = document.createElement("div");win.setAttribute("id", this.element.id + "_tmp");win.className = className;win.style.display = "none";win.innerHTML = "";objBody.insertBefore(win, objBody.firstChild);return win;}), _storeLocation:(function () {if (this.storedLocation == null) {this.storedLocation = {useTop:this.useTop, useLeft:this.useLeft, top:this.element.getStyle("top"), bottom:this.element.getStyle("bottom"), left:this.element.getStyle("left"), right:this.element.getStyle("right"), width:this.width, height:this.height};}}), _restoreLocation:(function () {if (this.storedLocation != null) {this.useLeft = this.storedLocation.useLeft;this.useTop = this.storedLocation.useTop;this.element.setStyle(this.useLeft ? {left:this.storedLocation.left} : {right:this.storedLocation.right});this.element.setStyle(this.useTop ? {top:this.storedLocation.top} : {bottom:this.storedLocation.bottom});this.setSize(this.storedLocation.width, this.storedLocation.height);Windows.resetOverflow();this._removeStoreLocation();}}), _removeStoreLocation:(function () {this.storedLocation = null;}), _saveCookie:(function () {if (this.cookie) {var value = "";if (this.useLeft) {value += "l:" + (this.storedLocation ? this.storedLocation.left : this.element.getStyle("left"));} else {value += "r:" + (this.storedLocation ? this.storedLocation.right : this.element.getStyle("right"));}if (this.useTop) {value += ",t:" + (this.storedLocation ? this.storedLocation.top : this.element.getStyle("top"));} else {value += ",b:" + (this.storedLocation ? this.storedLocation.bottom : this.element.getStyle("bottom"));}value += "," + (this.storedLocation ? this.storedLocation.width : this.width);value += "," + (this.storedLocation ? this.storedLocation.height : this.height);value += "," + this.isMinimized();value += "," + this.isMaximized();WindowUtilities.setCookie(value, this.cookie);}})};
var Windows = {windows:[], observers:[], focusedWindow:null, maxZIndex:0, addObserver:(function (observer) {this.observers.push(observer);}), removeObserver:(function (observer) {this.observers = this.observers.reject((function (o) {return o == observer;}));}), notify:(function (eventName, win) {this.observers.each((function (o) {if (o[eventName]) {o[eventName](eventName, win);}}));}), getWindow:(function (id) {return this.windows.detect((function (d) {return d.getId() == id;}));}), register:(function (win) {this.windows.push(win);}), unregister:(function (win) {this.windows = this.windows.reject((function (d) {return d == win;}));}), close:(function (id) {win = this.getWindow(id);if (win) {if (win.getDelegate() && !win.getDelegate().canClose(win)) {return;}this.notify("onClose", win);win.hide();if (win.destroyOnClose) {win.destroy();}}}), closeAll:(function () {this.windows.each((function (w) {Windows.close(w.getId());}));}), minimize:(function (id) {win = this.getWindow(id);win.minimize();}), maximize:(function (id) {win = this.getWindow(id);win.maximize();}), unsetOverflow:(function (except) {this.windows.each((function (d) {d.oldOverflow = d.getContent().getStyle("overflow") || "auto";d.getContent().setStyle({overflow:"hidden"});}));if (except && except.oldOverflow) {except.getContent().setStyle({overflow:except.oldOverflow});}}), resetOverflow:(function () {this.windows.each((function (d) {if (d.oldOverflow) {d.getContent().setStyle({overflow:d.oldOverflow});}}));}), updateZindex:(function (zindex, win) {if (zindex > this.maxZIndex) {this.maxZIndex = zindex;}this.focusedWindow = win;})};
var Dialog = {win:null, confirm:(function (message, parameters) {parameters = parameters || {};var okLabel = parameters.okLabel ? parameters.okLabel : "Ok";var cancelLabel = parameters.cancelLabel ? parameters.cancelLabel : "Cancel";var windowParam = parameters.windowParameters || {};windowParam.className = windowParam.className || "alert";buttonClass = parameters.buttonClass ? "class=" + parameters.buttonClass : "";var content = "\t\t\t<div class='" + windowParam.className + "_message'>" + message + "</div>\t\t\t\t<div class='" + windowParam.className + "_buttons'>\t\t\t\t\t<input type='button' value='" + okLabel + "' onclick='Dialog.okCallback()'" + buttonClass + "/>\t\t\t\t\t<input type='button' value='" + cancelLabel + "' onclick='Dialog.cancelCallback()" + buttonClass + "'/>\t\t\t\t</div>\t\t";this.openDialog(content, parameters);return this.win;}), alert:(function (message, parameters) {parameters = parameters || {};var okLabel = parameters.okLabel ? parameters.okLabel : "Ok";var windowParam = parameters.windowParameters || {};windowParam.className = windowParam.className || "alert";buttonClass = parameters.buttonClass ? "class=" + parameters.buttonClass : "";var content = "\t\t\t<div class='" + windowParam.className + "_message'>" + message + "</div>\t\t\t\t<div class='" + windowParam.className + "_buttons'>\t\t\t\t\t<input type='button' value='" + okLabel + "' onclick='Dialog.okCallback()" + buttonClass + "'/>\t\t\t\t</div>";return this.openDialog(content, parameters);}), info:(function (message, parameters) {parameters = parameters || {};parameters.windowParameters = parameters.windowParameters || {};var className = parameters.windowParameters.className || "alert";var content = "<div id='modal_dialog_message' class='" + className + "_message'>" + message + "</div>";if (parameters.showProgress) {content += "<div id='modal_dialog_progress' class='" + className + "_progress'>\t</div>";}parameters.windowParameters.ok = null;parameters.windowParameters.cancel = null;parameters.windowParameters.className = className;return this.openDialog(content, parameters);}), setInfoMessage:(function (message) {$("modal_dialog_message").update(message);}), closeInfo:(function () {Windows.close("modal_dialog");}), openDialog:(function (content, parameters) {if (this.win) {this.win.destroy();}var windowParam = parameters && parameters.windowParameters ? parameters.windowParameters : {};windowParam.resizable = windowParam.resizable || false;windowParam.effectOptions = windowParam.effectOptions || {duration:1};this.win = new Window("modal_dialog", windowParam);this.win.getContent().innerHTML = content;this.win.showCenter(true);this.win.cancelCallback = parameters.cancel;this.win.okCallback = parameters.ok;if (!this.eventResize) {this.eventResize = this.recenter.bindAsEventListener(this);}Event.observe(window, "resize", this.eventResize);Event.observe(window, "scroll", this.eventResize);return this.win;}), okCallback:(function () {this.win.hide();Event.stopObserving(window, "resize", this.eventResize);Event.stopObserving(window, "scroll", this.eventResize);if (this.win.okCallback) {this.win.okCallback(this.win);}}), cancelCallback:(function () {this.win.hide();Event.stopObserving(window, "resize", this.eventResize);Event.stopObserving(window, "scroll", this.eventResize);if (this.win.cancelCallback) {this.win.cancelCallback(this.win);}}), recenter:(function (event) {var pageSize = WindowUtilities.getPageSize();if ($("overlay_modal")) {$("overlay_modal").style.height = (pageSize.pageHeight + "px");}this.win.center();})};
var isIE = navigator.appVersion.match(/MSIE/) == "MSIE";
var WindowUtilities = {getWindowScroll:(function () {var w = window;var T, L, W, H;with (w.document) {if (w.document.documentElement && documentElement.scrollTop) {T = documentElement.scrollTop;L = documentElement.scrollLeft;} else {if (w.document.body) {T = body.scrollTop;L = body.scrollLeft;}}if (w.innerWidth) {W = w.innerWidth;H = w.innerHeight;} else {if (w.document.documentElement && documentElement.clientWidth) {W = documentElement.clientWidth;H = documentElement.clientHeight;} else {W = body.offsetWidth;H = body.offsetHeight;}}}return {top:T, left:L, width:W, height:H};}), getPageSize:(function () {var xScroll, yScroll;if (window.innerHeight && window.scrollMaxY) {xScroll = document.body.scrollWidth;yScroll = window.innerHeight + window.scrollMaxY;} else {if (document.body.scrollHeight > document.body.offsetHeight) {xScroll = document.body.scrollWidth;yScroll = document.body.scrollHeight;} else {xScroll = document.body.offsetWidth;yScroll = document.body.offsetHeight;}}var windowWidth, windowHeight;if (self.innerHeight) {windowWidth = self.innerWidth;windowHeight = self.innerHeight;} else {if (document.documentElement && document.documentElement.clientHeight) {windowWidth = document.documentElement.clientWidth;windowHeight = document.documentElement.clientHeight;} else {if (document.body) {windowWidth = document.body.clientWidth;windowHeight = document.body.clientHeight;}}}var pageHeight, pageWidth;if (yScroll < windowHeight) {pageHeight = windowHeight;} else {pageHeight = yScroll;}if (xScroll < windowWidth) {pageWidth = windowWidth;} else {pageWidth = xScroll;}return {pageWidth:pageWidth, pageHeight:pageHeight, windowWidth:windowWidth, windowHeight:windowHeight};}), disableScreen:(function (className) {WindowUtilities.initLightbox(className);var objBody = document.getElementsByTagName("body").item(0);var objOverlay = $("overlay_modal");var pageSize = WindowUtilities.getPageSize();if (isIE) {selects = document.getElementsByTagName("select");for (var i = 0; i != selects.length; i++) {selects[i].style.visibility = "hidden";}}objOverlay.style.height = (pageSize.pageHeight + "px");objOverlay.style.display = "block";}), enableScreen:(function () {var objOverlay = $("overlay_modal");if (objOverlay) {objOverlay.style.display = "none";if (isIE) {selects = document.getElementsByTagName("select");for (var i = 0; i != selects.length; i++) {selects[i].style.visibility = "visible";}}objOverlay.parentNode.removeChild(objOverlay);}}), initLightbox:(function (className) {if ($("overlay_modal")) {Element.setStyle("overlay_modal", {zIndex:Windows.maxZIndex + 10});} else {var objBody = document.getElementsByTagName("body").item(0);var objOverlay = document.createElement("div");objOverlay.setAttribute("id", "overlay_modal");objOverlay.className = "overlay_" + className;objOverlay.style.display = "none";objOverlay.style.position = "absolute";objOverlay.style.top = "0";objOverlay.style.left = "0";objOverlay.style.zIndex = Windows.maxZIndex + 10;objOverlay.style.width = "100%";objBody.insertBefore(objOverlay, objBody.firstChild);}}), setCookie:(function (value, parameters) {document.cookie = parameters[0] + "=" + escape(value) + ((parameters[1]) ? "; expires=" + parameters[1].toGMTString() : "") + ((parameters[2]) ? "; path=" + parameters[2] : "") + ((parameters[3]) ? "; domain=" + parameters[3] : "") + ((parameters[4]) ? "; secure" : "");}), getCookie:(function (name) {var dc = document.cookie;var prefix = name + "=";var begin = dc.indexOf("; " + prefix);if (begin == -1) {begin = dc.indexOf(prefix);if (begin != 0) {return null;}} else {begin += 2;}var end = document.cookie.indexOf(";", begin);if (end == -1) {end = dc.length;}return unescape(dc.substring(begin + prefix.length, end));})};
var Rules = {};
var EventSelectors = {version:"1.0_pre", cache:[], start:(function (rules) {this.rules = rules || {};this.timer = new Array();this._extendRules();this.assign(this.rules);}), assign:(function (rules) {var observer = null;this._unloadCache();rules._each((function (rule) {var selectors = $A(rule.key.split(","));selectors.each((function (selector) {var pair = selector.split(":");var event = pair[1];$$(pair[0]).each((function (element) {if (pair[1] == "" || pair.length == 1) {return rule.value(element);}if (event.toLowerCase() == "loaded") {this.timer[pair[0]] = setInterval(this._checkLoaded.bind(this, element, pair[0], rule), 15);} else {observer = (function (event) {rule.value($(element), event);});this.cache.push([element, event, observer]);Event.observe(element, event, observer);}}).bind(this));}).bind(this));}).bind(this));}), _unloadCache:(function () {if (!this.cache) {return;}for (var i = 0; i < this.cache.length; i++) {Event.stopObserving.apply(this, this.cache[i]);this.cache[i][0] = null;}this.cache = [];}), _checkLoaded:(function (element, timer, rule) {var node = $(element);if (element.tagName != "undefined") {clearInterval(this.timer[timer]);rule.value(node);}}), _extendRules:(function () {Object.extend(this.rules, {_each:(function (iterator) {for (key in this) {if (key == "_each") {continue;}var value = this[key];var pair = [key, value];pair.key = key;pair.value = value;iterator(pair);}})});})};
Ajax.Responders.register({onComplete:(function () {EventSelectors.assign(Rules);})});
if (typeof (Control) == "undefined") {
    Control = {};
}
var $proc = (function (proc) {return typeof (proc) == "function" ? proc : (function () {return proc;});});
var $value = (function (value) {return typeof (value) == "function" ? value() : value;});
Object.Event = {extend:(function (object) {object._objectEventSetup = (function (event_name) {this._observers = this._observers || {};this._observers[event_name] = this._observers[event_name] || [];});object.observe = (function (event_name, observer) {if (typeof (event_name) == "string" && typeof (observer) != "undefined") {this._objectEventSetup(event_name);if (!this._observers[event_name].include(observer)) {this._observers[event_name].push(observer);}} else {for (var e in event_name) {this.observe(e, event_name[e]);}}});object.stopObserving = (function (event_name, observer) {this._objectEventSetup(event_name);if (event_name && observer) {this._observers[event_name] = this._observers[event_name].without(observer);} else {if (event_name) {this._observers[event_name] = [];} else {this._observers = {};}}});object.observeOnce = (function (event_name, outer_observer) {var inner_observer = (function () {outer_observer.apply(this, arguments);this.stopObserving(event_name, inner_observer);}).bind(this);this._objectEventSetup(event_name);this._observers[event_name].push(inner_observer);});object.notify = (function (event_name) {this._objectEventSetup(event_name);var collected_return_values = [];var args = $A(arguments).slice(1);try {for (var i = 0; i < this._observers[event_name].length; ++i) {collected_return_values.push(this._observers[event_name][i].apply(this._observers[event_name][i], args) || null);}} catch (e) {if (e == $break) {return false;} else {throw e;}}return collected_return_values;});if (object.prototype) {object.prototype._objectEventSetup = object._objectEventSetup;object.prototype.observe = object.observe;object.prototype.stopObserving = object.stopObserving;object.prototype.observeOnce = object.observeOnce;object.prototype.notify = (function (event_name) {if (object.notify) {var args = $A(arguments).slice(1);args.unshift(this);args.unshift(event_name);object.notify.apply(object, args);}this._objectEventSetup(event_name);var args = $A(arguments).slice(1);var collected_return_values = [];try {if (this.options && this.options[event_name] && typeof (this.options[event_name]) == "function") {collected_return_values.push(this.options[event_name].apply(this, args) || null);}for (var i = 0; i < this._observers[event_name].length; ++i) {collected_return_values.push(this._observers[event_name][i].apply(this._observers[event_name][i], args) || null);}} catch (e) {if (e == $break) {return false;} else {throw e;}}return collected_return_values;});}})};
Element.addMethods({observeOnce:(function (element, event_name, outer_callback) {var inner_callback = (function () {outer_callback.apply(this, arguments);Element.stopObserving(element, event_name, inner_callback);});Element.observe(element, event_name, inner_callback);})});
Object.extend(Event, (function () {var cache = Event.cache;
function getEventID(element) {if (element._prototypeEventID) {return element._prototypeEventID[0];}arguments.callee.id = arguments.callee.id || 1;return element._prototypeEventID = [++arguments.callee.id];}

function getDOMEventName(eventName) {if (eventName && eventName.include(":")) {return "dataavailable";}if (!Prototype.Browser.IE) {eventName = {mouseenter:"mouseover", mouseleave:"mouseout"}[eventName] || eventName;}return eventName;}

function getCacheForID(id) {return cache[id] = cache[id] || {};}

function getWrappersForEventName(id, eventName) {var c = getCacheForID(id);return c[eventName] = c[eventName] || [];}

function createWrapper(element, eventName, handler) {var id = getEventID(element);var c = getWrappersForEventName(id, eventName);if (c.pluck("handler").include(handler)) {return false;}var wrapper = (function (event) {if (!Event || !Event.extend || (event.eventName && event.eventName != eventName)) {return false;}Event.extend(event);handler.call(element, event);});if (!(Prototype.Browser.IE) && ["mouseenter", "mouseleave"].include(eventName)) {wrapper = wrapper.wrap((function (proceed, event) {var rel = event.relatedTarget;var cur = event.currentTarget;if (rel && rel.nodeType == Node.TEXT_NODE) {rel = rel.parentNode;}if (rel && rel != cur && !rel.descendantOf(cur)) {return proceed(event);}}));}wrapper.handler = handler;c.push(wrapper);return wrapper;}

function findWrapper(id, eventName, handler) {var c = getWrappersForEventName(id, eventName);return c.find((function (wrapper) {return wrapper.handler == handler;}));}

function destroyWrapper(id, eventName, handler) {var c = getCacheForID(id);if (!c[eventName]) {return false;}c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));}

function destroyCache() {for (var id in cache) {for (var eventName in cache[id]) {cache[id][eventName] = null;}}}
if (window.attachEvent) {window.attachEvent("onunload", destroyCache);}return {observe:(function (element, eventName, handler) {element = $(element);var name = getDOMEventName(eventName);var wrapper = createWrapper(element, eventName, handler);if (!wrapper) {return element;}if (element.addEventListener) {element.addEventListener(name, wrapper, false);} else {element.attachEvent("on" + name, wrapper);}return element;}), stopObserving:(function (element, eventName, handler) {element = $(element);var id = getEventID(element), name = getDOMEventName(eventName);if (!handler && eventName) {getWrappersForEventName(id, eventName).each((function (wrapper) {element.stopObserving(eventName, wrapper.handler);}));return element;} else {if (!eventName) {Object.keys(getCacheForID(id)).each((function (eventName) {element.stopObserving(eventName);}));return element;}}var wrapper = findWrapper(id, eventName, handler);if (!wrapper) {return element;}if (element.removeEventListener) {element.removeEventListener(name, wrapper, false);} else {element.detachEvent("on" + name, wrapper);}destroyWrapper(id, eventName, handler);return element;}), fire:(function (element, eventName, memo) {element = $(element);if (element == document && document.createEvent && !element.dispatchEvent) {element = document.documentElement;}var event;if (document.createEvent) {event = document.createEvent("HTMLEvents");event.initEvent("dataavailable", true, true);} else {event = document.createEventObject();event.eventType = "ondataavailable";}event.eventName = eventName;event.memo = memo || {};if (document.createEvent) {element.dispatchEvent(event);} else {element.fireEvent(event.eventType, event);}return Event.extend(event);})};})());
Object.extend(Event, Event.Methods);
Element.addMethods({fire:Event.fire, observe:Event.observe, stopObserving:Event.stopObserving});
Object.extend(document, {fire:Element.Methods.fire.methodize(), observe:Element.Methods.observe.methodize(), stopObserving:Element.Methods.stopObserving.methodize()});
(function () {
function wheel(event) {var delta;if (event.wheelDelta) {delta = event.wheelDelta / 120;} else {if (event.detail) {delta = -event.detail / 3;}}if (!delta) {return;}var custom_event = event.element().fire("mouse:wheel", {delta:delta});if (custom_event.stopped) {event.stop();return false;}}
document.observe("mousewheel", wheel);document.observe("DOMMouseScroll", wheel);})();
var IframeShim = Class.create({initialize:(function () {this.element = new Element("iframe", {style:"position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);display:none", src:"javascript:void(0);", frameborder:0});$(document.body).insert(this.element);}), hide:(function () {this.element.hide();return this;}), show:(function () {this.element.show();return this;}), positionUnder:(function (element) {var element = $(element);var offset = element.cumulativeOffset();var dimensions = element.getDimensions();this.element.setStyle({left:offset[0] + "px", top:offset[1] + "px", width:dimensions.width + "px", height:dimensions.height + "px", zIndex:element.getStyle("zIndex") - 1}).show();return this;}), setBounds:(function (bounds) {for (prop in bounds) {bounds[prop] += "px";}this.element.setStyle(bounds);return this;}), destroy:(function () {if (this.element) {this.element.remove();}return this;})});
if (typeof (Control) == "undefined") {
    var Control = {};
}
Control.Tabs = Class.create();
Object.extend(Control.Tabs, {instances:[], findByTabId:(function (id) {return Control.Tabs.instances.find((function (tab) {return tab.links.find((function (link) {return link.key == id;}));}));})});
Object.extend(Control.Tabs.prototype, {initialize:(function (tab_list_container, options) {this.activeContainer = false;this.activeLink = false;this.containers = $H({});this.links = [];Control.Tabs.instances.push(this);this.options = {beforeChange:Prototype.emptyFunction, afterChange:Prototype.emptyFunction, hover:false, linkSelector:"li a", setClassOnContainer:false, activeClassName:"active", defaultTab:"first", autoLinkExternal:true, targetRegExp:/#(.+)$/, showFunction:Element.show, hideFunction:Element.hide};Object.extend(this.options, options || {});(typeof (this.options.linkSelector == "string") ? $(tab_list_container).getElementsBySelector(this.options.linkSelector) : this.options.linkSelector($(tab_list_container))).findAll((function (link) {return (/^#/).exec(link.href.replace(window.location.href.split("#")[0], ""));})).each((function (link) {this.addTab(link);}).bind(this));this.containers.values().each(this.options.hideFunction);if (this.options.defaultTab == "first") {this.setActiveTab(this.links.first());} else {if (this.options.defaultTab == "last") {this.setActiveTab(this.links.last());} else {this.setActiveTab(this.options.defaultTab);}}var targets = this.options.targetRegExp.exec(window.location);if (targets && targets[1]) {targets[1].split(",").each((function (target) {this.links.each((function (target, link) {if (link.key == target) {this.setActiveTab(link);throw $break;}}).bind(this, target));}).bind(this));}if (this.options.autoLinkExternal) {$A(document.getElementsByTagName("a")).each((function (a) {if (!this.links.include(a)) {var clean_href = a.href.replace(window.location.href.split("#")[0], "");if (clean_href.substring(0, 1) == "#") {if (this.containers.keys().include(clean_href.substring(1))) {$(a).observe("click", (function (event, clean_href) {this.setActiveTab(clean_href.substring(1));}).bindAsEventListener(this, clean_href));}}}}).bind(this));}}), addTab:(function (link) {this.links.push(link);link.key = link.getAttribute("href").replace(window.location.href.split("#")[0], "").split("/").last().replace(/#/, "");this.containers.set(link.key, $(link.key));link[this.options.hover ? "onmouseover" : "onclick"] = (function (link) {if (window.event) {Event.stop(window.event);}this.setActiveTab(link);return false;}).bind(this, link);}), setActiveTab:(function (link) {if (!link) {return;}if (typeof (link) == "string") {this.links.each((function (_link) {if (_link.key == link) {this.setActiveTab(_link);throw $break;}}).bind(this));} else {this.notify("beforeChange", this.activeContainer);if (this.activeContainer) {this.options.hideFunction(this.activeContainer);}this.links.each((function (item) {(this.options.setClassOnContainer ? $(item.parentNode) : item).removeClassName(this.options.activeClassName);}).bind(this));(this.options.setClassOnContainer ? $(link.parentNode) : link).addClassName(this.options.activeClassName);this.activeContainer = this.containers.get(link.key);this.activeLink = link;this.options.showFunction(this.containers.get(link.key));this.notify("afterChange", this.containers.get(link.key));}}), next:(function () {this.links.each((function (link, i) {if (this.activeLink == link && this.links[i + 1]) {this.setActiveTab(this.links[i + 1]);throw $break;}}).bind(this));return false;}), previous:(function () {this.links.each((function (link, i) {if (this.activeLink == link && this.links[i - 1]) {this.setActiveTab(this.links[i - 1]);throw $break;}}).bind(this));return false;}), first:(function () {this.setActiveTab(this.links.first());return false;}), last:(function () {this.setActiveTab(this.links.last());return false;}), notify:(function (event_name) {try {if (this.options[event_name]) {return [this.options[event_name].apply(this.options[event_name], $A(arguments).slice(1))];}} catch (e) {if (e != $break) {throw e;} else {return false;}}})});
if (typeof (Object.Event) != "undefined") {
    Object.Event.extend(Control.Tabs);
}
if (typeof (Draggable) != "undefined") {
    Draggable.prototype.draw = (function (point) {var pos = Position.cumulativeOffset(this.element);if (this.options.ghosting) {var r = Position.realOffset(this.element);pos[0] += r[0] - Position.deltaX;pos[1] += r[1] - Position.deltaY;}var d = this.currentDelta();pos[0] -= d[0];pos[1] -= d[1];if (this.options.scroll && (this.options.scroll != window && this._isScrollChild)) {pos[0] -= this.options.scroll.scrollLeft - this.originalScrollLeft;pos[1] -= this.options.scroll.scrollTop - this.originalScrollTop;}var p = [0, 1].map((function (i) {return (point[i] - pos[i] - this.offset[i]);}).bind(this));if (this.options.snap) {if (typeof this.options.snap == "function") {p = this.options.snap(p[0], p[1], this);} else {if (this.options.snap instanceof Array) {p = p.map((function (v, i) {return Math.round(v / this.options.snap[i]) * this.options.snap[i];}).bind(this));} else {p = p.map((function (v) {return Math.round(v / this.options.snap) * this.options.snap;}).bind(this));}}}if (this.options.onDraw) {this.options.onDraw.bind(this)(p);} else {var style = this.element.style;if (this.options.constrainToViewport) {var viewport_dimensions = document.viewport.getDimensions();var container_dimensions = this.element.getDimensions();var margin_top = parseInt(this.element.getStyle("margin-top"));var margin_left = parseInt(this.element.getStyle("margin-left"));var boundary = [[0 - margin_left, 0 - margin_top], [(viewport_dimensions.width - container_dimensions.width) - margin_left, (viewport_dimensions.height - container_dimensions.height) - margin_top]];if ((!this.options.constraint) || (this.options.constraint == "horizontal")) {if ((p[0] >= boundary[0][0]) && (p[0] <= boundary[1][0])) {this.element.style.left = p[0] + "px";} else {this.element.style.left = ((p[0] < boundary[0][0]) ? boundary[0][0] : boundary[1][0]) + "px";}}if ((!this.options.constraint) || (this.options.constraint == "vertical")) {if ((p[1] >= boundary[0][1]) && (p[1] <= boundary[1][1])) {this.element.style.top = p[1] + "px";} else {this.element.style.top = ((p[1] <= boundary[0][1]) ? boundary[0][1] : boundary[1][1]) + "px";}}} else {if ((!this.options.constraint) || (this.options.constraint == "horizontal")) {style.left = p[0] + "px";}if ((!this.options.constraint) || (this.options.constraint == "vertical")) {style.top = p[1] + "px";}}if (style.visibility == "hidden") {style.visibility = "";}}});
}
if (typeof (Prototype) == "undefined") {
    throw "Control.Window requires Prototype to be loaded.";
}
if (typeof (Object.Event) == "undefined") {
    throw "Control.Window requires Object.Event to be loaded.";
}
Control.Window = Class.create({initialize:(function (container, options) {Control.Window.windows.push(this);this.container = false;this.isOpen = false;this.href = false;this.sourceContainer = false;this.ajaxRequest = false;this.remoteContentLoaded = false;this.numberInSequence = Control.Window.windows.length + 1;this.indicator = false;this.effects = {fade:false, appear:false};this.indicatorEffects = {fade:false, appear:false};this.options = Object.extend({beforeOpen:Prototype.emptyFunction, afterOpen:Prototype.emptyFunction, beforeClose:Prototype.emptyFunction, afterClose:Prototype.emptyFunction, height:null, width:null, className:false, position:"center", offsetLeft:0, offsetTop:0, iframe:false, hover:false, indicator:false, closeOnClick:false, iframeshim:true, fade:false, fadeDuration:0.75, draggable:false, onDrag:Prototype.emptyFunction, resizable:false, minHeight:false, minWidth:false, maxHeight:false, maxWidth:false, onResize:Prototype.emptyFunction, constrainToViewport:false, parameters:{}, onComplete:Prototype.emptyFunction, onSuccess:Prototype.emptyFunction, onFailure:Prototype.emptyFunction, onException:Prototype.emptyFunction, onRemoteContentLoaded:Prototype.emptyFunction, insertRemoteContentAt:false}, options || {});this.indicator = this.options.indicator ? $(this.options.indicator) : false;if (container) {if (typeof (container) == "string" && container.match(Control.Window.uriRegex)) {this.href = container;} else {this.container = $(container);this.createDefaultContainer(container);if (this.container && ((this.container.readAttribute("href") && this.container.readAttribute("href") != "") || (this.options.hover && this.options.hover !== true))) {if (this.options.hover && this.options.hover !== true) {this.sourceContainer = $(this.options.hover);} else {this.sourceContainer = this.container;this.href = this.container.readAttribute("href");var rel = this.href.match(/^#(.+)$/);if (rel && rel[1]) {this.container = $(rel[1]);this.href = false;} else {this.container = false;}}this.sourceContainerOpenHandler = (function (event) {this.open(event);event.stop();return false;}).bindAsEventListener(this);this.sourceContainerCloseHandler = (function (event) {this.close(event);}).bindAsEventListener(this);this.sourceContainerMouseMoveHandler = (function (event) {this.position(event);}).bindAsEventListener(this);if (this.options.hover) {this.sourceContainer.observe("mouseenter", this.sourceContainerOpenHandler);this.sourceContainer.observe("mouseleave", this.sourceContainerCloseHandler);if (this.options.position == "mouse") {this.sourceContainer.observe("mousemove", this.sourceContainerMouseMoveHandler);}} else {this.sourceContainer.observe("click", this.sourceContainerOpenHandler);}}}}this.createDefaultContainer(container);if (this.options.insertRemoteContentAt === false) {this.options.insertRemoteContentAt = this.container;}var styles = {margin:0, position:"absolute", zIndex:Control.Window.initialZIndexForWindow()};if (this.options.width) {styles.width = $value(this.options.width) + "px";}if (this.options.height) {styles.height = $value(this.options.height) + "px";}this.container.setStyle(styles);if (this.options.className) {this.container.addClassName(this.options.className);}this.positionHandler = this.position.bindAsEventListener(this);this.outOfBoundsPositionHandler = this.ensureInBounds.bindAsEventListener(this);this.bringToFrontHandler = this.bringToFront.bindAsEventListener(this);this.container.observe("mousedown", this.bringToFrontHandler);this.container.hide();this.closeHandler = this.close.bindAsEventListener(this);if (this.options.iframeshim) {this.iFrameShim = new IframeShim();this.iFrameShim.hide();}this.applyResizable();this.applyDraggable();Event.observe(window, "resize", this.outOfBoundsPositionHandler);this.notify("afterInitialize");}), open:(function (event) {if (this.isOpen) {this.bringToFront();return false;}if (this.notify("beforeOpen") === false) {return false;}if (this.options.closeOnClick) {if (this.options.closeOnClick === true) {this.closeOnClickContainer = $(document.body);} else {if (this.options.closeOnClick == "container") {this.closeOnClickContainer = this.container;} else {if (this.options.closeOnClick == "overlay") {Control.Overlay.load();this.closeOnClickContainer = Control.Overlay.container;} else {this.closeOnClickContainer = $(this.options.closeOnClick);}}}this.closeOnClickContainer.observe("click", this.closeHandler);}if (this.href && !this.options.iframe && !this.remoteContentLoaded) {this.remoteContentLoaded = true;if (this.href.match(/\.(jpe?g|gif|png|tiff?)$/i)) {var img = new Element("img");img.observe("load", (function (img) {this.getRemoteContentInsertionTarget().insert(img);this.position();if (this.notify("onRemoteContentLoaded") !== false) {if (this.options.indicator) {this.hideIndicator();}this.finishOpen();}}).bind(this, img));img.writeAttribute("src", this.href);} else {if (!this.ajaxRequest) {if (this.options.indicator) {this.showIndicator();}this.ajaxRequest = new Ajax.Request(this.href, {method:"post", parameters:this.options.parameters, onComplete:(function (request) {this.notify("onComplete", request);this.ajaxRequest = false;}).bind(this), onSuccess:(function (request) {this.getRemoteContentInsertionTarget().insert(request.responseText);this.notify("onSuccess", request);if (this.notify("onRemoteContentLoaded") !== false) {if (this.options.indicator) {this.hideIndicator();}this.finishOpen();}}).bind(this), onFailure:(function (request) {this.notify("onFailure", request);if (this.options.indicator) {this.hideIndicator();}}).bind(this), onException:(function (request, e) {this.notify("onException", request, e);if (this.options.indicator) {this.hideIndicator();}}).bind(this)});}}return true;} else {if (this.options.iframe && !this.remoteContentLoaded) {this.remoteContentLoaded = true;if (this.options.indicator) {this.showIndicator();}this.getRemoteContentInsertionTarget().insert(Control.Window.iframeTemplate.evaluate({href:this.href}));var iframe = this.container.down("iframe");iframe.onload = (function () {this.notify("onRemoteContentLoaded");if (this.options.indicator) {this.hideIndicator();}iframe.onload = null;}).bind(this);}}this.finishOpen(event);return true;}), close:(function (event) {if (!this.isOpen || this.notify("beforeClose", event) === false) {return false;}if (this.options.closeOnClick) {this.closeOnClickContainer.stopObserving("click", this.closeHandler);}if (this.options.fade) {this.effects.fade = new Effect.Fade(this.container, {queue:{position:"front", scope:"Control.Window" + this.numberInSequence}, from:1, to:0, duration:this.options.fadeDuration / 2, afterFinish:(function () {if (this.iFrameShim) {this.iFrameShim.hide();}this.isOpen = false;this.notify("afterClose");}).bind(this)});} else {this.container.hide();if (this.iFrameShim) {this.iFrameShim.hide();}}if (this.ajaxRequest) {this.ajaxRequest.transport.abort();}if (!(this.options.draggable || this.options.resizable) && this.options.position == "center") {Event.stopObserving(window, "resize", this.positionHandler);}if (!this.options.draggable && this.options.position == "center") {Event.stopObserving(window, "scroll", this.positionHandler);}if (this.options.indicator) {this.hideIndicator();}if (!this.options.fade) {this.isOpen = false;this.notify("afterClose");}return true;}), position:(function (event) {if (this.options.position == "mouse") {var xy = [Event.pointerX(event), Event.pointerY(event)];this.container.setStyle({top:xy[1] + $value(this.options.offsetTop) + "px", left:xy[0] + $value(this.options.offsetLeft) + "px"});return;}var container_dimensions = this.container.getDimensions();var viewport_dimensions = document.viewport.getDimensions();Position.prepare();var offset_left = (Position.deltaX + Math.floor((viewport_dimensions.width - container_dimensions.width) / 2));var offset_top = (Position.deltaY + ((viewport_dimensions.height > container_dimensions.height) ? Math.floor((viewport_dimensions.height - container_dimensions.height) / 2) : 0));if (this.options.position == "center") {this.container.setStyle({top:(container_dimensions.height <= viewport_dimensions.height) ? ((offset_top != null && offset_top > 0) ? offset_top : 0) + "px" : 0, left:(container_dimensions.width <= viewport_dimensions.width) ? ((offset_left != null && offset_left > 0) ? offset_left : 0) + "px" : 0});} else {if (this.options.position == "relative") {var xy = this.sourceContainer.cumulativeOffset();var top = xy[1] + $value(this.options.offsetTop);var left = xy[0] + $value(this.options.offsetLeft);this.container.setStyle({top:(container_dimensions.height <= viewport_dimensions.height) ? (this.options.constrainToViewport ? Math.max(0, Math.min(viewport_dimensions.height - (container_dimensions.height), top)) : top) + "px" : 0, left:(container_dimensions.width <= viewport_dimensions.width) ? (this.options.constrainToViewport ? Math.max(0, Math.min(viewport_dimensions.width - (container_dimensions.width), left)) : left) + "px" : 0});} else {if (this.options.position.length) {var top = $value(this.options.position[1]) + $value(this.options.offsetTop);var left = $value(this.options.position[0]) + $value(this.options.offsetLeft);this.container.setStyle({top:(container_dimensions.height <= viewport_dimensions.height) ? (this.options.constrainToViewport ? Math.max(0, Math.min(viewport_dimensions.height - (container_dimensions.height), top)) : top) + "px" : 0, left:(container_dimensions.width <= viewport_dimensions.width) ? (this.options.constrainToViewport ? Math.max(0, Math.min(viewport_dimensions.width - (container_dimensions.width), left)) : left) + "px" : 0});}}}if (this.iFrameShim) {this.updateIFrameShimZIndex();}}), ensureInBounds:(function () {var viewport_dimensions = document.viewport.getDimensions();var container_offset = this.container.cumulativeOffset();var container_dimensions = this.container.getDimensions();if (container_offset.left + container_dimensions.width > viewport_dimensions.width) {this.container.setStyle({left:(Math.max(0, viewport_dimensions.width - container_dimensions.width)) + "px"});}if (container_offset.top + container_dimensions.height > viewport_dimensions.height) {this.container.setStyle({top:(Math.max(0, viewport_dimensions.height - container_dimensions.height)) + "px"});}}), bringToFront:(function () {Control.Window.bringToFront(this);this.notify("bringToFront");}), destroy:(function () {this.container.stopObserving("mousedown", this.bringToFrontHandler);if (this.draggable) {Resizables.removeObserver(this.container);this.draggable.handle.stopObserving("mousedown", this.bringToFrontHandler);this.draggable.destroy();}if (this.resizable) {Resizables.removeObserver(this.container);this.resizable.handle.stopObserving("mousedown", this.bringToFrontHandler);this.resizable.destroy();}if (this.container && !this.sourceContainer) {this.container.remove();}if (this.sourceContainer) {if (this.options.hover) {this.sourceContainer.stopObserving("mouseenter", this.sourceContainerOpenHandler);this.sourceContainer.stopObserving("mouseleave", this.sourceContainerCloseHandler);if (this.options.position == "mouse") {this.sourceContainer.stopObserving("mousemove", this.sourceContainerMouseMoveHandler);}} else {this.sourceContainer.stopObserving("click", this.sourceContainerOpenHandler);}}if (this.iFrameShim) {this.iFrameShim.destroy();}Event.stopObserving(window, "resize", this.outOfBoundsPositionHandler);Control.Window.windows = Control.Window.windows.without(this);this.notify("afterDestroy");}), applyResizable:(function () {if (this.options.resizable) {if (typeof (Resizable) == "undefined") {throw "Control.Window requires resizable.js to be loaded.";}var resizable_handle = null;if (this.options.resizable === true) {resizable_handle = new Element("div", {className:"resizable_handle"});this.container.insert(resizable_handle);} else {resizable_handle = $(this.options.resziable);}this.resizable = new Resizable(this.container, {handle:resizable_handle, minHeight:this.options.minHeight, minWidth:this.options.minWidth, maxHeight:this.options.constrainToViewport ? (function (element) {return (document.viewport.getDimensions().height - parseInt(element.style.top || 0)) - (element.getHeight() - parseInt(element.style.height || 0));}) : this.options.maxHeight, maxWidth:this.options.constrainToViewport ? (function (element) {return (document.viewport.getDimensions().width - parseInt(element.style.left || 0)) - (element.getWidth() - parseInt(element.style.width || 0));}) : this.options.maxWidth});this.resizable.handle.observe("mousedown", this.bringToFrontHandler);Resizables.addObserver(new Control.Window.LayoutUpdateObserver(this, (function () {if (this.iFrameShim) {this.updateIFrameShimZIndex();}this.notify("onResize");}).bind(this)));}}), applyDraggable:(function () {if (this.options.draggable) {if (typeof (Draggables) == "undefined") {throw "Control.Window requires dragdrop.js to be loaded.";}var draggable_handle = null;if (this.options.draggable === true) {draggable_handle = new Element("div", {className:"draggable_handle"});this.container.insert(draggable_handle);} else {draggable_handle = $(this.options.draggable);}this.draggable = new Draggable(this.container, {handle:draggable_handle, constrainToViewport:this.options.constrainToViewport, zindex:this.container.getStyle("z-index"), starteffect:(function () {if (Prototype.Browser.IE) {this.old_onselectstart = document.onselectstart;document.onselectstart = (function () {return false;});}}).bind(this), endeffect:(function () {document.onselectstart = this.old_onselectstart;}).bind(this)});this.draggable.handle.observe("mousedown", this.bringToFrontHandler);Draggables.addObserver(new Control.Window.LayoutUpdateObserver(this, (function () {if (this.iFrameShim) {this.updateIFrameShimZIndex();}this.notify("onDrag");}).bind(this)));}}), createDefaultContainer:(function (container) {if (!this.container) {this.container = new Element("div", {id:"control_window_" + this.numberInSequence});$(document.body).insert(this.container);if (typeof (container) == "string" && $(container) == null && !container.match(/^#(.+)$/) && !container.match(Control.Window.uriRegex)) {this.container.update(container);}}}), finishOpen:(function (event) {this.bringToFront();if (this.options.fade) {if (typeof (Effect) == "undefined") {throw "Control.Window requires effects.js to be loaded.";}if (this.effects.fade) {this.effects.fade.cancel();}this.effects.appear = new Effect.Appear(this.container, {queue:{position:"end", scope:"Control.Window." + this.numberInSequence}, from:0, to:1, duration:this.options.fadeDuration / 2, afterFinish:(function () {if (this.iFrameShim) {this.updateIFrameShimZIndex();}this.isOpen = true;this.notify("afterOpen");}).bind(this)});} else {this.container.show();}this.position(event);if (!(this.options.draggable || this.options.resizable) && this.options.position == "center") {Event.observe(window, "resize", this.positionHandler, false);}if (!this.options.draggable && this.options.position == "center") {Event.observe(window, "scroll", this.positionHandler, false);}if (!this.options.fade) {this.isOpen = true;this.notify("afterOpen");}return true;}), showIndicator:(function () {this.showIndicatorTimeout = window.setTimeout((function () {if (this.options.fade) {this.indicatorEffects.appear = new Effect.Appear(this.indicator, {queue:{position:"front", scope:"Control.Window.indicator." + this.numberInSequence}, from:0, to:1, duration:this.options.fadeDuration / 2});} else {this.indicator.show();}}).bind(this), Control.Window.indicatorTimeout);}), hideIndicator:(function () {if (this.showIndicatorTimeout) {window.clearTimeout(this.showIndicatorTimeout);}this.indicator.hide();}), getRemoteContentInsertionTarget:(function () {return typeof (this.options.insertRemoteContentAt) == "string" ? this.container.down(this.options.insertRemoteContentAt) : $(this.options.insertRemoteContentAt);}), updateIFrameShimZIndex:(function () {if (this.iFrameShim) {this.iFrameShim.positionUnder(this.container);}})});
Object.extend(Control.Window, {windows:[], baseZIndex:9999, indicatorTimeout:250, iframeTemplate:new Template("<iframe src=\"#{href}\" width=\"100%\" height=\"100%\" frameborder=\"0\"></iframe>"), uriRegex:/^(\/|\#|https?\:\/\/|[\w]+\/)/, bringToFront:(function (w) {Control.Window.windows = Control.Window.windows.without(w);Control.Window.windows.push(w);Control.Window.windows.each((function (w, i) {var z_index = Control.Window.baseZIndex + i;w.container.setStyle({zIndex:z_index});if (w.isOpen) {if (w.iFrameShim) {w.updateIFrameShimZIndex();}}if (w.options.draggable) {w.draggable.options.zindex = z_index;}}));}), open:(function (container, options) {var w = new Control.Window(container, options);w.open();return w;}), initialZIndexForWindow:(function (w) {return Control.Window.baseZIndex + (Control.Window.windows.length - 1);})});
Object.Event.extend(Control.Window);
Control.Window.LayoutUpdateObserver = Class.create({initialize:(function (w, observer) {this.w = w;this.element = $(w.container);this.observer = observer;}), onStart:Prototype.emptyFunction, onEnd:(function (event_name, instance) {if (instance.element == this.element && this.iFrameShim) {this.w.updateIFrameShimZIndex();}}), onResize:(function (event_name, instance) {if (instance.element == this.element) {this.observer(this.element);}}), onDrag:(function (event_name, instance) {if (instance.element == this.element) {this.observer(this.element);}})});
Control.Overlay = {id:"control_overlay", loaded:false, container:false, lastOpacity:0, styles:{position:"fixed", top:0, left:0, width:"100%", height:"100%", zIndex:9998}, ieStyles:{position:"absolute", top:0, left:0, zIndex:9998}, effects:{fade:false, appear:false}, load:(function () {if (Control.Overlay.loaded) {return false;}Control.Overlay.loaded = true;Control.Overlay.container = new Element("div", {id:Control.Overlay.id});$(document.body).insert(Control.Overlay.container);if (Prototype.Browser.IE) {Control.Overlay.container.setStyle(Control.Overlay.ieStyles);Event.observe(window, "resize", Control.Overlay.positionOverlay);Control.Overlay.observe("beforeShow", Control.Overlay.positionOverlay);} else {Control.Overlay.container.setStyle(Control.Overlay.styles);}Control.Overlay.iFrameShim = new IframeShim();Control.Overlay.iFrameShim.hide();Event.observe(window, "resize", Control.Overlay.positionIFrameShim);Control.Overlay.container.hide();return true;}), unload:(function () {if (!Control.Overlay.loaded) {return false;}Event.stopObserving(window, "resize", Control.Overlay.positionOverlay);Control.Overlay.stopObserving("beforeShow", Control.Overlay.positionOverlay);Event.stopObserving(window, "resize", Control.Overlay.positionIFrameShim);Control.Overlay.iFrameShim.destroy();Control.Overlay.container.remove();Control.Overlay.loaded = false;return true;}), show:(function (opacity, fade) {if (Control.Overlay.notify("beforeShow") === false) {return false;}Control.Overlay.lastOpacity = opacity;Control.Overlay.positionIFrameShim();Control.Overlay.iFrameShim.show();if (fade) {if (typeof (Effect) == "undefined") {throw "Control.Window requires effects.js to be loaded.";}if (Control.Overlay.effects.fade) {Control.Overlay.effects.fade.cancel();}Control.Overlay.effects.appear = new Effect.Appear(Control.Overlay.container, {queue:{position:"end", scope:"Control.Overlay"}, afterFinish:(function () {Control.Overlay.notify("afterShow");}), from:0, to:Control.Overlay.lastOpacity, duration:(fade === true ? 0.75 : fade) / 2});} else {Control.Overlay.container.setStyle({opacity:opacity || 1});Control.Overlay.container.show();Control.Overlay.notify("afterShow");}return true;}), hide:(function (fade) {if (Control.Overlay.notify("beforeHide") === false) {return false;}if (Control.Overlay.effects.appear) {Control.Overlay.effects.appear.cancel();}Control.Overlay.iFrameShim.hide();if (fade) {Control.Overlay.effects.fade = new Effect.Fade(Control.Overlay.container, {queue:{position:"front", scope:"Control.Overlay"}, afterFinish:(function () {Control.Overlay.notify("afterHide");}), from:Control.Overlay.lastOpacity, to:0, duration:(fade === true ? 0.75 : fade) / 2});} else {Control.Overlay.container.hide();Control.Overlay.notify("afterHide");}return true;}), positionIFrameShim:(function () {Control.Overlay.iFrameShim.positionUnder(Control.Overlay.container);}), positionOverlay:(function () {var dimensions = document.viewport.getDimensions();Control.Overlay.container.setStyle({width:dimensions.width + "px", height:dimensions.height + "px"});})};
Object.Event.extend(Control.Overlay);
Control.ToolTip = Class.create(Control.Window, {initialize:(function ($super, container, tooltip, options) {$super(tooltip, Object.extend(Object.extend(Control.ToolTip.defaultOptions, options || {}), {position:"mouse", hover:container}));})});
Object.extend(Control.ToolTip, {defaultOptions:{offsetLeft:10}});
Control.Modal = Class.create(Control.Window, {initialize:(function ($super, container, options) {Control.Modal.InstanceMethods.beforeInitialize.bind(this)();$super(container, Object.extend(Control.Modal.defaultOptions, options || {}));})});
Object.extend(Control.Modal, {defaultOptions:{overlayOpacity:0.5, closeOnClick:"overlay"}, current:false, open:(function (container, options) {var modal = new Control.Modal(container, options);modal.open();return modal;}), close:(function () {if (Control.Modal.current) {Control.Modal.current.close();}}), InstanceMethods:{beforeInitialize:(function () {Control.Overlay.load();this.overlayFinishedOpening = false;this.observe("beforeOpen", Control.Modal.Observers.beforeOpen.bind(this));this.observe("afterOpen", Control.Modal.Observers.afterOpen.bind(this));this.observe("afterClose", Control.Modal.Observers.afterClose.bind(this));})}, Observers:{beforeOpen:(function () {if (!this.overlayFinishedOpening) {Control.Overlay.observeOnce("afterShow", (function () {this.overlayFinishedOpening = true;this.open();}).bind(this));Control.Overlay.show(this.options.overlayOpacity, this.options.fade ? this.options.fadeDuration : false);throw $break;} else {Control.Window.windows.without(this).invoke("close");}}), afterOpen:(function () {Control.Modal.current = this;}), afterClose:(function () {Control.Overlay.hide(this.options.fade ? this.options.fadeDuration : false);Control.Modal.current = false;this.overlayFinishedOpening = false;})}});
Control.LightBox = Class.create(Control.Window, {initialize:(function ($super, container, options) {this.allImagesLoaded = false;if (options.modal) {var options = Object.extend(Control.LightBox.defaultOptions, options || {});options = Object.extend(Control.Modal.defaultOptions, options);options = Control.Modal.InstanceMethods.beforeInitialize.bind(this)(options);$super(container, options);} else {$super(container, Object.extend(Control.LightBox.defaultOptions, options || {}));}this.hasRemoteContent = this.href && !this.options.iframe;if (this.hasRemoteContent) {this.observe("onRemoteContentLoaded", Control.LightBox.Observers.onRemoteContentLoaded.bind(this));} else {this.applyImageObservers();}this.observe("beforeOpen", Control.LightBox.Observers.beforeOpen.bind(this));}), applyImageObservers:(function () {var images = this.getImages();this.numberImagesToLoad = images.length;this.numberofImagesLoaded = 0;images.each((function (image) {image.observe("load", (function (image) {++this.numberofImagesLoaded;if (this.numberImagesToLoad == this.numberofImagesLoaded) {this.allImagesLoaded = true;this.onAllImagesLoaded();}}).bind(this, image));image.hide();}).bind(this));}), onAllImagesLoaded:(function () {this.getImages().each((function (image) {this.showImage(image);}).bind(this));if (this.hasRemoteContent) {if (this.options.indicator) {this.hideIndicator();}this.finishOpen();} else {this.open();}}), getImages:(function () {return this.container.select(Control.LightBox.imageSelector);}), showImage:(function (image) {image.show();})});
Object.extend(Control.LightBox, {imageSelector:"img", defaultOptions:{}, Observers:{beforeOpen:(function () {if (!this.hasRemoteContent && !this.allImagesLoaded) {throw $break;}}), onRemoteContentLoaded:(function () {this.applyImageObservers();if (!this.allImagesLoaded) {throw $break;}})}});
if (typeof (Prototype) == "undefined") {
    throw "Control.ScrollBar requires Prototype to be loaded.";
}
if (typeof (Control.Slider) == "undefined") {
    throw "Control.ScrollBar requires Control.Slider to be loaded.";
}
if (typeof (Object.Event) == "undefined") {
    throw "Control.ScrollBar requires Object.Event to be loaded.";
}
Control.ScrollBar = Class.create({initialize:(function (container, track, options) {this.enabled = false;this.notificationTimeout = false;this.container = $(container);this.boundMouseWheelEvent = this.onMouseWheel.bindAsEventListener(this);this.boundResizeObserver = this.onWindowResize.bind(this);this.track = $(track);this.handle = this.track.firstDescendant();this.options = Object.extend({active_class_name:"scrolling", apply_active_class_name_to:this.container, notification_timeout_length:125, handle_minimum_height:25, scroll_to_smoothing:0.01, scroll_to_steps:15, proportional:true, slider_options:{}}, options || {});this.slider = new Control.Slider(this.handle, this.track, Object.extend({axis:"vertical", onSlide:this.onChange.bind(this), onChange:this.onChange.bind(this)}, this.options.slider_options));this.recalculateLayout();Event.observe(window, "resize", this.boundResizeObserver);this.handle.observe("mousedown", (function () {if (this.auto_sliding_executer) {this.auto_sliding_executer.stop();}}).bind(this));}), destroy:(function () {Event.stopObserving(window, "resize", this.boundResizeObserver);}), enable:(function () {this.enabled = true;this.container.observe("mouse:wheel", this.boundMouseWheelEvent);this.slider.setEnabled();this.track.show();if (this.options.active_class_name) {$(this.options.apply_active_class_name_to).addClassName(this.options.active_class_name);}this.notify("enabled");}), disable:(function () {this.enabled = false;this.container.stopObserving("mouse:wheel", this.boundMouseWheelEvent);this.slider.setDisabled();this.track.hide();if (this.options.active_class_name) {$(this.options.apply_active_class_name_to).removeClassName(this.options.active_class_name);}this.notify("disabled");this.reset();}), reset:(function () {this.slider.setValue(0);}), recalculateLayout:(function () {if (this.container.scrollHeight <= this.container.offsetHeight) {this.disable();} else {this.slider.trackLength = this.slider.maximumOffset() - this.slider.minimumOffset();if (this.options.proportional) {this.handle.style.height = Math.max(this.container.offsetHeight * (this.container.offsetHeight / this.container.scrollHeight), this.options.handle_minimum_height) + "px";this.slider.handleLength = this.handle.style.height.replace(/px/, "");}this.enable();}}), onWindowResize:(function () {this.recalculateLayout();this.scrollBy(0);}), onMouseWheel:(function (event) {if (this.auto_sliding_executer) {this.auto_sliding_executer.stop();}this.slider.setValueBy(-(event.memo.delta / 20));event.stop();return false;}), onChange:(function (value) {this.container.scrollTop = Math.round(value / this.slider.maximum * (this.container.scrollHeight - this.container.offsetHeight));if (this.notification_timeout) {window.clearTimeout(this.notificationTimeout);}this.notificationTimeout = window.setTimeout((function () {this.notify("change", value);}).bind(this), this.options.notification_timeout_length);}), getCurrentMaximumDelta:(function () {return this.slider.maximum * (this.container.scrollHeight - this.container.offsetHeight);}), getDeltaToElement:(function (element) {return this.slider.maximum * ((element.positionedOffset().top + (element.getHeight() / 2)) - (this.container.getHeight() / 2));}), scrollTo:(function (y, animate) {var current_maximum_delta = this.getCurrentMaximumDelta();if (y == "top") {y = 0;} else {if (y == "bottom") {y = current_maximum_delta;} else {if (typeof (y) != "number") {y = this.getDeltaToElement($(y));}}}if (this.enabled) {y = Math.max(0, Math.min(y, current_maximum_delta));if (this.auto_sliding_executer) {this.auto_sliding_executer.stop();}var target_value = y / current_maximum_delta;var original_slider_value = this.slider.value;var delta = (target_value - original_slider_value) * current_maximum_delta;if (animate) {this.auto_sliding_executer = new PeriodicalExecuter((function () {if (Math.round(this.slider.value * 100) / 100 < Math.round(target_value * 100) / 100 || Math.round(this.slider.value * 100) / 100 > Math.round(target_value * 100) / 100) {this.scrollBy(delta / this.options.scroll_to_steps);} else {this.auto_sliding_executer.stop();this.auto_sliding_executer = null;if (typeof (animate) == "function") {animate();}}}).bind(this), this.options.scroll_to_smoothing);} else {this.scrollBy(delta);}} else {if (typeof (animate) == "function") {animate();}}}), scrollBy:(function (y) {if (!this.enabled) {return false;}this.slider.setValueBy(y / this.getCurrentMaximumDelta());})});
Object.Event.extend(Control.ScrollBar);
Control.Scroller = Class.create({initialize:(function (content, handle, track, options) {this.scrollers = [];this.id = "scroller";this.content = $(content);this.handle = $(handle);this.track = $(track);this.currentValue = 0;this.options = $H({axis:"vertical", onChange:(function (value) {self.updateView(value);}), onSlide:(function (value) {self.updateView(value);})}).merge(options);var self = this;this.options = this.options.merge({scrollOnHover:false, visibleHeight:this.isVertical() ? 300 : this.content.offsetHeight, visibleWidth:this.isVertical() ? this.content.offsetWidth : 300, delta:20, autoHide:true, interval:100}).toObject();this.maxValue = this.isVertical() ? this.content.offsetHeight - this.options.visibleHeight - this.handle.offsetHeight : this.content.offsetWidth - this.options.visibleWidth - this.handle.offsetWidth;this.options.range = $R(0, this.maxValue);this.buttons = {up:$(this.options.up), down:$(this.options.down)};if ((this.isVertical() && this.content.offsetHeight <= this.options.visibleHeight) || (!this.isVertical() && this.content.offsetWidth <= this.options.visibleWidth)) {if (this.options.autoHide) {[this.track, this.handle, this.buttons.up, this.buttons.down].invoke("hide");}return;}this.content.style.height = this.options.visibleHeight + "px";this.eventMouseAction = this.buttonAction.bindAsEventListener(this);$H(this.buttons).values().each((function (button) {if (self.options.scrollOnHover) {Event.observe(button, "mouseover", self.eventMouseAction);Event.observe(button, "mouseout", self.eventMouseAction);} else {Event.observe(button, "mousedown", self.eventMouseAction);Event.observe(button, "mouseup", self.eventMouseAction);}}));this.slider = new Control.Slider(this.handle, this.track, this.options);}), isVertical:(function () {return this.options.axis == "vertical";}), buttonAction:(function (e) {this.multiplier = Event.element(e) == this.buttons.up ? -1 : 1;switch (e.type) {case "mouseover":case "mousedown":this.scroll();var self = this;this.timer = setInterval((function () {self.scroll();}), self.options.interval);break;case "mouseout":case "mouseup":clearTimeout(this.timer);break;default:;}}), scroll:(function () {this.slider.setValue(this.currentValue + this.options.delta * this.multiplier, 0);}), updateView:(function (value) {this.currentValue = value;if (this.options.axis == "vertical") {this.content.style.marginTop = (-this.currentValue) + "px";this.content.style.height = (this.options.visibleHeight + this.currentValue) + "px";this.content.style.clip = "rect(" + value + "px " + this.options.visibleWidth + "px " + (this.options.visibleHeight + this.currentValue) + "px 0px)";} else {this.content.style.marginLeft = (-this.currentValue) + "px";this.content.style.clip = "rect(0 " + (this.options.visibleHeight + this.currentValue) + "px " + this.options.visibleHeight + "px " + value + "px)";}(this.options.onScroll || Prototype.emptyFunction)(value, this);})});
var FastInit = {onload:(function () {if (FastInit.done) {return;}FastInit.done = true;for (var x = 0, al = FastInit.f.length; x < al; x++) {FastInit.f[x]();}}), addOnLoad:(function () {var a = arguments;for (var x = 0, al = a.length; x < al; x++) {if (typeof a[x] === "function") {if (FastInit.done) {a[x]();} else {FastInit.f.push(a[x]);}}}}), listen:(function () {if (/WebKit|khtml/i.test(navigator.userAgent)) {FastInit.timer = setInterval((function () {if (/loaded|complete/.test(document.readyState)) {clearInterval(FastInit.timer);delete FastInit.timer;FastInit.onload();}}), 10);} else {if (document.addEventListener) {document.addEventListener("DOMContentLoaded", FastInit.onload, false);} else {if (!FastInit.iew32) {if (window.addEventListener) {window.addEventListener("load", FastInit.onload, false);} else {if (window.attachEvent) {return window.attachEvent("onload", FastInit.onload);}}}}}}), f:[], done:false, timer:null, iew32:false};
FastInit.listen();

