/*
sidenav handler for EMEA OfficeConnect
Mark Birch September 2001
=====NOTES=====================================================================================================
arrSidenav['home'] = new TNavObject('SNhome' ...... if you want to have a spacer automatically added under it.
DEBUGGING:
send 'all' as argument to expand all parents & show all children.

3Com standard functions used (for simple integration with existing content):
select_url(...)
SwapImage(...)

===============================================================================================================
*/

//image pre-loads

/*
This is where we tell the function where the files are.
Pre-load all the images as normal.
It's helpful to fully comment what each image is for future reference (as shown below)
*/

//HOME
wireless_0 = new Image();
wireless_0.src = "/products/assets/wireless_0.gif";
wireless_1 = new Image();
wireless_1.src = "/products/assets/wireless_1.gif";

//WIRELESS PRODUCT PARENT IMAGE
wlsproduct_0 = new Image();
wlsproduct_0.src = "/products/assets/wlsproduct_0.gif";
wlsproduct_1 = new Image();
wlsproduct_1.src = "/products/assets/wlsproduct_1.gif";

//WIRELESS PRODUCT  CHILDREN
wls_wb_0 = new Image();
wls_wb_0.src = "/products/assets/wls_wb_0.gif";
wls_wb_1 = new Image();
wls_wb_1.src = "/products/assets/wls_wb_1.gif";

wls_ap6000_0 = new Image();
wls_ap6000_0.src = "/products/assets/wls_ap6000_0.gif";
wls_ap6000_1 = new Image();
wls_ap6000_1.src = "/products/assets/wls_ap6000_1.gif";

wls_pcc_xj_0 = new Image();
wls_pcc_xj_0.src = "/products/assets/wls_pcc_xj_0.gif";
wls_pcc_xj_1 = new Image();
wls_pcc_xj_1.src = "/products/assets/wls_pcc_xj_1.gif";

wls_ap_0 = new Image();
wls_ap_0.src = "/products/assets/wls_ap_0.gif";
wls_ap_1 = new Image();
wls_ap_1.src = "/products/assets/wls_ap_1.gif";

wls_pc_0 = new Image();
wls_pc_0.src = "/products/assets/wls_pc_0.gif";
wls_pc_1 = new Image();
wls_pc_1.src = "/products/assets/wls_pc_1.gif";

wls_pci_0 = new Image();
wls_pci_0.src = "/products/assets/wls_pci_0.gif";
wls_pci_1 = new Image();
wls_pci_1.src = "/products/assets/wls_pci_1.gif";

wls_home_gwy_0 = new Image();
wls_home_gwy_0.src = "/products/assets/wls_home_gwy_0.gif";
wls_home_gwy_1 = new Image();
wls_home_gwy_1.src = "/products/assets/wls_home_gwy_1.gif";

wls_b2b_bridge_0 = new Image();
wls_b2b_bridge_0.src = "/products/assets/wls_b2b_bridge_0.gif";
wls_b2b_bridge_1 = new Image();
wls_b2b_bridge_1.src = "/products/assets/wls_b2b_bridge_1.gif";

wls_ec_bridge_0 = new Image();
wls_ec_bridge_0.src = "/products/assets/wls_ec_bridge_0.gif";
wls_ec_bridge_1 = new Image();
wls_ec_bridge_1.src = "/products/assets/wls_ec_bridge_1.gif";

wls_ap8000_0 = new Image();
wls_ap8000_0.src = "/products/assets/wls_ap8000_0.gif";
wls_ap8000_1 = new Image();
wls_ap8000_1.src = "/products/assets/wls_ap8000_1.gif";

//WIRELESS BLUETOOTH PARENT IMAGE
wlsbluetooth_0 = new Image();
wlsbluetooth_0.src = "/products/assets/wlsbluetooth_0.gif";
wlsbluetooth_1 = new Image();
wlsbluetooth_1.src = "/products/assets/wlsbluetooth_1.gif";


