/*
 * Ext JS Library 1.1.1
 * Copyright(c) 2006-2007, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://www.extjs.com/license
 */
 var start=1;
var IsToolShow=0;
Ext.onReady(function(){
    Ext.QuickTips.init();

    // Menus can be prebuilt and passed by reference
    var dateMenu = new Ext.menu.DateMenu({
        handler : function(dp, date){
            Ext.example.msg('Date Selected', 'You chose {0}.', date.format('M j, Y'));
        }
    });

    // Menus can be prebuilt and passed by reference
    var colorMenu = new Ext.menu.ColorMenu({
        handler : function(cm, color){
            Ext.example.msg('Color Selected', 'You chose {0}.', color);
        }
    });
    
    
    
//---------------------------------Tools------------------------------//
        var custom = new Ext.Resizable('tools', {
            wrap:true,
            pinned:false,
            minWidth:50,
            minHeight: 50,
            width: 50,
            Height: 80,
            preserveRatio: false,
            enabled : false,
            //handles: 'all',
            draggable:true,
            dynamic:true
        });
        var customEl = custom.getEl();
        // move to the body to prevent overlap on my blog
        //document.body.insertBefore(customEl.dom, document.body.firstChild);
        
        //customEl.on('dblclick', function(){
            //customEl.hide(true);
        //});

//---------------------------------Tools----End--------------------------//
/*
    var menu = new Ext.menu.Menu({
        id: 'mainMenu',
        items: [
            new Ext.menu.CheckItem({
                text: 'I like Ext',
                checked: true,
                checkHandler: onItemCheck
            }),
            new Ext.menu.CheckItem({
                text: 'Ext for jQuery',
                checked: true,
                checkHandler: onItemCheck
            }),
            new Ext.menu.CheckItem({
                text: 'I donated!',
                checked:false,
                checkHandler: onItemCheck
            }), '-', {
                text: 'Radio Options',
                menu: {        // <-- submenu by nested config object
                    items: [
                        // stick any markup in a menu
                        '<b class="menu-title">Choose a Theme</b>',
                        new Ext.menu.CheckItem({
                            text: 'Aero Glass',
                            checked: true,
                            group: 'theme',
                            checkHandler: onItemCheck
                        }),
                        new Ext.menu.CheckItem({
                            text: 'Vista Black',
                            group: 'theme',
                            checkHandler: onItemCheck
                        }),
                        new Ext.menu.CheckItem({
                            text: 'Gray Theme',
                            group: 'theme',
                            checkHandler: onItemCheck
                        }),
                        new Ext.menu.CheckItem({
                            text: 'Default Theme',
                            group: 'theme',
                            checkHandler: onItemCheck
                        })
                    ]
                }
            },{
                text: 'Choose a Date',
                cls: 'calendar',
                menu: dateMenu // <-- submenu by reference
            },{
                text: 'Choose a Color',
                menu: colorMenu // <-- submenu by reference
            }
        ]
    });
*/
    var tb = new Ext.Toolbar('toolbar');
    tb.add(
    /*
    {
    	
            cls: 'x-btn-text-icon bmenu', // icon and text class
            
            text:'Search By...',
            
            menu:{items: [
                        {text: '<b>Search By House Number</b>', handler: onViewNumber},
                        {text: '<b>Search By Street Name</b>', handler: onViewName}
                ]}
        }, 
        */
                   {
            text: 'Search',
            //handler: onButtonClick,
            //tooltip: {text:'Hide or Show the Tools Box', title:'Tools', autoHide:true},
            cls: 'x-btn-text-icon bsearch',
            handler: function(){
            	window.open("http://www.deltacomputersystems.com/AL/AL20/plinkquerya.html","_blank","height=700,width=800,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes");

            	}


        },
           {
            text: 'Tools',
            //handler: onButtonClick,
            tooltip: {text:'Hide or Show the Tools Box', title:'Tools', autoHide:true},
            cls: 'x-btn-text-icon bview',
            handler: onViewTools


        },
{
            text: 'Layers',
            //handler: onButtonClick,
            //tooltip: {text:'', title:'Layers', autoHide:true},
            cls: 'x-btn-text-icon blist',
            // Menus can be built/referenced by using nested menu config objects
            menu : {items: [
                        {
                        text: '<b>Parcel Line</b>', 
                        //handler: onViewTools,
                menu :{
                    items: [
                        // stick any markup in a menu
                        '<b class="menu-title">Choose Theme</b>',
                       {
                            text: '<b>ON',
                            //checked: false,
                            //group: 'theme',
                            handler: onItemCheck1
                        },
                        {
                            text: '<b>OFF',
                            //group: 'theme',
                            handler: onItemCheck2
                        }
                    ]
                
            }
                        
                        
                        },
                        {
                                                text: '<b>2007 Spring Color Image</b>', 
                        //handler: onViewTools,
                menu :{
                    items: [
                        // stick any markup in a menu
                        '<b class="menu-title">Choose Theme</b>',
                        {
                            text: '<b>ON',
                            //checked: false,
                            //group: 'theme1',
                            handler: onItemCheck3
                        },
                       {
                            text: '<b>OFF',
                            //group: 'theme1',
                            handler: onItemCheck4
                        }
                    ]
                
            }	
                        	
                        	},
                        	{
                        	                        text: '<b>2010 Black & White Image</b>', 
                        //handler: onViewTools,
                menu :{
                    items: [
                        // stick any markup in a menu
                        '<b class="menu-title">Choose Theme</b>',
                       {
                            text: '<b>ON',
                            //checked: false,
                            //group: 'theme2',
                            handler: onItemCheck5
                        },
                       {
                            text: '<b>OFF',
                            //group: 'theme2',
                            handler: onItemCheck6
                        }
                    ]
                
            }	
                        		}
                ]}
        }, '-',
        {
                    text: 'Entire County',
            handler: onButtonClick,
            //tooltip: {text:'', title:'Entire County', autoHide:true},
            cls: 'x-btn-text-icon ball'	
        	
        	}
        , '-',
        {
                    text: 'Pan View',
            handler: onButtonClick1,
            //tooltip: {text:'', title:'Move', autoHide:true},
            cls: 'x-btn-text-icon bpan'	
        	
        	}, '-',
        {
	
        	
        	
        	                    text: 'Zoom In',
            handler: onButtonClick2,
            //tooltip: {text:'', title:'Zoom In', autoHide:true},
            cls: 'x-btn-text-icon bzoomin'	
        	}, '-',
        {
                    text: 'Zoom Out',
            handler: onButtonClick3,
            //tooltip: {text:'', title:'Zoom Out', autoHide:true},
            cls: 'x-btn-text-icon bzoomout'	
        	
        	}, '-',
        {
                    text: 'Go Forward',
            handler: onButtonClick4,
            //tooltip: {text:'', title:'Go Forward', autoHide:true},
            cls: 'x-btn-text-icon bredo'	
        	
        	}, '-',
        {
                    text: 'Go Back',
            handler: onButtonClick5,
            //tooltip: {text:'', title:'Go Back', autoHide:true},
            cls: 'x-btn-text-icon bundo'	
        	
        	}, '-',
        {
                    text: 'Measure',
            handler: onButtonClick6,
            //tooltip: {text:'', title:'Measure', autoHide:true},
            cls: 'x-btn-text-icon bmser'	
        	
        	}, '-',
        {
                    text: 'Identify',
            handler: onButtonClick7,
            //tooltip: {text:'', title:'Identify', autoHide:true},
            cls: 'x-btn-text-icon binfor'	
        	
        	}, '-',
        {
                    text: 'Clear',
            handler: onButtonClick8,
            //tooltip: {text:'', title:'Clear', autoHide:true},
            cls: 'x-btn-text-icon bclear'	
        	
        	}, '-',
        {
                    text: 'Print',
            handler: onButtonClick9,
            //tooltip: {text:'', title:'Print', autoHide:true},
            cls: 'x-btn-text-icon bprint'	
        	
        	}, '-',
        {
                    text: 'Help',
            handler: getScale
        	
        	}
        
        
        
        );

   function getScale()
   {
   	try{top.MyWin.show();}catch(ee){top.win.MyWin.show();}
   
   }

    // functions to display feedback
    function onViewTools(){
    	if(IsToolShow==1)
    	{
    		
    		customEl.show(true);
    		IsToolShow=0;
    		//document.getElementById("TheTools").innerHTML="<b>hide Tools  </b>";
    		}
    	else
    	  {
    	  	
    	  	customEl.hide(true);
    	  	IsToolShow=1;
    	  	//document.getElementById("TheTools").innerHTML="<b>show Tools  </b>";
    	  	}
        //Ext.example.msg('Button Click','You clicked the "{0}" button.', btn.text);
    }


    function onViewInfor(){
    	
	    window.parent.Example.ShowHideWest();
	    return false;
              }
              
              
                  function onViewNumber(item){
    	 
	    window.parent.Example.ShowHideSearchNumber();

              }
              
                                function onViewName(item){
    	  
	    window.parent.Example.ShowHideSearchName();

              }
              
    function onItemCheck1()
    {
    	if(start==1)
    	{
      w1.ShowLayers("lineON");
      }
    }
        function onItemCheck2()
    {
    	if(start==1)
    	{
      w1.ShowLayers("lineOFF");
      }
    }
        function onItemCheck3()
    {
    	if(start==1)
    	{
      w1.ShowLayers("CLR3ON");
      }
    }
        function onItemCheck4()
    {
    	if(start==1)
    	{
      w1.ShowLayers("CLR3OFF");
      }
    }
        function onItemCheck5()
    {
    	if(start==1)
    	{
      w1.ShowLayers("BW7ON");
      }
    }
        function onItemCheck6()
    {
    	if(start==1)
    	{
      w1.ShowLayers("BW7OFF");
      }
    }
    
    
    function onButtonClick()
    {
    	C_buttondown('T_Ball');
    }
        function onButtonClick1()
    {
    	C_buttondown('T_Bmove');
    }
            function onButtonClick2()
    {
    	C_buttondown('T_Bzoom');
    }
                function onButtonClick3()
    {
    	C_buttondown('T_Bzoomout');
    }
                    function onButtonClick4()
    {
    	C_buttondown('T_Bredo');
    }
                        function onButtonClick5()
    {
    	C_buttondown('T_Bundo');
    }
                           function onButtonClick6()
    {
    	C_buttondown('T_Bmeasure');
    }
                               function onButtonClick7()
    {
    	C_buttondown('T_Bqu');
    }
                                   function onButtonClick8()
    {
    	C_buttondown('T_Bdel');
    }
    
                                       function onButtonClick9()
    {
    	w1.PrintMap()
    }
});

