/* © Copyright 2008, Pitney Bowes MapInfo Corporation. All rights reserved. */
// This source code is provided under license on a royalty free basis for use by licensed users of the
// Exponare product. Licensed users may create derivative works of this source code for use solely in
// connection with Exponare. This source code is provided "AS IS". Pitney Bowes MapInfo Corporation makes no
// representations or warranties, express or implied with respect to this source code, including by way
// of example and not limitation, the implied warranties of merchantability and fitness for a
// particular purpose. The entire risk as to the modification and use of this source code is assumed by
// you. In no event shall Pitney Bowes MapInfo Corporation be liable to you or any other person regardless of the
// cause, for the effectiveness or accuracy of this source code, or for any special, indirect,
// incidental or consequential damages arising from or occasioned by your use of this source code in
// modified or unmodified form, even if advised of the possibility of such damages.
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
//
// CONSTANTS
//
//-----------------------------------------------------------------------------

        

    var d,f,e,o
    d = document
    
    for (i=0;i<d.forms.length;i++)
    {
    
    	f = d.forms[i];
    	for (ii=0;ii<f.elements.length;ii++)
    	{
    		e = f.elements[ii]
    		if (e.type == "select-one")
    		{
    			for(iii=0;iii<e.options.length;iii++)
    			{
    				o = e.options[iii]
    				
    				if (o.text==AddressPanel)
    				{
    					
    					if (ById('buttonAddressSearch') != null )
    					{
							ById('buttonAddressSearch').itemtype = 'Menu';
							ById('buttonAddressSearch').en = 'true';
							ById('buttonAddressSearch').istoplevel = 'true';
							ById('buttonAddressSearch').tn = 'FindAddress';
							ById('buttonAddressSearch').title = AddressPanel;
							ById('buttonAddressSearch').menu = 'menu_999999991';
							buttonAddressSearch_imgone = document.createElement('IMG');
							//buttonAddressSearch_imgone.src = 'Images/Framework/UnChecked.gif';							
							buttonAddressSearch_imgone.align = 'middle';
							ById('buttonAddressSearch').appendChild(buttonAddressSearch_imgone);
							ById('buttonAddressSearch').imageOne = buttonAddressSearch_imgone;	 							
							ById('buttonAddressSearch').appendChild(document.createTextNode(AddressPanel));
							
							ById('buttonAddressSearch').onclick=function(){selectNewPanel(AddressPanel);};
	    					if (o.selected)
	    					ById('buttonAddressSearch').ip = 'true';
    					}
    				}
					else if (o.text==PrintPanel )
					{
						if (ById('buttonPrint') != null){        
							ById('buttonPrint').itemtype = 'Menu';
							ById('buttonPrint').en = 'true';
							ById('buttonPrint').istoplevel = 'true';
							ById('buttonPrint').tn = 'Print';
							ById('buttonPrint').title = PrintPanel;
							ById('buttonPrint').menu = 'menu_999999991';
							buttonPrint_imgone = document.createElement('IMG');
							//buttonPrint_imgone.src = 'Images/Framework/UnChecked.gif';
							buttonPrint_imgone.align = 'middle';
							ById('buttonPrint').appendChild(buttonPrint_imgone);
							ById('buttonPrint').imageOne = buttonPrint_imgone;	 							
							ById('buttonPrint').appendChild(document.createTextNode(PrintPanel));
							
							ById('buttonPrint').onclick=function(){selectNewPanel(PrintPanel);};							
							if (o.selected)
							ById('buttonPrint').ip = 'true';
						}
					}
					else if (o.text==InfoPanel)
					{
					    				
						if (ById('buttonInfo') != null)
						{
							ById('buttonInfo').itemtype = 'Menu';
							ById('buttonInfo').en = 'true';
							ById('buttonInfo').istoplevel = 'true';
							ById('buttonInfo').tn = 'Info';
							ById('buttonInfo').title = InfoPanel;
							ById('buttonInfo').menu = 'menu_999999991';
							buttonInfo_imgone = document.createElement('IMG');
							//buttonInfo_imgone.src = 'Images/Framework/UnChecked.gif';
							buttonInfo_imgone.align = 'middle';
							ById('buttonInfo').appendChild(buttonInfo_imgone);
							ById('buttonInfo').imageOne = buttonInfo_imgone;	 							
							ById('buttonInfo').appendChild(document.createTextNode(InfoPanel));
							
							ById('buttonInfo').onclick=function(){selectNewPanel(InfoPanel);};							

							if (o.selected)
							ById('buttonInfo').ip = 'true';

						}
					}
					else if (o.text==LegendPanel)
					{
					
						if (ById('buttonLegend') != null){   	
						
							ById('buttonLegend').itemtype = 'Menu';
							ById('buttonLegend').en = 'true';
							ById('buttonLegend').istoplevel = 'true';
							ById('buttonLegend').tn = 'legend';
							ById('buttonLegend').title = LegendPanel;
							ById('buttonLegend').menu = 'menu_999999991';
							buttonLegend_imgone = document.createElement('IMG');
							//buttonLegend_imgone.src = 'Images/Framework/UnChecked.gif';							
							buttonLegend_imgone.align = 'middle';
							ById('buttonLegend').appendChild(buttonLegend_imgone);
							ById('buttonLegend').imageOne = buttonLegend_imgone;								
							ById('buttonLegend').appendChild(document.createTextNode(LegendPanel));
							
							ById('buttonLegend').onclick=function(){selectNewPanel(LegendPanel);};							
					
							if (o.selected)
							ById('buttonLegend').ip = 'true';
						}
					}
					else if (o.text==QueriesPanel )
					{
						if (ById('buttonQueries') != null){   	
						
							ById('buttonQueries').itemtype = 'Menu';
							ById('buttonQueries').en = 'true';
							ById('buttonQueries').istoplevel = 'true';
							ById('buttonQueries').tn = 'Queries';
							ById('buttonQueries').title = QueriesPanel;
							ById('buttonQueries').menu = 'menu_999999991';
							buttonQueries_imgone = document.createElement('IMG');
							//buttonQueries_imgone.src = 'Images/Framework/UnChecked.gif';
							buttonQueries_imgone.align = 'middle';
							ById('buttonQueries').appendChild(buttonQueries_imgone);
							ById('buttonQueries').imageOne = buttonQueries_imgone;	 							
							ById('buttonQueries').appendChild(document.createTextNode(QueriesPanel));
							
							ById('buttonQueries').onclick=function(){selectNewPanel(QueriesPanel);};							
						
							if (o.selected)
							ById('buttonQueries').ip = 'true';
						}
					}
    			}
    		}
    	}
    }

if (ById('buttonAddressSearch') != null)
    PrepareItem(ById('buttonAddressSearch'));
if (ById('buttonPrint') != null)    
    PrepareItem(ById('buttonPrint'));
if (ById('buttonInfo') != null)
    PrepareItem(ById('buttonInfo'));
if (ById('buttonLegend') != null)    
    PrepareItem(ById('buttonLegend'));
if (ById('buttonQueries') != null)
    PrepareItem(ById('buttonQueries'));
    
    
    
