Ext.onReady(function(){

    Ext.QuickTips.init();

    var linksMenu = new Ext.menu.Menu({
        id: 'linksMenu',
        minWidth:175,
        items: [
            {
                text: 'RMBTC Yahoo Group',
                link: 'http://pets.groups.yahoo.com/group/rmbtc/',
                handler: onLinkClick
            },
            {
                text: 'ABTC Website',
                link: 'http://www.abtc.org',
                handler: onLinkClick
            },
            {
                text: '2011 ABTC Nationals',
                link: 'http://2011Nationals.zephyre.net',
                handler: onLinkClick,
                disabled: true
            }
        ]
    });

    var tb = new Ext.Toolbar();
    tb.render('menubar');
    tb.add(
			{
				text: 'Home',
				href: '/',
				handler: goToPage
			}, 
			'-',
			{
				text:'Membership',
				href: '/membership.phtml',
				handler: goToPage
			}, 
			'-',
			{
				text:'Events',
				href: '/events.phtml',
				handler: goToPage
			}, 
			'-',
			{
				text:'Merchandise',
				href: '/merchandise.phtml',
				handler: goToPage
			},
			{
				text:'Links',
				menu: linksMenu
			}
    );
    
    function onItemClick(item){
        Ext.Msg.alert('Menu Click', 'You clicked the "' + item.text + '" menu item.');
    }

    function onLinkClick(item){
        window.open(item.link);
    }

	 function goToPage(item)
	 {
	 	  window.location = item.href;
	 }

});
