/*
	AN7effects v1.3 - 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();
		});
	});
}

function selfLink(slEl){
	var a = $$(slEl);
	for(var i=0;i<a.length;i++){
		if(a[i].href.split("#")[0] == window.location.href.split("#")[0]){
			(a[i]).setStyles({color: '#000'});
		}
	}
}

window.addEvent('domready', function(){
	linkFade('.an7_thumb img, .an7_thumb_left img, .an7_thumb_right img, .linkFade');	// (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]
	selfLink('#nav a');							// (onload) changes the style of links to the current page
//	new Accordion($$('.menuToggle'), $$('.menuStretch'), {opacity: false});
});