/*
 * Ext JS Library 2.2
 */


Ext.onReady(function(){
    Ext.QuickTips.init();

    var familySubMenu = new Ext.menu.Menu({
        id: 'familySubMenu',
        minWidth:175,
        items: [
            {
                text: 'Zephyr',
				href: '/family/display_dog.phtml?call_name=Zephyr'
            },
            {
                text: 'Merlin',
				href: '/family/display_dog.phtml?call_name=Merlin'
            },
            {
                text: 'Moxie',
				href: '/family/display_dog.phtml?call_name=Moxie'
            },
            {
                text: 'Electra',
				href: '/family/display_dog.phtml?call_name=Electra'
            },
            {
                text: 'Meret',
				href: '/family/display_dog.phtml?call_name=Meret'
            },
            {
                text: 'Pan',
				link: 'http://www.opossum.com/ANebraskaPup/PanPages/',
				handler: openExternalLink
            },
            {
                text: 'Rustine',
				href: '/family/display_dog.phtml?call_name=Rustine'
            },
            {
                text: 'Caper',
				href: '/family/display_dog.phtml?call_name=Caper'
            },
            {
                text: 'Sage',
				href: '/family/display_dog.phtml?call_name=Sage'
            }
        ]
    });

    var littersSubMenu = new Ext.menu.Menu({
        id: 'littersSubMenu',
        minWidth:175,
        items: [
            {
                text: 'Zephyr - 1990 "Constellation" Litter',
				href: '/litters/1990'
            },
            {
                text: 'Zephyr - 1992 "Showtunes" Litter',
				href: '/litters/1992'
            },
            {
                text: 'Zephyr - 1994 "Mountain" Litter',
				href: '/litters/1994'
            },
            {
                text: 'Electra - 1998 "Singleton" Litter',
				href: '/litters/1998'
            },
            {
                text: 'Electra - 1999 "Rivers" Litter',
				href: '/litters/1999'
            },
            {
                text: 'Rustine - 2004 "Games" Litter',
				href: '/litters/2004'
            },
            {
                text: 'Rustine - 2007 "Classic Movies" Litter',
				href: '/litters/2007'
            },
            {
                text: 'Caper - 2008 "Game Shows" Litter',
				href: '/litters/2008'
            }
        ]
    });

    var toolsSubMenu = new Ext.menu.Menu({
        id: 'toolsSubMenu',
        minWidth:175,
        items: [
            {
                text: 'Prospective Pedigree Generator',
				href: '/pedgen/EnterSire.phtml'
            },
            {
                text: 'Pedigree Generator',
				href: '/pedgen/EnterName.phtml'
            }
        ]
    });

    var tb = new Ext.Toolbar();
    tb.render('toolbar');
    tb.add(
        {
			  text: 'Home',
			  href: '/',
			  handler: goToPage
        }, 
        '-',
        {
            text:'Our Family',
			menu: familySubMenu
        }, 
        '-',
		{
			text: 'Litters',
			menu: littersSubMenu
		},
        '-',
        {
            text:'Memorials',
            href: '/memorials.phtml',
			handler: goToPage
        }, 
        '-',
        {
            text:'Tools',
			menu: toolsSubMenu
        }, 
        '-',
        {
            text:'Links',
			href: '/links.phtml',
			handler: goToPage
        },
        '-',
        {
            text: 'About Us',
			href: '/aboutus.phtml',
			handler: goToPage
        },
        '-',
        {
            text:'Contact',
			href: '/contact.phtml',
			handler: goToPage
        }
    );

    function onItemClick(item){
        Ext.Msg.alert('Menu Click', 'You clicked the "' + item.text + '" menu item.');
    }

    function onEventClick(item){
        Ext.Msg.alert('Menu Click', 'You clicked the "' + item.text + '" Events menu item.');
    }

    function onScheduleClick(item){
        Ext.Msg.alert('Menu Click', 'You clicked the "' + item.text + '" menu item.');
    }

	 function goToPage(item)
	 {
	 	  window.location = item.href;
	 }

    function openExternalLink(item){
        window.open(item.link);
    }

});

