/*
Product Name: dhtmlxSuite 
Version: 5.2.0 
Edition: Professional 
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
Copyright UAB Dinamenta http://www.dhtmlx.com
*/
function dhtmlXRibbon(struct) {
	
	var that = this, _skin, cont;
	
	this.conf = {
		type: "ribbon",
		icons_path: (struct && struct.icons_path)?struct.icons_path:"",
		icons_css: (struct && struct.iconsset == "awesome"),
		arrows_mode: (struct && struct.arrows_mode)?struct.arrows_mode:null,
		skin: "dhx_skyblue"
	};
	
	this._eventHandlers = {};
	this._base = null;
	this._items = {};
	this._tabbar = null;
	this.childIds = [];
	
	if (typeof(struct) == "string") {
		cont = struct;
		
	} else if (struct && struct.tagName) {
		cont = struct;
		
	} else if (struct && struct.parent) {
		if (struct.parent.tagName || typeof(struct.parent) == "string") {
			cont = struct.parent;
		}
	}
	
	/***   ***/
	this._doOnHighlight0 = function(e) {
		e = e || event;
		var target = e.target || e.srcElement;
		var el = that._findItemByNode(target);
		var item = that._items[el._dhx_ribbonId];
		
		if (item.conf.disable) {
			return;
		}
		
		if (that.items[item.type] && typeof(that.items[item.type].mouseover) == "function") {
			if (that.items[item.type].mouseover(item, that, e) != true) {
				return false;
			}
		}
		
		if (!/dhxrb_highlight0/.test(el.className)) {
			el.className += " dhxrb_highlight0";
		}
	};
	
	this._doOffHighlight0 = function(e) {
		e = e || event;
		var target = e.target || e.srcElement;
		var el = that._findItemByNode(target);
		var item = that._items[el._dhx_ribbonId];
		
		if (item.conf.disable) {
			return;
		}
		
		if (that.items[item.type] && typeof(that.items[item.type].mouseout) == "function") {
			if  (that.items[item.type].mouseout(item, that, e) != true) {
				return false;
			}
		}
		
		if (/dhxrb_highlight1/.test(el.className)) {
			el.className = el.className.replace(/\s?dhxrb_highlight1/, "");
		}
		
		if (/dhxrb_highlight0/.test(el.className)) {
			el.className = el.className.replace(/\s?dhxrb_highlight0/, "");
		}
		
	};
	
	this._doOnHighlight1 = function (e) {
		e = e || event;
		var target = e.target || e.srcElement;
		var el = that._findItemByNode(target);
		var item = that._items[el._dhx_ribbonId];
		
		if (item.conf.disable) {
			return;
		}
		
		that.callEvent("_showPopup",[item.id]);
		
		if (that.items[item.type] && typeof(that.items[item.type].mousedown) == "function") {
			if (that.items[item.type].mousedown(item, that, e) != true) {
				return false;
			}
		}
			
		if (!/dhxrb_highlight1/.test(el.className)) {
			el.className += " dhxrb_highlight1";
		}
	};
	
	this._doOffHighlight1 = function (e) {
		e = e || event;
		var target = e.target || e.srcElement;
		var el = that._findItemByNode(target);
		var item = that._items[el._dhx_ribbonId];
		
		if (item.conf.disable) {
			return;
		}
		
		if (that.items[item.type] && typeof(that.items[item.type].mouseup) == "function") {
			if (that.items[item.type].mouseup(item, that, e) != true) {
				return false;
			}
		}
		
		if (/dhxrb_highlight1/.test(el.className)) {
			el.className = el.className.replace(/\s?dhxrb_highlight1/, "");
		}
	};
	
	this._doOnClick = function(e) {
		e = e || event;
		var target = e.target || e.srcElement;
		var el = that._findItemByNode(target);
		var item = that._items[el._dhx_ribbonId];
		
		if (item.conf.disable) {
			return;
		}
		
		if (that.items[item.type] && typeof(that.items[item.type].click) == "function") {
			that.items[item.type].click(item, that, e);
		}
	};
	
	this._doOnFocus = function(e) {
		e = e || event;
		var target = e.target || e.srcElement;
		var el = that._findItemByNode(target);
		var item = that._items[el._dhx_ribbonId];
		
		if (item.conf.disable) {
			return;
		}
		
		that.callEvent("_showPopup",[item.id]);
		
		if (that.items[item.type] && typeof(that.items[item.type].focus) == "function") {
			that.items[item.type].focus(item, that, e);
		}
	};
	
	this._doOnBlur = function(e) {
		e = e || event;
		var target = e.target || e.srcElement;
		var el = that._findItemByNode(target);
		var item = that._items[el._dhx_ribbonId];
		
		if (item.conf.disable) {
			return;
		}
		
		if (that.items[item.type] && typeof(that.items[item.type].blur) == "function") {
			that.items[item.type].blur(item, that, e);
		}
	};
	
	this._doOnChange = function(e) {
		e = e || event;
		var target = e.target || e.srcElement;
		var el = that._findItemByNode(target);
		var item = that._items[el._dhx_ribbonId];
		
		if (item.conf.disable) {
			return;
		}
		
		if (that.items[item.type] && typeof(that.items[item.type].change) == "function") {
			that.items[item.type].change(item, that, e);
		}
	};
	
	this._doOnKeydown = function(e) {
		e = e || event;
		var target = e.target || e.srcElement;
		var el = that._findItemByNode(target);
		var item = that._items[el._dhx_ribbonId];
		
		if (item.conf.disable) {
			return;
		}
		
		if (that.items[item.type] && typeof(that.items[item.type].keydown) == "function") {
			that.items[item.type].keydown(item, that, e);
		}
	};
	/***   ***/
	this._tabCustomApi = {
		enable: function(actvId, isCall) {
			/* @var this  dhtmlXCellObject */
			var item = null;
			
			isCall = isCall || false;
			if (isCall != true) {
				item = that._items[this._idd];
				for (var q=0; q";
		} else {
			var img = "?item.conf.icons_path+item.conf.img:"")+") "
		}
		
		cont.innerHTML = img+"
"
		}
		
		cont.innerHTML = img+""+item.conf.text+"
";
		
		if (typeof(this.afterRender) == "function") {
			this.afterRender(item);
		}
		
		if (item.conf.disable) {
			this.disable(item);
		}
		
		return item;
	},
	
	getText: function(item) {
		return item.conf.text;
	},
	
	setText: function(item, text) {
		var contForText = item.base.childNodes[1];
		
		item.conf.text = text;
		contForText.innerHTML = text;
	},
	
	setImage: function(item, img) {
		item.conf.img = img;
		if (item.conf.disable == false) {
			item.base.childNodes[0][item.conf.icons_css?"className":"src"] = item.conf.icons_path+item.conf.img;
		}
	},
	
	setImageDis: function(item, imgdis) {
		item.conf.imgdis = imgdis;
		if (item.conf.disable == true) {
			item.base.childNodes[0][item.conf.icons_css?"className":"src"] = item.conf.icons_path+item.conf.imgdis;
		}
	},
	
	mousedown: function(item,rb,e) {
		return true;
	},
	
	click: function(item,ribbon,e) {
		if (e.button != 0) {
			return false;
		}
		ribbon._callHandler(item.id, [item.id]);
		item.callEvent("onClick",[item.id]);
		return false;
	},
	
	disable: function(item) {
		var contForImage = item.base.childNodes[0],
			contForText = item.base.childNodes[1];
		
		if (item.conf.imgdis) {
			contForImage[item.conf.icons_css?"className":"src"] = item.conf.icons_path+item.conf.imgdis;
			if (/\s?dhxrb_invisible/i.test(contForImage.className)) {
				contForImage.className = contForImage.className.replace(/\s?dhxrb_invisible/i, "");
			}
		}
		
		if (!/\s?dhxrb_disable_text_style/i.test(contForText.className)) {
			contForText.className += " dhxrb_disable_text_style";
		}
		
		return true;
	},
	
	enable: function(item) {
		var contForImage = item.base.childNodes[0],
			contForText = item.base.childNodes[1];
		
		if (item.conf.img) {
			contForImage[item.conf.icons_css?"className":"src"] = item.conf.icons_path+item.conf.img;
		} else {
			if (!/\s?dhxrb_invisible/i.test(contForImage.className)) {
				contForImage.className += " dhxrb_invisible";
			}
		}
		
		if (/\s?dhxrb_disable_text_style/i.test(contForText.className)) {
			contForText.className = contForText.className.replace(/\s?dhxrb_disable_text_style/i, "");
		}
			
		return true;
	}
};
dhtmlXRibbon.prototype.items.buttonTwoState = {
	click: function(item, rb, e) {
		return false;
	},
	
	afterRender: function(item) {
		if (item.conf.state) {
			this.setState(item, item.conf.state);
		}
	},
	
	mouseover: function(item) {
		if (!/dhxrb_highlight0/.test(item.base.className)) {
			item.base.className += " dhxrb_highlight0";
		}
		return false;
	},
	
	mouseout: function(item) {
		if (/dhxrb_highlight0/.test(item.base.className)) {
			item.base.className = item.base.className.replace(/\s?dhxrb_highlight0/, "");
		}
		return false;
	},
	
	mousedown: function(item, rb, e) {
		rb._callHandler(item.id,[item.id,!item.conf.state]);
		this.setState(item, !item.conf.state, true);
		return false;
	},
	
	mouseup: function(item) {
		return false;
	},
	
	setState: function(item, value, callEvent) {
		callEvent = callEvent || false;
		value = dhx4.s2b(value);
		if (value) {
			if (!/dhxrb_highlight1/.test(item.base.className)) {
				item.base.className += " dhxrb_highlight1";
			}
		} else {
			if (/dhxrb_highlight1/.test(item.base.className)) {
				item.base.className = item.base.className.replace(/\s?dhxrb_highlight1/, "");
			}
		}
		
		item.conf.state = value;
		
		if (callEvent) {
			item.callEvent("onStateChange",[item.id, item.conf.state]);
		}
	},
	
	getState: function(item) {
		return (item.conf.state == true);
	}
};
dhtmlXRibbon.prototype.items.buttonSegment = {
	click: function(item, rb, e) {
		return false;
	},
	
	mousedown: function(item, rb, e) {
		this.setState(item, rb, true);
		return false;
	},
	
	callAfterInit: function(item) {
		/* @var this dhtmlXRibbon */
		
		if (item.conf.state || dhtmlXRibbon.prototype.items.buttonSegment._getSelectedNeighbor(item, this) == null) {
			if (item.conf.state) {
				item.conf.state = false;
			}
			dhtmlXRibbon.prototype.items.buttonSegment.setState(item, this,  false);
		}
		
	},
	
	afterRender: function() {},
	
	setState: function(item, rb, callEvent) {
		callEvent = callEvent || false;
		var oldItem = null, state = dhx4.s2b(item.conf.state);
		
		if (state == false) {
			oldItem = this._getSelectedNeighbor(item,rb);
			if (oldItem != null) {
				this._unSelect(oldItem);
			}
			
			if (!/dhxrb_highlight1/.test(item.base.className)) {
				item.base.className += " dhxrb_highlight1";
			}
			
			item.conf.state = true;
			
			if (callEvent) {
				rb._callHandler(item.id,[item.id,(oldItem?oldItem.id:null)]);
				rb.callEvent("onStateChange", [item.id, (oldItem?oldItem.id:null)]);
			}
		}
	},
	
	remove: function(item, rb) {
		var state = dhx4.s2b(item.conf.state),
			firstItem = null, i=0, parent = rb._items[item.parentId],
			tempItem;
		if (state) {
			while (parent.childIds[i] && firstItem == null) {
				tempItem = rb._items[parent.childIds[i]];
				if (tempItem.type == "buttonSegment" && tempItem != item) {
					firstItem = tempItem;
				}
				i++;
			}
			
			if (firstItem) this.setState(firstItem, rb);
		}
	},
	
	_unSelect: function(item) {
		var state = dhx4.s2b(item.conf.state);
		if (state) {
			if (/dhxrb_highlight1/.test(item.base.className)) {
				item.base.className = item.base.className.replace(/\s?dhxrb_highlight1/, "");
			}
			
			item.conf.state = false;
		}
	},
	
	_getSelectedNeighbor: function(item, rb) {
		var parent = rb._items[item.parentId], i, l, neighbor, answer = null;
		l = parent.childIds.length;
		for (i=0; i ";
		item.menu = null;
		this.itemCollection.push(item);
		
		this._attachEventToWindow();
		
		label = null;
	},
	
	setText: function(item,text) {
		var arrow = item.base.childNodes[1].lastChild;
		
		item.conf.text = text;
		
		item.base.childNodes[1].innerHTML = text;
		item.base.childNodes[1].appendChild(arrow);
	},
	
	setOptionText: function(item, optId, text) {
		if (item.menu != null) {
			item.menu.setItemText(optId, text);
		} else {
			this._loopThroughItems(item.conf.items, optId, text, false); // loop through items
		}
	},
	
	getOptionText: function(item, optId) {
		if (item.menu != null) return item.menu.getItemText(optId);
		return this._loopThroughItems(item.conf.items, optId, null, true); // loop through items
	},
	
	_loopThroughItems: function(items, id, text, retValue) {
		for (var q=0; q";
		
		if (typeof(this.afterRender) == "function") {
			this.afterRender(item);
		}
		
		if (item.conf.disable) {
			this.disable(item);
		}
		
		if (item.conf.width) {
			this.setWidth(item, item.conf.width);
		}
		
		if (item.conf.value) {
			this.setValue(item, item.conf.value);
		}
		
		return item;
	},
	
	callAfterInit: function(item) {
		/* @var this dhtmlXRibbon */
		var contForInput = item.base.childNodes[0];
		
		this._detachEventFromItem(item.base);
		this._attachEventsToInput(contForInput);
	},
	
	setText: dhtmlXRibbon.prototype.items.button.setText,
	
	getText: dhtmlXRibbon.prototype.items.button.getText,
	
	change: function(item) {
		var contForInput = item.base.childNodes[0];
		
		item.conf.value = contForInput.value;
	},
	
	keydown: function(item, rb, e) {
		if (e.keyCode == 13) {
			var contForInput = item.base.childNodes[0];
			item.conf.value = contForInput.value;
			rb.callEvent("onEnter",[item.id, item.conf.value]);
		}
	},
	
	remove: function(item, rb) {
		var contForInput = item.base.childNodes[0];
		rb._detachEventsFromInput(contForInput);
	},
	
	getValue: function(item) {
		var contForInput = item.base.childNodes[0], value;
		
		value = contForInput.value;
		contForInput = undefined;
		
		return value;
	},
	
	setValue: function(item, value) {
		var contForInput = item.base.childNodes[0], value;
		
		contForInput.value = value;
		item.conf.value = value;
	},
	
	setWidth: function(item, value) {
		var contForInput = item.base.childNodes[0];
		
		contForInput.style.width = parseInt(value)+"px";
	},
	
	disable: function(item) {
		var contForInput = item.base.childNodes[0],
			contForText = item.base.childNodes[1];
		
		contForInput.disabled = true;
		
		if (!/\s?dhxrb_disable_text_style/i.test(contForText.className)) {
			contForText.className += " dhxrb_disable_text_style";
		}
		
		return true;
	},
	
	enable: function(item) {
		var contForInput = item.base.childNodes[0],
			contForText = item.base.childNodes[1];
		
		contForInput.disabled = false;
		
		if (/\s?dhxrb_disable_text_style/i.test(contForText.className)) {
			contForText.className = contForText.className.replace(/\s?dhxrb_disable_text_style/i, "");
		}
			
		return true;
	},
	
	getInput: function(item){
		return item.base.childNodes[0];
	}
};
dhtmlXRibbon.prototype.getInput = function(id) {
	var item = this._items[id];
	if (item == null || item.type != "input") return null;
	return this.items[item.type].getInput(item);
};
dhtmlXRibbon.prototype.items.checkbox = {
	render: function (cont, itemData) {
		var key, item;
		
		item = {
			base: cont,
			id: itemData.id,
			type: itemData.type,
			conf: {
				text: "",
				text_pos: (itemData.isbig)?"bottom":"right",
				disable: false,
				checked: false
			}
		};
		
		for (key in itemData) {
			if (key == "id" || key == "onclick" || key == "type") {
				continue;
			}
			
			item.conf[key] = itemData[key];
		}
		
		cont.innerHTML = ""+item.conf.text+"
";
		
		if (typeof(this.afterRender) == "function") {
			this.afterRender(item);
		}
		
		if (item.conf.checked) {
			this.check(item);
		}
		
		return item;
	},
	
	callAfterInit: function(item) {
		/* @var this dhtmlXRibbon */
		
		if (item.conf.disable) {
			this.disable(item.id);
		}
	},
	
	setText: dhtmlXRibbon.prototype.items.button.setText,
	
	getText: dhtmlXRibbon.prototype.items.button.getText,
	
	mousedown: function(item) {
		return false;
	},
	
	mouseup: function(item) {
		return false;
	},
	
	click: function(item, rb, e) {
		if (e.button != 0) {
			return false;
		}
		if (item.type == "checkbox") {
			if (item.conf.checked) {
				this.uncheck(item, true);
			} else {
				this.check(item, true);
			}
		}
	},
	
	check: function(item, callEvent) {
		callEvent = callEvent || false;
		if (item.type != "checkbox") {
			return;
		}
		
		item.conf.checked = true;
		if (!/\s?dhxrb_checked/i.test(item.base.className)) {
			item.base.className += " dhxrb_checked";
		}
		
		if (callEvent) {
			item.callEvent("onCheck",[item.id, item.conf.checked]);
		}
	},
	
	uncheck: function(item, callEvent) {
		callEvent = callEvent || false;
		if (item.type != "checkbox") {
			return;
		}
		
		item.conf.checked = false;
		if (/\s?dhxrb_checked/i.test(item.base.className)) {
			item.base.className = item.base.className.replace(/\s?dhxrb_checked/i,"");
		}
		
		if (callEvent) {
			item.callEvent("onCheck",[item.id, item.conf.checked]);
		}
	},
	
	isChecked: function(item) {
		if (item.type != "checkbox") return false;
		return (item.conf.checked == true);
	},
	
	disable: function(item) {
		return true;
	},
	
	enable: function(item) {
		return true;
	}
};
dhtmlXRibbon.prototype.items.text = {
	render: function(cont, data) {
		var item = {
			base: cont,
			id: data.id,
			type: data.type,
			conf: {
				text: ""
			}
		};
		
		for (var key in data) {
			if (key == "id" || key == "type") {
				continue;
			}
			item.conf[key] = data[key];
		}
		
		
		cont.innerHTML = ""+item.conf.text+"
";
		
		if (typeof(this.afterRender) == "function") {
			this.afterRender(item);
		}
		
		return item;
	},
	
	callAfterInit: function(item) {
		/* @var this dhtmlXRibbon */
		
		this._detachEventFromItem(item.base);
	},
	
	getText: function(item) {
		return item.conf.text;
	},
	
	setText: function(item, text) {
		item.conf.text = text;
		item.base.firstChild.innerHTML = item.conf.text
	}
};
dhtmlXRibbon.prototype.items.buttonCombo = {
	render: function(cont, dataItem) {
		var key, item, comboConf={};
		
		item = {
			base: cont,
			id: dataItem.id,
			type: dataItem.type,
			conf: {
				text: "",
				text_pos: "right",
				width: 140,
				skin: dataItem.skin,
				callEvent: true,
				mode: dataItem.comboType,
				image_path: dataItem.comboImagePath,
				default_image: dataItem.comboDefaultImage,
				default_image_dis: dataItem.comboDefaultImageDis
			}
		};
		
		for (key in dataItem) {
			if (key == "id" || key == "onclick" || key == "type") {
				continue;
			}
			
			item.conf[key] = dataItem[key];
		}
		
		for (key in item.conf) {
			if (key == "text" || key == "text_pos" || key == "disable" || key == "data") {
				continue;
			}
			
			comboConf[key] = item.conf[key];
		}
		
		item.base.className += " dhxrb_buttoncombo_cont";
		item.base.innerHTML = ""+item.conf.text+"
";
		
		comboConf.parent = item.base.firstChild;
		
		item.combo = new dhtmlXCombo(comboConf);
		
		item.combo.setSkin(comboConf.skin); // deprecated;
		
		item.combo.attachEvent("onChange", function(value, text) {
			item._callHandler(item.id, [value, text]);
			if (item.conf.callEvent == true) item.callEvent("onSelectOption", [item.id, value, text]);
			item.conf.callEvent = true;
		});
		
		if (item.conf.data) {
			item.combo.load(item.conf.data);
			delete item.conf.data;
		}
		
		if (typeof(this.afterRender) == "function") {
			this.afterRender(item);
		}
		
		if (item.conf.disable) {
			this.disable(item);
		}
		
		return item;
	},
	
	callAfterInit: function(item) {
		/* @var this dhtmlXRibbon */
		this._detachEventFromItem(item.base);
	},
	
	disable: function(item) {
		var contForText = item.base.lastChild;
		
		if (item.combo instanceof dhtmlXCombo) {
			item.combo.disable();
		}
		
		if (!/\s?dhxrb_disable_text_style/i.test(contForText.className)) {
			contForText.className += " dhxrb_disable_text_style";
		}
		
		return true;
	},
	
	enable: function(item) {
		var contForText = item.base.lastChild;
		
		if (item.combo instanceof dhtmlXCombo) {
			item.combo.enable();
		}
		
		if (/\s?dhxrb_disable_text_style/i.test(contForText.className)) {
			contForText.className = contForText.className.replace(/\s?dhxrb_disable_text_style/i, "");
		}
		
		return true;
	},
	
	remove: function(item) {
		if (item.combo instanceof dhtmlXCombo) {
			item.combo.unload();
			item.combo = null;
		}
	},
	
	getValue: function(item) {
		var answer = null;
		if (item.combo instanceof dhtmlXCombo) {
			answer = item.combo.getSelectedValue();
		}
		
		return answer;
	},
	
	setValue: function(item, value, callEvent) {
		if (item.combo instanceof dhtmlXCombo) {
			item.conf.callEvent = callEvent;
			item.combo.setComboValue(value);
			item.conf.callEvent = true;
		}
	},
	
	setSkin: function(item, skin) {
		if (item.combo instanceof dhtmlXCombo) {
			item.combo.setSkin(skin);
		}
	}
};
dhtmlXRibbon.prototype.items.slider = {
	render: function(cont, data) {
		var key, item, sliderConf={};
		
		item = {
			base: cont,
			id: data.id,
			type: data.type,
			conf: {
				text: "",
				text_pos: "right",
				size: 150,
				vertical: false,
				min: 0,
				max: 99,
				value: 0,
				step: 1,
				margin: 10,
				disabled: false,
				enableTooltip: false
			}
		};
		
		for (key in data) {
			if (key == "id" || key == "onclick" || key == "type") {
				continue;
			}
			
			item.conf[key] = data[key];
		}
		
		for (key in item.conf) {
			if (key == "text" || key == "text_pos" || key == "isbig") {
				continue;
			}
			
			sliderConf[key] = item.conf[key];
		}
		
		item.base.innerHTML = ""+item.conf.text+"
";
	
		sliderConf.parent = item.base.firstChild.firstChild;
		
		item.slider = new dhtmlXSlider(sliderConf);
	
		if (typeof(this.afterRender) == "function") {
			this.afterRender(item);
		}
		
		if (item.conf.disable) {
			this.disable(item);
		}
		
		item.slider.attachEvent("onChange", function(value) {
			item._callHandler(item.id, [value]);
			item.callEvent("onValueChange", [item.id, value]);
		});
	
		return item;
	},
	
	callAfterInit: function(item) {
		/* @var this dhtmlXRibbon */
		this._detachEventFromItem(item.base);
	},
	
	setSkin: function(item, skin) {
		if (item.slider instanceof dhtmlXSlider) {
			item.slider.setSkin(skin);
		}
	},
	
	disable: function(item) {
		var contForText = item.base.childNodes[1];
		
		if (item.slider instanceof dhtmlXSlider) {
			item.slider.disable();
		}
		
		if (!/\s?dhxrb_disable_text_style/i.test(contForText.className)) {
			contForText.className += " dhxrb_disable_text_style";
		}
		return true;
	},
	
	enable: function(item) {
		var contForText = item.base.childNodes[1];
		
		if (item.slider instanceof dhtmlXSlider) {
			item.slider.enable();
		}
		
		if (/\s?dhxrb_disable_text_style/i.test(contForText.className)) {
			contForText.className = contForText.className.replace(/\s?dhxrb_disable_text_style/i, "");
		}
		
		return true;
	},
	
	remove: function(item) {
		if (item.slider instanceof dhtmlXSlider) {
			item.slider.unload();
			item.slider = null;
		}
	},
	
	getValue: function(item) {
		var answer = null;
		if (item.slider instanceof dhtmlXSlider) {
			answer = item.slider.getValue();
		}
		
		return answer;
	},
	
	setValue: function(item,value) {
		if (item.slider instanceof dhtmlXSlider) {
			item.slider.setValue(value);
		}
	}
};
/******************************************************/
dhtmlXRibbon.prototype.items._extends = function(item,parent) {
	var key;
	
	for (key in parent) {
		item[key] = item[key] || parent[key];
	}
	
	return item;
};
dhtmlXRibbon.prototype._addNewLevel = function (block) {
	var lastNode,cont;
	if (block.conf.mode == 'rows') {
		lastNode = block.contForItems.lastChild;
		
		if (lastNode && /dhxrb_block_rows/i.test(lastNode.className) && (lastNode.childNodes.length < 3)) {
			
			cont = document.createElement('div');
			cont.className = "dhxrb_block_row";
			lastNode.appendChild(cont);
			
		} else {
			lastNode = document.createElement('div');
			lastNode.className = "dhxrb_block_rows";
			block.contForItems.appendChild(lastNode);
			cont = document.createElement('div');
			cont.className = "dhxrb_block_row";
			lastNode.appendChild(cont);
		}
		
	} else {
		var cont = document.createElement("div");
		cont.className = "dhxrb_3rows_block";
		block.contForItems.appendChild(cont);
	}
};
dhtmlXRibbon.prototype._attachEventForItem = function(cont) {
	if (typeof(window.addEventListener) == "function") {
		cont.addEventListener("mouseover", this._doOnHighlight0, false);
		cont.addEventListener("mouseout", this._doOffHighlight0, false);
		cont.addEventListener("mousedown", this._doOnHighlight1, false);
		cont.addEventListener("mouseup", this._doOffHighlight1, false);
		cont.addEventListener("click", this._doOnClick, false);
	} else {
		cont.attachEvent("onmouseover", this._doOnHighlight0);
		cont.attachEvent("onmouseout", this._doOffHighlight0);
		cont.attachEvent("onmousedown", this._doOnHighlight1);
		cont.attachEvent("onmouseup", this._doOffHighlight1);
		cont.attachEvent("onclick", this._doOnClick);
	}
};
dhtmlXRibbon.prototype._detachEventFromItem = function(cont) {
	if (typeof(window.addEventListener) == "function") {
		cont.removeEventListener("mouseover", this._doOnHighlight0, false);
		cont.removeEventListener("mouseout", this._doOffHighlight0, false);
		cont.removeEventListener("mousedown", this._doOnHighlight1, false);
		cont.removeEventListener("mouseup", this._doOffHighlight1, false);
		cont.removeEventListener("click", this._doOnClick, false);
	} else {
		cont.detachEvent("onmouseover", this._doOnHighlight0);
		cont.detachEvent("onmouseout", this._doOffHighlight0);
		cont.detachEvent("onmousedown", this._doOnHighlight1);
		cont.detachEvent("onmouseup", this._doOffHighlight1);
		cont.detachEvent("onclick", this._doOnClick);
	}
};
dhtmlXRibbon.prototype._attachEventsToInput = function(cont) {
	if (typeof(window.addEventListener) == "function") {
		cont.addEventListener("focus", this._doOnFocus, false);
		cont.addEventListener("blur", this._doOnBlur, false);
		cont.addEventListener("change", this._doOnChange, false);
		cont.addEventListener("keydown", this._doOnKeydown, false);
	} else {
		cont.attachEvent("onfocus", this._doOnFocus);
		cont.attachEvent("onblur", this._doOnBlur);
		cont.attachEvent("onchange", this._doOnChange);
		cont.attachEvent("onkeydown", this._doOnKeydown);
	}
};
dhtmlXRibbon.prototype._detachEventsFromInput = function(cont) {
	if (typeof(window.addEventListener) == "function") {
		cont.removeEventListener("focus", this._doOnFocus, false);
		cont.removeEventListener("blur", this._doOnBlur, false);
		cont.removeEventListener("change", this._doOnChange, false);
		cont.removeEventListener("keydown", this._doOnKeydown, false);
	} else {
		cont.detachEvent("onfocus", this._doOnFocus);
		cont.detachEvent("onblur", this._doOnBlur);
		cont.detachEvent("onchange", this._doOnChange);
		cont.detachEvent("onkeydown", this._doOnKeydown);
	}
};
dhtmlXRibbon.prototype._getContainerForSmallItem = function(parent) {
	var last_el = parent.contForItems.lastChild, cont = null;
	
	if (parent.conf.mode == "rows") {
		
		if (last_el && /\s?dhxrb_block_rows/i.test(last_el.className)) {
			cont = last_el.lastChild;
			if (!cont) {
				cont = document.createElement('div');
				cont.className = "dhxrb_block_row";
				last_el.appendChild(cont);
			}
		} else {
			last_el = document.createElement('div');
			last_el.className = "dhxrb_block_rows";
			parent.contForItems.appendChild(last_el);
			cont = document.createElement('div');
			cont.className = "dhxrb_block_row";
			last_el.appendChild(cont);
		}
	} else {
		
		if (last_el && /dhxrb_3rows_block/i.test(last_el.className) && (last_el.childNodes.length < 3)) {
			cont = last_el;
		} else {
			cont = document.createElement("div");
			cont.className = "dhxrb_3rows_block";
			parent.contForItems.appendChild(cont);
		}
		
	}
	
	return cont;
};
dhtmlXRibbon.prototype._findItemByNode = function(el) {
	while (el && !el._dhx_ribbonId) {
		el = el.parentNode;
	}
	return el;
};
dhtmlXRibbon.prototype._indexOf =  function(arr,item) {
	var i,l;
	l = arr.length;
	for (i=0; i