//WIRELESS BLUETOOTH CHILDREN
wls_blue_pcc_0 = new Image();
wls_blue_pcc_0.src = "/products/assets/wls_blue_pcc_0.gif";
wls_blue_pcc_1 = new Image();
wls_blue_pcc_1.src = "/products/assets/wls_blue_pcc_1.gif";

wls_blue_usb_0 = new Image();
wls_blue_usb_0.src = "/products/assets/wls_blue_usb_0.gif";
wls_blue_usb_1 = new Image();
wls_blue_usb_1.src = "/products/assets/wls_blue_usb_1.gif";


//WIRELESS LAN ACCESSORIES PARENT IMAGE
wlsaccessory_0 = new Image();
wlsaccessory_0.src = "/products/assets/wlsaccessory_0.gif";
wlsaccessory_1 = new Image();
wlsaccessory_1.src = "/products/assets/wlsaccessory_1.gif";

//WIRELESS LAN ACCESSORIES CHILDREN
wls_ant_cab6_0 = new Image();
wls_ant_cab6_0.src = "/products/assets/wls_ant_cab6_0.gif";
wls_ant_cab6_1 = new Image();
wls_ant_cab6_1.src = "/products/assets/wls_ant_cab6_1.gif";

wls_ant_cab20_0 = new Image();
wls_ant_cab20_0.src = "/products/assets/wls_ant_cab20_0.gif";
wls_ant_cab20_1 = new Image();
wls_ant_cab20_1.src = "/products/assets/wls_ant_cab20_1.gif";

wls_ant_cab50_0 = new Image();
wls_ant_cab50_0.src = "/products/assets/wls_ant_cab50_0.gif";
wls_ant_cab50_1 = new Image();
wls_ant_cab50_1.src = "/products/assets/wls_ant_cab50_1.gif";

wls_ant_omni4_0 = new Image();
wls_ant_omni4_0.src = "/products/assets/wls_ant_omni4_0.gif";
wls_ant_omni4_1 = new Image();
wls_ant_omni4_1.src = "/products/assets/wls_ant_omni4_1.gif";

wls_ant_omni8_0 = new Image();
wls_ant_omni8_0.src = "/products/assets/wls_ant_omni8_0.gif";
wls_ant_omni8_1 = new Image();
wls_ant_omni8_1.src = "/products/assets/wls_ant_omni8_1.gif";

wls_ant_sec13_0 = new Image();
wls_ant_sec13_0.src = "/products/assets/wls_ant_sec13_0.gif";
wls_ant_sec13_1 = new Image();
wls_ant_sec13_1.src = "/products/assets/wls_ant_sec13_1.gif";

wls_ant_sec18_0 = new Image();
wls_ant_sec18_0.src = "/products/assets/wls_ant_sec18_0.gif";
wls_ant_sec18_1 = new Image();
wls_ant_sec18_1.src = "/products/assets/wls_ant_sec18_1.gif";

wls_pwr_bt_0 = new Image();
wls_pwr_bt_0.src = "/products/assets/wls_pwr_bt_0.gif";
wls_pwr_bt_1 = new Image();
wls_pwr_bt_1.src = "/products/assets/wls_pwr_bt_1.gif";

wls_access_pps_0 = new Image();
wls_access_pps_0.src = "/products/assets/wls_access_pps_0.gif";
wls_access_pps_1 = new Image();
wls_access_pps_1.src = "/products/assets/wls_access_pps_1.gif";

wls_access_pp_0 = new Image();
wls_access_pp_0.src = "/products/assets/wls_access_pp_0.gif";
wls_access_pp_1 = new Image();
wls_access_pp_1.src = "/products/assets/wls_access_pp_1.gif";

mb_0 = new Image();
mb_0.src = "/products/assets/mb_0.gif";
mb_1 = new Image();
mb_1.src = "/products/assets/mb_1.gif";

wls_ant_omni2_5_0 = new Image();
wls_ant_omni2_5_0.src = "/products/assets/wls_ant_omni2_5_0.gif";
wls_ant_omni2_5_1 = new Image();
wls_ant_omni2_5_1.src = "/products/assets/wls_ant_omni2_5_1.gif";

