var WWF = {};
WWF.addLinksObservers = function(){
    //this.link = ['nfEnvironnement', 'europeEnvironnement', 'recycle', 'oekotex', 'fsc', 'recycler'];
    this.links = $$('#eco li a');
    that = this;
	
    this.links.each(function(link){
        var attachedBill = $(link).identify() + "-bill";
        $(attachedBill).hide();
        $(link).observe('mouseover', onmouseoverlogo);
        
        function onmouseoverlogo(event){
            that.links.each(function(aLink){
				var aBill = $(aLink).identify() + "-bill";
                if (aBill == attachedBill) {
					that.currentPopup =  $(attachedBill);
                    $(aBill).show();
					
                }else{
					$(aBill).hide();
				}
            });
            
            function hideMe(event){
                if (!Position.within(that.currentPopup, Event.pointerX(event), Event.pointerY(event))) {
                    $(attachedBill).hide();
                }
                Event.stopObserving(document, 'mouseover', hideMe);
            }
			
            setTimeout(function(){Event.observe(document, 'mouseover', hideMe);}, 1000);
            
        }
        
        
        $(attachedBill).observe('mouseover', function(event){
            $(attachedBill).observe('mouseout', function(event){
                if (!Position.within(event.currentTarget, Event.pointerX(event), Event.pointerY(event))) {
                    $(attachedBill).hide();
                }
            });
        });
        
    });
}();

