// MooTools: the javascript framework.
// Load this file's selection again by visiting: http://mootools.net/more/c4b916f4ebdf6edbd14015ca2c0c0059 
// Or build this file again with packager using: packager build More/Fx.Reveal More/Slider
/*
---
copyrights:
- [MooTools](http://mootools.net)

licenses:
- [MIT License](http://mootools.net/license.txt)
...
*/
MooTools.More = { version: "1.3.1.1", build: "0292a3af1eea242b817fecf9daa127417d10d4ce" }; Element.implement({ isDisplayed: function () {
	return this.getStyle("display") != "none";
}, isVisible: function () { var a = this.offsetWidth, b = this.offsetHeight; return (a == 0 && b == 0) ? false : (a > 0 && b > 0) ? true : this.style.display != "none"; }, toggle: function () {
	return this[this.isDisplayed() ? "hide" : "show"]();
}, hide: function () {
	var b; try { b = this.getStyle("display"); } catch (a) { } if (b == "none") { return this; } return this.store("element:_originalDisplay", b || "").setStyle("display", "none");
}, show: function (a) {
	if (!a && this.isDisplayed()) { return this; } a = a || this.retrieve("element:_originalDisplay") || "block"; return this.setStyle("display", (a == "none") ? "block" : a);
}, swapClass: function (a, b) { return this.removeClass(a).addClass(b); } 
}); Document.implement({ clearSelection: function () {
	if (window.getSelection) {
		var a = window.getSelection();
		if (a && a.removeAllRanges) { a.removeAllRanges(); } 
	} else { if (document.selection && document.selection.empty) { try { document.selection.empty(); } catch (b) { } } } 
} 
}); (function () {
	var b = function (e, d) {
		var f = [];
		Object.each(d, function (g) { Object.each(g, function (h) { e.each(function (i) { f.push(i + "-" + h + (i == "border" ? "-width" : "")); }); }); }); return f;
	}; var c = function (f, e) {
		var d = 0;
		Object.each(e, function (h, g) { if (g.test(f)) { d = d + h.toInt(); } }); return d;
	}; var a = function (d) { return !!(!d || d.offsetHeight || d.offsetWidth); }; Element.implement({ measure: function (h) {
		if (a(this)) {
			return h.call(this);
		} var g = this.getParent(), e = []; while (!a(g) && g != document.body) { e.push(g.expose()); g = g.getParent(); } var f = this.expose(), d = h.call(this); f(); e.each(function (i) {
			i();
		}); return d;
	}, expose: function () {
		if (this.getStyle("display") != "none") { return function () { }; } var d = this.style.cssText; this.setStyles({ display: "block", position: "absolute", visibility: "hidden" });
		return function () { this.style.cssText = d; } .bind(this);
	}, getDimensions: function (d) {
		d = Object.merge({ computeSize: false }, d); var i = { x: 0, y: 0 }; var h = function (j, e) {
			return (e.computeSize) ? j.getComputedSize(e) : j.getSize();
		}; var f = this.getParent("body"); if (f && this.getStyle("display") == "none") { i = this.measure(function () { return h(this, d); }); } else { if (f) { try { i = h(this, d); } catch (g) { } } } return Object.append(i, (i.x || i.x === 0) ? { width: i.x, height: i.y} : { x: i.width, y: i.height });
	}, getComputedSize: function (d) {
		d = Object.merge({ styles: ["padding", "border"], planes: { height: ["top", "bottom"], width: ["left", "right"] }, mode: "both" }, d); var g = {}, e = { width: 0, height: 0 }, f;
		if (d.mode == "vertical") { delete e.width; delete d.planes.width; } else { if (d.mode == "horizontal") { delete e.height; delete d.planes.height; } } b(d.styles, d.planes).each(function (h) {
			g[h] = this.getStyle(h).toInt();
		}, this); Object.each(d.planes, function (i, h) {
			var k = h.capitalize(), j = this.getStyle(h); if (j == "auto" && !f) { f = this.getDimensions(); } j = g[h] = (j == "auto") ? f[h] : j.toInt();
			e["total" + k] = j; i.each(function (m) { var l = c(m, g); e["computed" + m.capitalize()] = l; e["total" + k] += l; });
		}, this); return Object.append(e, g);
	} 
	});
}).call(this); (function () {
	var a = function (d) {
		var b = d.options.hideInputs;
		if (window.OverText) { var c = [null]; OverText.each(function (e) { c.include("." + e.options.labelClass); }); if (c) { b += c.join(", "); } } return (b) ? d.element.getElements(b) : null;
	}; Fx.Reveal = new Class({ Extends: Fx.Morph, options: { link: "cancel", styles: ["padding", "border", "margin"], transitionOpacity: !Browser.ie6, mode: "vertical", display: function () {
		return this.element.get("tag") != "tr" ? "block" : "table-row";
	}, opacity: 1, hideInputs: Browser.ie ? "select, input, textarea, object, embed" : null
	}, dissolve: function () {
		if (!this.hiding && !this.showing) {
			if (this.element.getStyle("display") != "none") {
				this.hiding = true;
				this.showing = false; this.hidden = true; this.cssText = this.element.style.cssText; var d = this.element.getComputedSize({ styles: this.options.styles, mode: this.options.mode });
				if (this.options.transitionOpacity) { d.opacity = this.options.opacity; } var c = {}; Object.each(d, function (f, e) { c[e] = [f, 0]; }); this.element.setStyles({ display: Function.from(this.options.display).call(this), overflow: "hidden" });
				var b = a(this); if (b) { b.setStyle("visibility", "hidden"); } this.$chain.unshift(function () {
					if (this.hidden) {
						this.hiding = false; this.element.style.cssText = this.cssText;
						this.element.setStyle("display", "none"); if (b) { b.setStyle("visibility", "visible"); } 
					} this.fireEvent("hide", this.element); this.callChain();
				} .bind(this)); this.start(c);
			} else { this.callChain.delay(10, this); this.fireEvent("complete", this.element); this.fireEvent("hide", this.element); } 
		} else {
			if (this.options.link == "chain") {
				this.chain(this.dissolve.bind(this));
			} else { if (this.options.link == "cancel" && !this.hiding) { this.cancel(); this.dissolve(); } } 
		} return this;
	}, reveal: function () {
		if (!this.showing && !this.hiding) {
			if (this.element.getStyle("display") == "none") {
				this.hiding = false;
				this.showing = true; this.hidden = false; this.cssText = this.element.style.cssText; var d; this.element.measure(function () {
					d = this.element.getComputedSize({ styles: this.options.styles, mode: this.options.mode });
				} .bind(this)); if (this.options.heightOverride != null) { d.height = this.options.heightOverride.toInt(); } if (this.options.widthOverride != null) {
					d.width = this.options.widthOverride.toInt();
				} if (this.options.transitionOpacity) { this.element.setStyle("opacity", 0); d.opacity = this.options.opacity; } var c = { height: 0, display: Function.from(this.options.display).call(this) };
				Object.each(d, function (f, e) { c[e] = 0; }); c.overflow = "hidden"; this.element.setStyles(c); var b = a(this); if (b) { b.setStyle("visibility", "hidden"); } this.$chain.unshift(function () {
					this.element.style.cssText = this.cssText;
					this.element.setStyle("display", Function.from(this.options.display).call(this)); if (!this.hidden) { this.showing = false; } if (b) {
						b.setStyle("visibility", "visible");
					} this.callChain(); this.fireEvent("show", this.element);
				} .bind(this)); this.start(d);
			} else {
				this.callChain(); this.fireEvent("complete", this.element); this.fireEvent("show", this.element);
			} 
		} else {
			if (this.options.link == "chain") { this.chain(this.reveal.bind(this)); } else {
				if (this.options.link == "cancel" && !this.showing) {
					this.cancel(); this.reveal();
				} 
			} 
		} return this;
	}, toggle: function () { if (this.element.getStyle("display") == "none") { this.reveal(); } else { this.dissolve(); } return this; }, cancel: function () {
		this.parent.apply(this, arguments);
		if (this.cssText != null) { this.element.style.cssText = this.cssText; } this.hiding = false; this.showing = false; return this;
	} 
	}); Element.Properties.reveal = { set: function (b) {
		this.get("reveal").cancel().setOptions(b);
		return this;
	}, get: function () { var b = this.retrieve("reveal"); if (!b) { b = new Fx.Reveal(this); this.store("reveal", b); } return b; } 
	}; Element.Properties.dissolve = Element.Properties.reveal;
	Element.implement({ reveal: function (b) { this.get("reveal").setOptions(b).reveal(); return this; }, dissolve: function (b) {
		this.get("reveal").setOptions(b).dissolve();
		return this;
	}, nix: function (b) {
		var c = Array.link(arguments, { destroy: Type.isBoolean, options: Type.isObject }); this.get("reveal").setOptions(b).dissolve().chain(function () {
			this[c.destroy ? "destroy" : "dispose"]();
		} .bind(this)); return this;
	}, wink: function () {
		var c = Array.link(arguments, { duration: Type.isNumber, options: Type.isObject }); var b = this.get("reveal").setOptions(c.options);
		b.reveal().chain(function () { (function () { b.dissolve(); }).delay(c.duration || 2000); });
	} 
	});
}).call(this); Class.Mutators.Binds = function (a) {
	if (!this.prototype.initialize) {
		this.implement("initialize", function () { });
	} return a;
}; Class.Mutators.initialize = function (a) {
	return function () {
		Array.from(this.Binds).each(function (b) { var c = this[b]; if (c) { this[b] = c.bind(this); } }, this);
		return a.apply(this, arguments);
	};
}; var Drag = new Class({ Implements: [Events, Options], options: { snap: 6, unit: "px", grid: false, style: true, limit: false, handle: false, invert: false, preventDefault: false, stopPropagation: false, modifiers: { x: "left", y: "top"} }, initialize: function () {
	var b = Array.link(arguments, { options: Type.isObject, element: function (c) {
		return c != null;
	} 
	}); this.element = document.id(b.element); this.document = this.element.getDocument(); this.setOptions(b.options || {}); var a = typeOf(this.options.handle); this.handles = ((a == "array" || a == "collection") ? $$(this.options.handle) : document.id(this.options.handle)) || this.element;
	this.mouse = { now: {}, pos: {} }; this.value = { start: {}, now: {} }; this.selection = (Browser.ie) ? "selectstart" : "mousedown"; if (Browser.ie && !Drag.ondragstartFixed) {
		document.ondragstart = Function.from(false);
		Drag.ondragstartFixed = true;
	} this.bound = { start: this.start.bind(this), check: this.check.bind(this), drag: this.drag.bind(this), stop: this.stop.bind(this), cancel: this.cancel.bind(this), eventStop: Function.from(false) };
	this.attach();
}, attach: function () { this.handles.addEvent("mousedown", this.bound.start); return this; }, detach: function () {
	this.handles.removeEvent("mousedown", this.bound.start);
	return this;
}, start: function (a) {
	var k = this.options; if (a.rightClick) { return; } if (k.preventDefault) { a.preventDefault(); } if (k.stopPropagation) {
		a.stopPropagation();
	} this.mouse.start = a.page; this.fireEvent("beforeStart", this.element); var c = k.limit; this.limit = { x: [], y: [] }; var j = this.element.getStyles("left", "right", "top", "bottom");
	this._invert = { x: k.modifiers.x == "left" && j.left == "auto" && !isNaN(j.right.toInt()) && (k.modifiers.x = "right"), y: k.modifiers.y == "top" && j.top == "auto" && !isNaN(j.bottom.toInt()) && (k.modifiers.y = "bottom") };
	var e, g; for (e in k.modifiers) {
		if (!k.modifiers[e]) { continue; } var b = this.element.getStyle(k.modifiers[e]); if (b && !b.match(/px$/)) {
			if (!g) {
				g = this.element.getCoordinates(this.element.getOffsetParent());
			} b = g[k.modifiers[e]];
		} if (k.style) { this.value.now[e] = (b || 0).toInt(); } else { this.value.now[e] = this.element[k.modifiers[e]]; } if (k.invert) {
			this.value.now[e] *= -1;
		} if (this._invert[e]) { this.value.now[e] *= -1; } this.mouse.pos[e] = a.page[e] - this.value.now[e]; if (c && c[e]) {
			var d = 2; while (d--) {
				var f = c[e][d]; if (f || f === 0) {
					this.limit[e][d] = (typeof f == "function") ? f() : f;
				} 
			} 
		} 
	} if (typeOf(this.options.grid) == "number") { this.options.grid = { x: this.options.grid, y: this.options.grid }; } var h = { mousemove: this.bound.check, mouseup: this.bound.cancel };
	h[this.selection] = this.bound.eventStop; this.document.addEvents(h);
}, check: function (a) {
	if (this.options.preventDefault) { a.preventDefault(); } var b = Math.round(Math.sqrt(Math.pow(a.page.x - this.mouse.start.x, 2) + Math.pow(a.page.y - this.mouse.start.y, 2)));
	if (b > this.options.snap) {
		this.cancel(); this.document.addEvents({ mousemove: this.bound.drag, mouseup: this.bound.stop }); this.fireEvent("start", [this.element, a]).fireEvent("snap", this.element);
	} 
}, drag: function (b) {
	var a = this.options; if (a.preventDefault) { b.preventDefault(); } this.mouse.now = b.page; for (var c in a.modifiers) {
		if (!a.modifiers[c]) {
			continue;
		} this.value.now[c] = this.mouse.now[c] - this.mouse.pos[c]; if (a.invert) { this.value.now[c] *= -1; } if (this._invert[c]) { this.value.now[c] *= -1; } if (a.limit && this.limit[c]) {
			if ((this.limit[c][1] || this.limit[c][1] === 0) && (this.value.now[c] > this.limit[c][1])) {
				this.value.now[c] = this.limit[c][1];
			} else { if ((this.limit[c][0] || this.limit[c][0] === 0) && (this.value.now[c] < this.limit[c][0])) { this.value.now[c] = this.limit[c][0]; } } 
		} if (a.grid[c]) {
			this.value.now[c] -= ((this.value.now[c] - (this.limit[c][0] || 0)) % a.grid[c]);
		} if (a.style) { this.element.setStyle(a.modifiers[c], this.value.now[c] + a.unit); } else { this.element[a.modifiers[c]] = this.value.now[c]; } 
	} this.fireEvent("drag", [this.element, b]);
}, cancel: function (a) {
	this.document.removeEvents({ mousemove: this.bound.check, mouseup: this.bound.cancel }); if (a) {
		this.document.removeEvent(this.selection, this.bound.eventStop);
		this.fireEvent("cancel", this.element);
	} 
}, stop: function (b) {
	var a = { mousemove: this.bound.drag, mouseup: this.bound.stop }; a[this.selection] = this.bound.eventStop;
	this.document.removeEvents(a); if (b) { this.fireEvent("complete", [this.element, b]); } 
} 
}); Element.implement({ makeResizable: function (a) {
	var b = new Drag(this, Object.merge({ modifiers: { x: "width", y: "height"} }, a));
	this.store("resizer", b); return b.addEvent("drag", function () { this.fireEvent("resize", b); } .bind(this));
} 
}); var Slider = new Class({ Implements: [Events, Options], Binds: ["clickedElement", "draggedKnob", "scrolledElement"], options: { onTick: function (a) {
	this.setKnobPosition(a);
}, initialStep: 0, snap: false, offset: 0, range: false, wheel: false, steps: 100, mode: "horizontal"
}, initialize: function (f, a, e) {
	this.setOptions(e); e = this.options; this.element = document.id(f);
	a = this.knob = document.id(a); this.previousChange = this.previousEnd = this.step = -1; var b = {}, d = { x: false, y: false }, g; switch (e.mode) {
		case "vertical": this.axis = "y";
			this.property = "top"; this.offset = "offsetHeight"; break; case "horizontal": this.axis = "x"; this.property = "left"; this.offset = "offsetWidth";
	} this.setSliderDimensions();
	this.setRange(e.range); if (a.getStyle("position") == "static") { a.setStyle("position", "relative"); } a.setStyle(this.property, -e.offset); d[this.axis] = this.property;
	b[this.axis] = [-e.offset, this.full - e.offset]; var c = { snap: 0, limit: b, modifiers: d, onDrag: this.draggedKnob, onStart: this.draggedKnob, onBeforeStart: (function () {
		this.isDragging = true;
	}).bind(this), onCancel: function () { this.isDragging = false; } .bind(this), onComplete: function () { this.isDragging = false; this.draggedKnob(); this.end(); } .bind(this)
	};
	if (e.snap) { this.setSnap(c); } this.drag = new Drag(a, c); this.attach(); if (e.initialStep != null) { this.set(e.initialStep); } 
}, attach: function () {
	this.element.addEvent("mousedown", this.clickedElement);
	if (this.options.wheel) { this.element.addEvent("mousewheel", this.scrolledElement); } this.drag.attach(); return this;
}, detach: function () {
	this.element.removeEvent("mousedown", this.clickedElement).element.removeEvent("mousewheel", this.scrolledElement);
	this.drag.detach(); return this;
}, autosize: function () {
	this.setSliderDimensions().setKnobPosition(this.toPosition(this.step)); this.drag.options.limit[this.axis] = [-this.options.offset, this.full - this.options.offset];
	if (this.options.snap) { this.setSnap(); } return this;
}, setSnap: function (a) {
	if (!a) { a = this.drag.options; } a.grid = Math.ceil(this.stepWidth); a.limit[this.axis][1] = this.full;
	return this;
}, setKnobPosition: function (a) { if (this.options.snap) { a = this.toPosition(this.step); } this.knob.setStyle(this.property, a); return this; }, setSliderDimensions: function () {
	this.full = this.element.measure(function () {
		this.half = this.knob[this.offset] / 2;
		return this.element[this.offset] - this.knob[this.offset] + (this.options.offset * 2);
	} .bind(this)); return this;
}, set: function (a) {
	if (!((this.range > 0) ^ (a < this.min))) {
		a = this.min;
	} if (!((this.range > 0) ^ (a > this.max))) { a = this.max; } this.step = Math.round(a); return this.checkStep().fireEvent("tick", this.toPosition(this.step)).end();
}, setRange: function (a, b) {
	this.min = Array.pick([a[0], 0]);
	this.max = Array.pick([a[1], this.options.steps]); this.range = this.max - this.min; this.steps = this.options.steps || this.full; this.stepSize = Math.abs(this.range) / this.steps;
	this.stepWidth = this.stepSize * this.full / Math.abs(this.range); if (a) { this.set(Array.pick([b, this.step]).floor(this.min).max(this.max)); } return this;
}, clickedElement: function (c) {
	if (this.isDragging || c.target == this.knob) {
		return;
	} var b = this.range < 0 ? -1 : 1, a = c.page[this.axis] - this.element.getPosition()[this.axis] - this.half; a = a.limit(-this.options.offset, this.full - this.options.offset);
	this.step = Math.round(this.min + b * this.toStep(a)); this.checkStep().fireEvent("tick", a).end();
}, scrolledElement: function (a) {
	var b = (this.options.mode == "horizontal") ? (a.wheel < 0) : (a.wheel > 0);
	this.set(this.step + (b ? -1 : 1) * this.stepSize); a.stop();
}, draggedKnob: function () {
	var b = this.range < 0 ? -1 : 1, a = this.drag.value.now[this.axis]; a = a.limit(-this.options.offset, this.full - this.options.offset);
	this.step = Math.round(this.min + b * this.toStep(a)); this.checkStep();
}, checkStep: function () {
	var a = this.step; if (this.previousChange != a) {
		this.previousChange = a;
		this.fireEvent("change", a);
	} return this;
}, end: function () {
	var a = this.step; if (this.previousEnd !== a) { this.previousEnd = a; this.fireEvent("complete", a + ""); } return this;
}, toStep: function (a) { var b = (a + this.options.offset) * this.stepSize / this.full * this.steps; return this.options.steps ? Math.round(b -= b % this.stepSize) : b; }, toPosition: function (a) {
	return (this.full * Math.abs(this.min - a)) / (this.steps * this.stepSize) - this.options.offset;
} 
});