wls_ant_bi4_0 = new Image();
wls_ant_bi4_0.src = "/products/assets/wls_ant_bi4_0.gif";
wls_ant_bi4_1 = new Image();
wls_ant_bi4_1.src = "/products/assets/wls_ant_bi4_1.gif";

wls_ant_pan8_0 = new Image();
wls_ant_pan8_0.src = "/products/assets/wls_ant_pan8_0.gif";
wls_ant_pan8_1 = new Image();
wls_ant_pan8_1.src = "/products/assets/wls_ant_pan8_1.gif";

  //PARENT SWITCHFINDER
switchfinder_0 = new Image();
switchfinder_0.src = "/products/assets/switchfinder_0.gif";
switchfinder_1 = new Image();
switchfinder_1.src = "/products/assets/switchfinder_1.gif";



//Objects.
/*
We will use an object to hold all information relevant to each clickable sidenav image.
*/

//argChildren is an array
//argOn & argOff are references to a TImage object
function TNavObject(argName, argOff, argOn, argHeight, argLink, argAlt, argParent, argChildren) 
{
  //data
  this.name			  = argName;	    //a text identifier, for use to identify image for rollovers. Not important outside of the page's html, used to identify each image: in <img name= ..... >
  this.on 			  = argOn;	      //reference to an image object
  this.off 			  = argOff;	      //reference to an image object
  this.urlLink 		= argLink;		  //url to a page
  this.parent 		= argParent;	  //reference to a TNavObject or null
  this.children 	= argChildren;  //Array of strings or null
  this.alt			  = argAlt;		    //alt tag
  this.height     = argHeight;    // height of image
  //methods
  this.makeActive = makeActive;   //make the OFF state the same as the ON state
  this.asHTML   	= asHTML;       //a function to return a string of HTML using the object's parameters.
  this.childrenContains = childrenContains; //boolean - does the array of children (text ovjects) contain the current text reference ?
  return this;
}

//method of TNavObject
function makeActive() //mark this Nav object as active.
{
  this.off = this.on;
}

//method of TNavObject
function asHTML(argCurrent) //return the HTML for the page
{//if argCurrent is a child, return also the code for all child objects.
  var childObject;
  ret = ( (arrSidenav[argCurrent] != this) ? '<a href="' + this.urlLink + '" onMouseOver="SwapImage(\'' + this.name + '\',\'' + this.on + '\')" onMouseOut= "SwapImage(\'' + this.name + '\',\'' + this.off + '\')">' : '');
  ret += '<img name="' + this.name + '" src="' + eval(this.off + '.src') + '" width="153" height="' + this.height + '" border="0" alt="' + this.alt + '">' + ( (arrSidenav[argCurrent] != this) ? '</a>' : '') + '<br>';
  //if this is the home button, add a blank spacer underneath it.
  if(this.name == 'SNhome')
    ret += '<img src="/assets/spacer_rollover.gif" width="153" height="20" alt="" border="0"><br>'; 
  //is argCurrect a child of this node? OR print all children if this is currently selected parent node (and there are any children!).
  
  if( this.childrenContains(argCurrent) || (this == arrSidenav[argCurrent] && this.children) || (argCurrent == 'all' && this.children) )
  {
	//print out the children.
	for(c = 0;c < this.children.length; c++)
	{
	  childObject = arrSidenav[this.children[c]];
	  ret += ( (arrSidenav[argCurrent] != childObject) ? '<a href="' + childObject.urlLink + '" onMouseOver="SwapImage(\'' + childObject.name + '\',\'' + childObject.on + '\')" onMouseOut= "SwapImage(\'' + childObject.name + '\',\'' + childObject.off + '\')">' : '');
      ret += '<img name="' + childObject.name + '" src="' + eval(childObject.off + '.src') + '" width="153" height="' + childObject.height + '" border="0" alt="' + childObject.alt + '">' + ( (arrSidenav[argCurrent] != childObject) ? '</a>' : '') + '<br>';
    }
  }
  return ret;
}

