Event.observe(window, 'load', function(){
    Event.observe('reading_equality', 'mouseover', function()
        {
            TagToTip('reading_equality_hover_text', WIDTH, 400);
        }
    );
    
    if ($('reading_equality')){    
        Event.observe('reading_equality', 'mouseout', function()
            {
                UnTip();
            }
        ); 
    };
    
    if ($('glossary_link')){
        Event.observe('glossary_link', 'click', function()
            {
                openGlosWindow('/glossary_search.php','glosspopup','scrollbars=yes,resizable=yes,width=450,height=300');
            }   
        );
    };
    // anthologies popup
    if ('anthologies_hidden'){
        
        if ($('anthologies')){
            Event.observe('anthologies', 'click', function()
                {
                    TagToTip('anthologies_hidden', CLICKSTICKY, true, CLOSEBTN, true, FIX, [this, 0, 0], WIDTH, 400, TITLE, 'Anthology Items');
                }
            );
        }
        
        if ($('anthologies2')){
            Event.observe('anthologies2', 'click', function()
                {
                    TagToTip('anthologies_hidden', CLICKSTICKY, true, CLOSEBTN, true, FIX, [this, 0, 0], WIDTH, 400, TITLE, 'Anthology Items');
                }
            );
        }
    }
    
    if ($('MenuBar1')){
        var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"/SpryAssets/SpryMenuBarDownHover.gif", imgRight:"/SpryAssets/SpryMenuBarRightHover.gif"});
    }
    
    if ($('print_article')){
        Event.observe('print_article', 'click', function(){
            switch($('article_type_id').innerHTML){
                case '1':
                    print_version_people($('article_id').innerHTML);
                    break;
                case '2':
                    print_version_topics($('article_id').innerHTML);
                    break;
                case '3':
                    print_version_works($('article_id').innerHTML);
            }       
        });
    }
    
    if ($('add_to_bookshelves')){
        Event.observe('add_to_bookshelves', 'click', function(){
            
            switch($('article_type_id').innerHTML){
                case '1':
                    var table = 'people';
                    break;
                case '2':
                    var table = 'topics';
                    break;
                case '3':
                    var table = 'works';
                    break;
            }
            openGlosWindow('/php/save_article.php?uid=' + $('article_id').innerHTML + '&headword=' + $('headword').innerHTML + '&table=' + table,'savepopup','scrollbars=yes,resizable=yes,width=350,height=210');
        });
    }
    
    // see if there is shortnote information
    if ($('shortnote')){
        Event.observe('shortnote', 'mouseover', function(){
            TagToTip('shortnote_text', WIDTH, 200, TITLE, 'Short Notes');
        });
        
        Event.observe('shortnote', 'mouseout', function(){
            UnTip();
        });
        
    }
    
    if ($('anthologies')){
        Event.observe('anthologies', 'mouseover', function(){
            TagToTip('anthologies_hidden', CLICKSTICKY, true, CLICKCLOSE, true, CLOSEBTN, true, WIDTH, 400, TITLE, 'Anthologies', FIX, ['anthologies', 0, 5]);    
        });
    };
    
    $$('.remove_value_on_click').each(function(el){
        Event.observe(el.identify(), 'click', function(){
            this.value = '';    
        }); 
    });  
    
    // expand a div on its being clicked
    if ($('expand_browse_list_trigger')){
        Event.observe('expand_browse_list_trigger', 'click', function(){
            $('expandable_browse_list').show();            
        });
    }
  
});
