
//Needs Mootools - Fades buttons in and out on hover - Conor L.
window.addEvent('domready', function() {
    var fadeLayers = $$('.fader');
    var fadeLayersFully = $$('.faderFull');
    
    
    //Adds all items with the class "fader" to an array


    //Give each item in the array a mouseover and mouseout function to fade them in and out :)
    fadeLayers.addEvents({
        'mouseover': function() {
            this.fade(.8);
        },
        'mouseout': function() {
            this.fade(1);
        }
    });


    //Give each item in the array a mouseover and mouseout function to fade them in and out :)
    fadeLayersFully.addEvents({
        'mouseover': function() {
            this.fade(0);
        },
        'mouseout': function() {
            this.fade(1);
        }
    });

});


/*

//Needs Mootools - Slides header panel out. Hides it on init - Conor L.
window.addEvent('domready', function() {

    var myVerticalSlide = new Fx.Slide('headerPropertiesHolder');
    
    myVerticalSlide.hide();
    $('headerPropertiesHolder').setStyle('display', 'block');
    //display is set to hidden in the CSS to prevent this showing during page load.
    

    $('expandPropertiesBtn').addEvent('click', function(e) {
        e.stop();
        $('headerPropertiesHolder').getParent().setStyle('overflow', 'hidden'); //To allow hiding of list
        myVerticalSlide.toggle();
    });

    myVerticalSlide.addEvent('complete', function() {
        if (myVerticalSlide.open) {
            $('expandPropertiesBtn').setStyle('background-position', '-223px -135px');
            $('expandPropertiesBtnLink').setStyle('background-position', '-223px 0px');
            $('headerPropertiesHolder').getParent().setStyle('overflow', 'visible');//To allow showing of tooltip
            
        }
        else {
            $('expandPropertiesBtn').setStyle('background-position', '0px -35px');
            $('expandPropertiesBtnLink').setStyle('background-position', '0px 0px');
        }

    });

});
*/








//Needs Mootools - Property list tooltips 
window.addEvent('domready', function() {

    // Create variables (in this case two arrays) representing our bubbles and pages
    var myPages = $$('.propertyNavLink');
    var myBubbles = $$('.propertyNavLinkTip');

    // Set bubbles opacity to zero so they're hidden initially
    // and toggle visibility on for their container	back on
    myBubbles.setStyle('opacity', 0);
    // $('bubbleWrap').setStyle('visibility', 'visible')

    // Add our events to the pages
    myPages.each(function(el, i) {
        /* Here we change the default 'link' property to 'cancel' for our morph effects, which
        ensures effects are interrupted when the mouse is leaving and entering
        to immediately begin the morph effect being called */
        el.set('morph', { link: 'cancel' });

        el.addEvents({
            'mouseenter': function() {
                myBubbles[i].morph({
                    'opacity': 1,
                    'margin-top': '-15px'
                });
            },
            'mouseleave': function() {
                myBubbles[i].morph({
                    'opacity': 0,
                    'margin-top': 0
                });
            }
        });
    });
});



/*
---

name: Elements.multiFade

description: Sets full opacity to element that is moused over while dimming all other elements of same class.

license: MIT-style

requires: 
- Core/Elements
- Core/Fx.Tween

provides: Elements.multiFade

authors: [Michael Russell]

...
*/

Elements.implement({

    multiFade: function(opacity) {

        var opacity = (opacity) ? opacity : .6,
		    elems = this;

        this.addEvents({
            'mouseenter': function(e) {
                elems.each(function(elem) {
                    if (elem != e.target) elem.tween('opacity', opacity);
                });
            },

            'mouseleave': function(e) {
                elems.each(function(elem) {
                    elem.tween('opacity', 1);
                });
            }
        });

    }
});

    

 $$('.fadeOthers').multiFade();