//method of TNavObject
function childrenContains(argCurrent)
{//boolean. look for argCurrent in this object's children array
  if (this.children == null)
    return false;
  for(c = 0; c < this.children.length; c++)
  {
    if(this.children[c] == argCurrent)
	  return true;
  }
  return false;
}


//Instantiate objects;
//list of all parent nav objects
  var arrParents = new Array('home','wlsproduct','wlsbluetooth','wlsaccessory','switchfinder'); //**** UPDATE THIS SO IT KNOWS ABOUT ALL PARENT OBJECTS ONLY (NOT CHILDREN).
//associative array of TNavObject objects.
  var arrSidenav = new Array();
  
/*initialize elements in the sidenav array.
Terminology: 
Parent = the sidenav elements like 'home' - blue roundangle shapes with text inside.
Child  = subnav elements, like 'Dual speed Switch 5 Plus'.

Explaination of arguments:
  arrSidenav['home']  =  new TNavObject('SNhome',    'ochome_0','ochome_1',  28          '/produits/officeconnect/','OfficeConnect&reg; Home',      null,                null); 
               ^                          ^            ^          ^           ^                 ^                        ^                           ^                    ^
    Element name. This is           Internal name     These are references  This is          This is the URL for     This is the ALT text.       This is the array      This is an array of
    sent from HTML page             used to refer     to pre-loaded images, the image        the link.                                           element name of        children element names.
    to identify the current         to the image.     defined above.        height.                                                              this element's         See 'switches' for 
    navigation. NO duplicate        Just use SN                                                                                                  parent. It will only   correct syntax.
    names are allowed.              followed by a                                                                                                be required by                 
                                    sensible word.                                                                                               child elements.


*NOTE if you add elements (which presumably you will - after all this is only a template!!), make sure you add the parents (not children) to the arrParents array, above, in the correct order. Be sure to let the parents know who the children are, and vice-versa (the last 2 arguments).

*/
  //parent
  arrSidenav['home']           = new TNavObject('SNhome','wireless_0','wireless_1',24,'/products/wireless/','Wireless Networking Products',null,null);
  
  //parent
  arrSidenav['wlsproduct']     = new TNavObject('SNwlsproduct','wlsproduct_0','wlsproduct_1',24,'/products/wireless/wlsproduct.html','11 Mbps Wireless LAN Products',null,new Array('wls_wb','wls_ap6000','wls_pcc_xj','wls_ap','wls_pc','wls_pci','wls_home_gwy','wls_b2b_bridge','wls_ec_bridge','wls_ap8000'));
  //children
  arrSidenav['wls_wb']		   = new TNavObject('SNwls_wb','wls_wb_0','wls_wb_1',28,'/products/wireless/wls_wb.html','3ComŽ 11 Mbps Wireless LAN Workgroup Bridge','wlsproduct',null);
  arrSidenav['wls_ap6000']     = new TNavObject('SNwls_ap6000','wls_ap6000_0','wls_ap6000_1',28,'/products/wireless/wls_ap6000.html','3Com&reg; 11 Mbps Wireless LAN Access Point 6000','wlsproduct',null);
  arrSidenav['wls_pcc_xj']     = new TNavObject('SNwls_pcc_xj','wls_pcc_xj_0','wls_pcc_xj_1',28,'/products/wireless/wls_pcc_xj.html','3Com&reg; 11 Mbps Wireless LAN PC Card with XJACK&reg; Antenna','wlsproduct',null);
  arrSidenav['wls_ap']		   = new TNavObject('SNwls_ap','wls_ap_0','wls_ap_1',28,'/products/wireless/wls_ap.html','3Com&reg; AirConnect&reg; 11 Mbps Wireless LAN Access Point','wlsproduct',null);
  arrSidenav['wls_pc']		   = new TNavObject('SNwls_pc','wls_pc_0','wls_pc_1',28,'/products/wireless/wls_pc.html','3Com&reg; AirConnect&reg; 11 Mbps Wireless LAN PC Card','wlsproduct',null);                     
  arrSidenav['wls_pci']        = new TNavObject('SNwls_pci','wls_pci_0','wls_pci_1',28,'/products/wireless/wls_pci.html','3Com&reg; AirConnect&reg; 11 Mbps Wireless LAN PCI Card','wlsproduct',null);
  arrSidenav['wls_home_gwy']   = new TNavObject('SNwls_home_gwy','wls_home_gwy_0','wls_home_gwy_1',18,'/products/wireless/wls_home_gwy.html','3Com&reg; Home Wireless Gateway','wlsproduct',null);
  arrSidenav['wls_b2b_bridge'] = new TNavObject('SNwls_b2b_bridge','wls_b2b_bridge_0','wls_b2b_bridge_1',28,'/products/wireless/wls_b2b_bridge.html','3Com&reg; 11 Mbps Wireless LAN Building-to-Building Bridge','wlsproduct',null);
  arrSidenav['wls_ec_bridge']  = new TNavObject('SNwls_ec_bridge','wls_ec_bridge_0','wls_ec_bridge_1',18,'/products/wireless/wls_ec_bridge.html','3Com&reg; Ethernet Client Bridge','wlsproduct',null);
  arrSidenav['wls_ap8000']	   = new TNavObject('SNwls_ap8000','wls_ap8000_0','wls_ap8000_1',28,'/products/wireless/wls_ap8000.html','3Com&reg; 11 Mbps Wireless LAN Access Point','wlsproduct',null);
  
  //parent
  arrSidenav['wlsbluetooth']   = new TNavObject('SNwlsbluetooth','wlsbluetooth_0','wlsbluetooth_1',24,'/products/wireless/wlsbluetooth.html','Bluetooth Products',null,new Array('wls_blue_pcc','wls_blue_usb'));
  
  //children
  arrSidenav['wls_blue_pcc']   = new TNavObject('SNwls_blue_pcc','wls_blue_pcc_0','wls_blue_pcc_1',28,'/products/wireless/wls_blue_pcc.html','3Com&reg; Wireless Bluetooth PC Card','wlsbluetooth',null);
  arrSidenav['wls_blue_usb']   = new TNavObject('SNwls_blue_usb','wls_blue_usb_0','wls_blue_usb_1',28,'/products/wireless/wls_blue_usb.html','3Com&reg; Wireless Bluetooth USB Adapter','wlsbluetooth',null);
  
  //parent
  arrSidenav['wlsaccessory']   = new TNavObject('SNwlsaccessory','wlsaccessory_0','wlsaccessory_1',24,'/products/wireless/wlsaccessory.html','11Mbps Wireless LAN Accessories',null,new Array('wls_ant_cab6','wls_ant_cab20','wls_ant_cab50','wls_ant_omni4','wls_ant_omni8','wls_ant_sec13','wls_ant_sec18','wls_pwr_bt','wls_access_pps','mb','wls_ant_omni2_5','wls_ant_bi4','wls_ant_pan8'));
  
  //children
  arrSidenav['wls_ant_cab6']   = new TNavObject('SNwls_ant_cab6','wls_ant_cab6_0','wls_ant_cab6_1',18,'/products/wireless/wls_ant_cab6.html','3Com&reg; 6-Foot Antenna Cable','wlsaccessory',null);
  arrSidenav['wls_ant_cab20']  = new TNavObject('SNwls_ant_cab20','wls_ant_cab20_0','wls_ant_cab20_1',18,'/products/wireless/wls_ant_cab20.html','3Com&reg; 20-Foot Antenna Cable','wlsaccessory',null);
  arrSidenav['wls_ant_cab50']  = new TNavObject('SNwls_ant_cab50','wls_ant_cab50_0','wls_ant_cab50_1',18,'/products/wireless/wls_ant_cab50.html','3Com&reg; 50-Foot Antenna Cable','wlsaccessory',null);
  arrSidenav['wls_ant_omni4']  = new TNavObject('SNwls_ant_omni4','wls_ant_omni4_0','wls_ant_omni4_1',28,'/products/wireless/wls_ant_omni4.html','3Com&reg; 4 dBi Omni-Directional Antenna','wlsaccessory',null);
  arrSidenav['wls_ant_omni8']  = new TNavObject('SNwls_ant_omni8','wls_ant_omni8_0','wls_ant_omni8_1',28,'/products/wireless/wls_ant_omni8.html','3Com&reg; 8 dBi Omni-Directional Antenna','wlsaccessory',null); 
  arrSidenav['wls_ant_sec13']  = new TNavObject('SNwls_ant_sec13','wls_ant_sec13_0','wls_ant_sec13_1',28,'/products/wireless/wls_ant_sec13.html','3Com&reg; 13 dBi Sector Panel Antenna','wlsaccessory',null);
  arrSidenav['wls_ant_sec18']  = new TNavObject('SNwls_ant_sec18','wls_ant_sec18_0','wls_ant_sec18_1',28,'/products/wireless/wls_ant_sec18.html','3Com&reg; 18 dBi Sector Panel Antenna','wlsaccessory',null);
  arrSidenav['wls_pwr_bt']     = new TNavObject('SNwls_pwr_bt','wls_pwr_bt_0','wls_pwr_bt_1',28,'/products/wireless/wls_pwr_bt.html','3Com&reg; AirConnect&reg; PowerBASE-T Module','wlsaccessory',null);
  arrSidenav['wls_access_pps'] = new TNavObject('SNwls_access_pps','wls_access_pps_0','wls_access_pps_1',28,'/products/wireless/wls_access_pps.html','3Com&reg; AirConnect&reg; Access Point Power Supply','wlsaccessory',null);
  arrSidenav['mb']             = new TNavObject('SNmb','mb_0','mb_1',28,'/products/wireless/mb.html','3Com&reg; AirConnect&reg; Access Point Mounting Bracket','wlsaccessory',null);
  arrSidenav['wls_ant_omni2_5']= new TNavObject('SNwls_ant_omni2_5','wls_ant_omni2_5_0','wls_ant_omni2_5_1',35,'/products/wireless/wls_ant_omni2_5.html','Antenna omnidirezionale con montaggio a soffitto 2.5 dBi 3Com&reg;','wlsaccessory',null);
  arrSidenav['wls_ant_bi4']	   = new TNavObject('SNwls_ant_bi4','wls_ant_bi4_0','wls_ant_bi4_1',28,'/products/wireless/wls_ant_bi4.html','Antenna omnidirezionale Hallway 4.0 dBi 3Com&reg;','wlsaccessory',null); 
  arrSidenav['wls_ant_pan8']   = new TNavObject('SNwls_ant_pan8','wls_ant_pan8_0','wls_ant_pan8_1',28,'/products/wireless/wls_ant_pan8.html','Antenna a pannelli 8.0 dBi 3Com&reg;','wlsaccessory',null);

  //parent
  arrSidenav['switchfinder']	= new TNavObject('SNswitchfinder','switchfinder_0','switchfinder_1',24,'javascript: select_url(\'/products/product_finders.html?backto=' + safeTitleString() + '\')"','Aiutami a scegliere...',null,null);//safeTitleString() is in page_templates.js


//function called from HTML
function drawSidenav(argCurrent) //eg. drawSidenav('dswitch16');
{
  //make current nav item active
  if(argCurrent != 'all')arrSidenav[argCurrent].makeActive();
  //draw all parent items.
  for(i = 0; i < arrParents.length; i++)
  {
    document.write(arrSidenav[arrParents[i]].asHTML(argCurrent)); //write out each parent. As the parent is written, check to see whether argCurrent is the name of a child. If so, write out the children.
  }

  document.write('<a href="http://www.3com.com/products/en_US/downloadsindex.jsp" onmouseover="document.downloads.src=\'/products/assets/downloads_1.gif\'"; onmouseout="document.downloads.src=\'/products/assets/downloads_0.gif\'"; target="_blank"><img name="downloads" src="/products/assets/downloads_0.gif" width="153" height="24" border="0" alt="Downloads"></a>');
}


