Element.implement({

	fadein: function(du) {
		if(!du)du=500;

		this.setStyle('opacity', 0);
		this.set('tween', {property: 'opacity', duration: du, onStart: function(){this.show();}.bind(this)});
		this.get('tween').start(0,1);

		return this;
	},

	fadeout: function(du) {
		if(!du)du=500;

		this.set('tween', {property: 'opacity', duration: du, onComplete: function(){this.hide();}.bind(this)});
		this.get('tween').start(0);

		return this;
	},

	appendHTML: function(html) {
		if(typeOf(html)!='string') return false;
		var temp=new Element('div');
		temp.set('html',html);
		this.adopt(temp.childNodes);
		return this;
	}

});

Function.implement({

	bindWithEvent: function(bind, args) {
		var self = this;
		if(args != null)args = Array.from(args);
		return function(event) {
			return self.apply(bind, (args == null) ? arguments : [event].concat(args));
		};
	}

});
