/*
	AN7effects v1.4 - John Einselen (http://Iaian7.com)
	MooTools v1.2 required
*/

function linkFade(lfDiv) {
	$$(lfDiv).each(function(div) {
		var mouseFxs = new Fx.Tween(div, {duration: 240, wait: false});
		div.set('opacity', 0.85);	//Set the starting opacity
		div.addEvents({
			'mouseover': function(){
				mouseFxs.start('opacity', [0.85, 1]);
			},
			'mouseout': function(){
				mouseFxs.start('opacity', [1, 0.85]);
			}
		});
	});
}

function contentFade(cfFade, cfHide) {
	$$(cfFade).each(function(div){
		var hide = div.getElement(cfHide);
		var mouseFx = new Fx.Tween(hide, {duration: 180, wait: false});
		hide.set('opacity', 0);
		div.addEvents({
			'mouseenter': function(){
				mouseFx.start('opacity', [0, 1]);
			},
			'mouseleave': function(){
				mouseFx.start('opacity', [1, 0]);
			}
		});
	});
}

function contentSlide(csSlide, csHide, csToggle) {
	$$(csSlide).each(function(div){
		var link = div.getElement(csToggle);
		var hide = div.getElement(csHide);
		var fx = new Fx.Slide(hide, {duration: 240, mode: 'vertical'}).hide();
		link.addEvent('click', function(){
			fx.toggle();
		});
	});
}

window.addEvent('domready', function(){
	linkFade('a');								// (hover) fades links with [selector]
	contentFade('.fade', '.hide');				// (hover) shows / hides content [.hide] within div [.fade]
	contentSlide('.slide', '.hide', '.toggle'); // (click) shows / hides content [.hide] within [.slide] via toggle [.toggle]
});