/**
 * @author roman
 */
Element.addMethods({
	/**
	 * Wrap a DOM Element into another
	 * @param element = the Prototype Element or ID of an element
	 * @param tagname = the tag to wrap the element in
	 * @param options = object with options
	 * {
	 *   useClass: 'class name', // use a class name on the new node
	 *   hidden: true // set the new node to invisible
	 * }
	 * @return the wrapper element
	 */
	iWrap: function(element, tagname, options){
		element = $(element);
		var node = $(document.createElement(tagname));
		node.appendChild(element.cloneNode(true));
		
		if(options){
			if(options.useClass){
				node.className = options.useClass;
			}
			
			if(options.hidden){
				node.hide();
			}
		}
		element.up().insertBefore(node, element);
		element.remove();
		return node;
	},
	
	addScrollBar: function(element, options){
		return new iConcerts.UI.ScrollBar(element, options);
	}
});

Object.extend(Event, {
	wheel:function (event){
		var delta = 0;
		if (!event) event = window.event;
		if (event.wheelDelta) {
			delta = event.wheelDelta/120; 
			//if (window.opera) delta = -delta;
		} else if (event.detail) { delta = -event.detail; }// /3	}
		return Math.round(delta); //Safari Round
	}
});

