Slider.prototype.disable = function() {
	this.element.onmousedown = null;
	this.element.onfocus	= null;
	this.element.onblur	= null;
	this.element.onmousedown= null;
	this.element.onmouseover= null;
	this.element.onmouseout	= null;
	this.element.onkeydown	= null;
	this.element.onkeypress	= null;
	this.element.onmousewheel= null;
	this.handle.childNodes[0].className = "handleReadOnly";
};

FreoSlider.isSupported = typeof document.createElement != "undefined" &&
	typeof document.documentElement != "undefined" &&
	typeof document.documentElement.offsetWidth == "number";

function FreoSlider(oElement, oInput, sOrientation) {
	if (!oElement) return;

	sOrientation = sOrientation || "horizontal";

	if (Slider.isSupported && oElement) {

		this.document = oElement.ownerDocument || oElement.document;

		this.element = oElement;

		this.element = oElement;
		this.element.slider = this;
		this.element.unselectable = "on";

		// add class name tag to class name
		this.element.className = sOrientation + " " + this.classNameTag + " " + this.element.className;

		// create line
		this.line = this.document.createElement("DIV");
		this.line.className = "line";
		this.line.unselectable = "on";
		this.line.appendChild(this.document.createElement("DIV"));
		this.element.appendChild(this.line);

		// create slider
		this.sliderelement = this.document.createElement("DIV");
		this.sliderelement.className = "slider";
		this.sliderelement.unselectable = "on";
		this.sliderelement.appendChild(this.document.createElement("DIV"));
		this.element.appendChild(this.sliderelement);

		this.slider = new Slider(this.sliderelement, oInput);

		var oThis = this;
                this.slider.onrecalculate = function () {
			var w = oThis.element.offsetWidth;
			var h = oThis.element.offsetHeight;
			var hw = oThis.slider.handle.offsetWidth;
			var hh = oThis.slider.handle.offsetHeight;
			var lw = oThis.line.offsetWidth;
			var lh = oThis.line.offsetHeight;

			oThis.line.style.top = (h - lh) / 2 + "px";
			oThis.line.style.left = hw / 2 + "px";
			oThis.line.style.width = Math.max(0, w - hw - 2)+ "px";
			oThis.line.firstChild.style.width = Math.max(0, w - hw - 4)+ "px";
                
			oThis.sliderelement.style.left = 30 + "px";
			oThis.sliderelement.style.width = (oThis.element.offsetWidth - 30) + "px";                
		};
	}

	// events
	var oThis = this;
	this.slider.onchange = function () {
		if (typeof oThis.onchange == "function")
			oThis.onchange();
	};

}

FreoSlider.prototype.classNameTag = "freo-slider-control",

FreoSlider.prototype.setValue = function (v) {
	this.slider.setValue(v);
};

FreoSlider.prototype.getValue = function () {
	return this.slider.getValue();
};

FreoSlider.prototype.setMinimum = function (v) {
	this.slider.setMinimum(v);
};

FreoSlider.prototype.getMinimum = function () {
	return this.slider.getMinimum();
};

FreoSlider.prototype.setMaximum = function (v) {
	this.slider.setMaximum(v);
};

FreoSlider.prototype.getMaximum = function () {
	return this.slider.getMaximum();
};

FreoSlider.prototype.setUnitIncrement = function (v) {
	this.slider.setUnitIncrement(v);
};

FreoSlider.prototype.getUnitIncrement = function () {
	return this.slider.getUnitIncrement();
};

FreoSlider.prototype.setBlockIncrement = function (v) {
	this.slider.setBlockIncrement(v);
};

FreoSlider.prototype.getBlockIncrement = function () {
	return this.slider.getBlockIncrement();
};

FreoSlider.prototype.getOrientation = function () {
	return this.slider.getOrientation();
};

FreoSlider.prototype.setOrientation = function (sOrientation) {
	return this.slider.setOrientation(sOrientation);
};

FreoSlider.prototype.disable = function() {
	this.slider.disable();
};

FreoSlider.prototype.recalculate = function() {
	this.slider.recalculate();
};

