/*
 * Ext JS Library 2.2
 * Copyright(c) 2006-2008, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */

Ext.onReady(function(){
    Ext.QuickTips.init();

    // Menus can be prebuilt and passed by reference
    var menu = new Ext.menu.Menu({
        id: 'mainMenu',
        items: [
			{
					text: 'Company Profile',
					group: 'theme',
					href:"../about/himaxdisplay.asp",
					hrefTarget:"_self"
				},
				{
					text: 'Quality Policy',
					href:"../about/iso.asp",
					hrefTarget:"_self"
				}
        ]
    });

    var menu2 = new Ext.menu.Menu({
        id: 'mainMenu2',
        items: [
				{
					text: 'ISO 9001 Certification',
					href:"../quality/iso.asp",
					hrefTarget:"_self"
				}, {
					text: 'ISO 14001 Certicifation',
					href:"../quality/iso14001.asp",
					hrefTarget:"_self"
				}, {
					text: 'Quality System Flow',
					href:"../quality/quality.asp",
					hrefTarget:"_self"
				}, {
					text: 'Reliability Assurance',
					href:"../quality/reliability.asp",
					hrefTarget:"_self"
				}, {
					text: 'Green Product Specification',
					href:"../quality/Green_product.asp",
					hrefTarget:"_self"
				}, {
					text: 'Environmental Strategy',
					href:"../quality/Environmental.asp",
					hrefTarget:"_self"
				}
        ]
    });

   var menu3 = new Ext.menu.Menu({
        id: 'mainMenu3',
        items: [
				{
					text: 'Press Release',
					href:"../news/news.asp",
					hrefTarget:"_self"
				}, {
					text: 'Events',
					href:"../news/event.asp",
					hrefTarget:"_self"
				}
        ]
    });

    var menu5 = new Ext.menu.Menu({
        id: 'mainMenu5',
        items: [
				 {
					text: 'Maps',
					href:"../customerservice/contactus.asp",
					hrefTarget:"_self"
				},
				{
					text: 'Sales/Technical Support',
					href:"../customerservice/technical.asp",
					hrefTarget:"_self"
				}
        ]
    });


    var menu6 = new Ext.menu.Menu({
        id: 'mainMenu6',
        items: [
               {
					text: 'Product Information',
					href:"../product/info.asp",
					hrefTarget:"_self"
				},
				{
					text: 'Color-Filter LCOS',
					href:"../product/HX7015.asp",
					hrefTarget:"_self"
				},
				{
					text: 'Color-Sequential LCOS',
					href:"../product/HX7308.asp",
					hrefTarget:"_self"
				},
				{
					text: 'Controller IC',
					bodyStyle:{textAlign:'right'},
					href:"../product/HX6271.asp",
					hrefTarget:"_self"
				}
        ]
    });

var menu7 = new Ext.menu.Menu({
        id: 'mainMenu7',
        items: [
               {
					text: 'Color Filter On LCOS',
					href:"../Technology/CFonLCOS.asp",
					hrefTarget:"_self"
				},
				{
					text: 'Himax iIE engine',
					href:"../Technology/iIE_engine.asp",
					hrefTarget:"_self"
				}
			
        ]
    });


var menu8 = new Ext.menu.Menu({
        id: 'mainMenu8',
        items: [
               {
					text: 'Employment',
					href:"http://www.himax.com.tw/ch/employment/search.asp",
					hrefTarget:"_blank"
				}
        ]
    });


    var tb = new Ext.Toolbar(
		{id: 'mainMenuBar',
		 width:'80%'
		}
	);
    tb.render('toolbar');
    
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSeparator();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();

    tb.add({
            text:'Home',
            iconCls: 'bmenu',
			enableToggle: true,
			toggleHandler: onHomeToggle
        });
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSeparator();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();

    tb.add({
            text:'About Us',
            iconCls: 'bmenu',  // <-- icon
            menu: menu  // assign menu by instance
        });
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSeparator();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();


    tb.add({
            text:'Products',
            iconCls: 'bmenu',
			menu: menu6 
        });
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSeparator();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();


   tb.add({
            text:'Technology',
            iconCls: 'bmenu',
			menu: menu7 
        });
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSeparator();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();

	 tb.add({
            text:'News and Events',
            iconCls: 'bmenu',
			menu: menu3
        });
	tb.addSpacer();
	tb.addSeparator();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();

	 tb.add({
            text:'Employment',
            iconCls: 'bmenu',
		    menu: menu8
			
        });
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSeparator();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();


    tb.add({
            text:'Contact Us',
            iconCls: 'bmenu',  // <-- icon
            menu: menu5  // assign menu by instance
        });
    tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	/*tb.addSeparator();
	tb.addSpacer();
    tb.add({
            text:'Investor Relations',
            iconCls: 'bmenu',
			enableToggle: true,
			toggleHandler: onInvestorToggle
        });*/
	tb.addSpacer();
	tb.addSeparator();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
	tb.addSpacer();
/*   
	tb.add({
            text:'Employment',
            iconCls: 'bmenu',
			enableToggle: true,
			toggleHandler: onEmploymentToggle
        });	
    
*/
    // Menus have a rich api for
    // adding and removing elements dynamically
    //var item = menu.add({
        //text: 'Dynamically added Item'
    //});
    // items support full Observable API
    //item.on('click', onItemClick);



    // functions to display feedback
    function onInvestorToggle(){
		window.location.href="http://www.himax.com.tw/en/investor/ir-compintro.asp";
    }

    function onEmploymentToggle(){
		window.location.href="http://www.himax.com.tw/ch/employment/search.asp";
    }

    function onHomeToggle(){
		window.location.href="../index.asp";
    }
	
    function onProductToggle(){
		window.location.href="../product/info.asp";
    }
	function onCareersToggle(){
		window.location.href="http://www.himax.com.tw/ch/employment/search.asp";
		window.hreftarget="_blank";
    }
	function onNewsToggle(){
		window.location.href="../news/news.asp?typeId=S0004";
    }

});
