window.addEvent('domready', function() {
	//IE6 and earlier specific
	if (document.all) {
		setAllButtonHover();
	}
});

/**
 * Let you easily fade an element with the use of mootools effects lib
 * 
 * @param elementId:String (html id of element)
 * @param inOrOut:String ('in' or 'out')
 * @param duration:int (in milliseconds)
 * @return fx:Fx.Tween (mootools object)
 */
function fade(elementId, inOrOut, duration) {
	fx = new Fx.Tween(elementId, {
		'property': 'opacity',
		'duration': duration
	});

	switch (inOrOut) {
		case 'in':
			fx.start(0, 1);
			break;
		default: 
			fx.start(1, 0);
			break;
	}
	
	return fx;
}

/**
 * Adds the class 'buttonHover' to all button elements in the document
 * when the mouseenter event is triggered 
 * (NOTE: We will only use this for ie6 and < css2-supported browsers)
 *
 * @return void
 */
function setAllButtonHover() {
	$$('button').each(function (el) {
		el.addEvents({
			'mouseenter': function () {
				this.addClass('buttonHover');
			},
			'mouseleave': function () {
				this.removeClass('buttonHover');
			}
		});
	});
}