/*
 * 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:"../en/about/himaxdisplay.asp",
					hrefTarget:"_self"
				},
				{
					text: 'Quality Policy',
					href:"../en/about/iso.asp",
					hrefTarget:"_self"
				}
/*				
				, {
					text: 'Company Milestone',
					group: 'theme',
					href:"../en/about/milestone.asp",
					hrefTarget:"_self"
				}, {
					text: 'Core Technologies',
					group: 'theme',
					href:"../en/about/core.asp",
					hrefTarget:"_self"
				}
*/
        ]
    });
/*
    var menu2 = new Ext.menu.Menu({
        id: 'mainMenu2',
        items: [
				{
					text: 'ISO 9001 Certification',
					href:"../en/quality/iso.asp",
					hrefTarget:"_self"
				}, {
					text: 'ISO 14001 Certicifation',
					href:"../en/quality/iso14001.asp",
					hrefTarget:"_self"
				}, {
					text: 'Quality System Flow',
					href:"../en/quality/quality.asp",
					hrefTarget:"_self"
				}, {
					text: 'Reliability Assurance',
					href:"../en/quality/reliability.asp",
					hrefTarget:"_self"
				}, {
					text: 'Green Product Specification',
					href:"../en/quality/Green_product.asp",
					hrefTarget:"_self"
				}, {
					text: 'Environmental Strategy',
					href:"../en/quality/Environmental.asp",
					hrefTarget:"_self"
				}
        ]
    });

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

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


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


		var menu7 = new Ext.menu.Menu({
        id: 'mainMenu7',
        items: [
               {
					text: 'Color Filter On LCOS',
					href:"../en/Technology/CFonLCOS.asp",
					hrefTarget:"_self"
				},
				{
					text: 'Himax iIE engine',
					href:"../en/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:'100%'
		}
	);
    tb.render('toolbar');

 
tb.addSpacer();
tb.addSpacer();
tb.addSpacer();
tb.addSpacer();
tb.addSpacer();
tb.addSpacer();
	tb.addSeparator();
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.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.add({
            text:'Quality Policy',
            iconCls: 'bmenu',  // <-- icon
            menu: menu2  // assign menu by instance
        });
	tb.addSpacer();
	/*tb.addSeparator();
	tb.addSpacer();
    tb.add({
            text:'News',
            iconCls: 'bmenu',  // <-- icon
            menu: menu3  // assign menu by instance
        });*/
/*
	tb.addSpacer();
	tb.addSeparator();
	tb.addSpacer();
*/
    tb.add({
            text:'Products',
            iconCls: 'bmenu',
			menu: menu6 
        });
 tb.addSpacer();
 tb.addSpacer();
 tb.addSpacer();
	tb.addSeparator();
 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.add({
            text:'News and Events',
            iconCls: 'bmenu',
			menu: menu3
        });

tb.addSpacer();
tb.addSpacer();
tb.addSpacer();
	tb.addSeparator();
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.add({
            text:'Contact Us',
            iconCls: 'bmenu',  // <-- icon
            menu: menu5  // 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.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 onProductToggle(){
		window.location.href="../en/product/info.asp";
    }
	function onCareersToggle(){
		window.location.href="http://www.himax.com.tw/ch/employment/search.asp";
		window.location.hreftarget="_blank";
    }
	function onNewsToggle(){
		window.location.href="../en/news/news.asp?typeId=S0004";
    }
	 function onHomeToggle(){
		window.location.href="../en/index.asp";
    }
});
