window.addEvent('domready',function() {
    
    var IE6 = (Browser.Engine.trident==true && Browser.Engine.version<=4 ? true : false);
    
    $$('.yt-uix-button').addEvent('click',function(e){
        e.preventDefault();
        if(this.id!="accountBtn" && this.id!="accountLinksBtn") {
           window.location = this.getProperty('href');
        }
    });
    
    if($('accountBtn')) {
       var thisPos = $('accountBtn').getCoordinates();
       var topLoginPos = $('topLogin').getCoordinates();
       $('accountBtnDropDown').setStyles({
           'top': Math.round((thisPos.top-topLoginPos.top)+22),
           'left': Math.round(thisPos.left-topLoginPos.left)
       });
       $('accountBtn').addEvent('click',function(e){
           e.preventDefault();
           $('accountBtnDropDown').toggleClass('accountBtnDropDownOn');
       }); 
    }
    
    if($('accountLinksBtn')) {
        var accountLinksDropDown = $('accountLinksDropDown');
        var accountLinksBtnPos = $('accountLinksBtn').getCoordinates();
        $('accountLinksBtn').addEvent('click',function(e){
            e.preventDefault();
            accountLinksDropDown.toggleClass('accountBtnDropDownOn');
            accountLinksDropDown.setStyles({
                'top': Math.round( accountLinksBtnPos.height + 2 )
            });
        });
    }
    
    // Fix IE6 hover event. Ex add .ie6HoverFix to the node that as an hover event
    if(IE6){$$('.ie6HoverFix').addEvents({'mouseenter': function(e) {this.addClass('hover');},'mouseleave': function(e) {this.removeClass('hover');}});}
    
});

