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

function linkFade(lfDiv) {
	$$(lfDiv).each(function(div) {
		var mouseFxs = new Fx.Styles(div, {duration: 240, wait: false});

		div.setOpacity(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 fx = new Fx.Styles(hide, {duration: 180, wait: false});
		hide.setOpacity(0);

		div.addEvents({
			'mouseenter': function(){
					fx.start({'opacity': [0, 1]});
			},
			'mouseleave': function(){
					fx.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'});
		fx.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(){
	selfLink('#nav a');							// (onload) changes the style of links to the current page
	linkFade('.lbThumb, .mbThumb, .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]

	new Accordion($$('.menuToggle'), $$('.menuStretch'), {opacity: false});
	paginateInitialize();
});