// ##### NAV.JS ##### //
/*

--------------------------------
4-25-03
1- Changed the old Consumer Battery link over to the new one.
2- Reduced height of Global Nav Table from 500 to 300 px. 
8-12-03
Added Stockcheck variable for link to Stockcheck server.
10-7-03
Removed Consumer Battery Link.
01-02-04
Changed footer image link to point to MECA folder.  Adjusted centering.
01-28-04
Added Display Components Link.
01-29-04
Added BusinessLink Link.
04-16-04
Added Regional Sites drop down menu; rearranged link order.
04-21-04
Removed "Display" from Navigation.
--------------------------------

This Javascript Include file is used on every page of the 
industrial solution site, that is any page that lives within
the http://www.panasonic.com/industrial/ directory, EXCEPT for the Homepage, which uses homenav.js. 

PURPOSE:
  Allows quick changes and updates to all global elements.
  
  > Provides the entire global navigation, which when the page is viewed
    is located on the far left of every page. The original site had the 
    global navigation on the bottom of the page, the redesign moved it to the
    left nav.
  > Provide a string to build the copyright image on every page.
  
  > Provide a string to build the top banner imagemap on every page.
  
  
 COMPONENTS:
 
    GLOBAL NAV STRING BUILDER:
        This consists of an ARRAY (var nav) which controls what the FULL NAME of
        the section it links to and the DIRECTORY in which it resides separated
        by a PIPE (|). 
        
        The GET CURRENT DIRECTORY section simply gets the document.location.pathname
        and splits on the "/". ( IE: http://www.panasonic.com/industrial/computer/ ) 
        We know the first element is blank, and we know the second element is "industrial".
        The third element ( getHilightState[2] ) is the directory the browser is referencing
        regardless of the file name. 
        
        The START WRITING NAVIGATION section of this file does the work.
        It creates a string, ( globalNavTable )
        For each element in the NAV ARRAY we check to see if the DIRECTORY 
        matches the current ARRAY ELEMENT. if it does we we simply add 
        correct HTML to the string that highlights the current table cell.
        This is accomplished by using the "hilightedNavCell" style.
        The entire string is called from memory from each individual 
        page using a document.write statement.
        
        This is the code found on each page:
          <script>
            // write out left global nav from nav.js
            document.write(globalNavTable);
          </script>
 
    FOOTER STRING BUILDER:
        This section builds the string ( var copyrightFooter)
        used to print out the global copyright image which is 
        centered under the content of every page.  The entire 
        string is called from memory from each individual 
        page using a document.write statement.
        
         This is the code found on each page:
         <script>
	          document.write(copyrightFooter);
        </script>
        
        
    BANNER IMAGEMAP BUILDER:
         This section builds the string ( var mapCoords)
        used to print out the global top banner imagemap which is 
        found on the top of evry page.  The entire 
        string is called from memory from each individual 
        page using a document.write(mapCoords) statement.
        
        This is the code found on each page:
        <script>
          document.write(mapCoords);
        </script>
     
*/


// #### BEGIN STOCK CHECK SEARCH FORM BUILDER ####
var stockSearch = '<a href="http://www.stkcheck.com/evs/panasonic/panasonicheader.asp" class="stockcheckNavLink">';
	stockSearch += '+ Check Distributor Inventory</a>';
	
var businessLink = '<a href="https://b2b.panasonic.com/webapp/wcs/stores/b2bjava/login.jsp" class="stockcheckNavLink">';
	businessLink += '+ Business Link (B2B)</a>';
	
var dropdown = '<a class="stockcheckNavLink">';
	dropdown += '+&nbsp;</a>';
	
// #### END STOCK CHECK SEARCH FORM BUILDER ####

// #### GLOBAL NAV STRING BUILDER #### //

// ARRAY Usage: [ FULL NAME|DIRECTORY ]
var nav = new Array("Appliance Parts \& Motors|appliance",
					"Batteries\: OEM \& Industrial|battery",
					"Computer Components|computer",
 					"Passive \& Electromechanical|components",
					"Semiconductors|semi",
					"Telecommunications|comm",
					"Other OEM Components|other");
          
// GET CURRENT DIRECTORY        
//alert(document.location.pathname) ; 
 var getHilightState = new Array(); 
 var pathname = document.location.pathname;
 getHilightState = pathname.split('/');
//alert(getHilightState[2]);
      
// START WRITING NAVIGATION        
 
var globalNavTable="";
globalNavTable += ('<table bgcolor="#000033" border="0" cellpadding="3" cellspacing="0" width="166">');

for(j=0;j<=nav.length-1;j++){
var getDirectory = new Array();
eachLine = nav[j];
//alert(eachLine);
getDirectory = eachLine.split('|');
fullName = getDirectory[0];
directory = getDirectory[1];

if(directory == getHilightState[2]){
globalNavTable += ('<tr><td class="hilightedNavCell">&#149;&nbsp;<a class="hilightedNavLink" href="http://www.panasonic.com/industrial/' + directory + '/">' + fullName + '</a></td><td class="hilightedNavCell"><img src="http://www.panasonic.com/industrial/images/global/arrow.gif" width="7" height="16" alt="arrow" border="0"></td></tr>');
}else{
globalNavTable += ('<tr><td class="defaultNavCell">&#149;&nbsp;<a class="defaultNavLink" href="http://www.panasonic.com/industrial/' + directory + '/">' + fullName + '</a></td><td><img src="http://www.panasonic.com/industrial/images/common/pixel.gif" width="7" height="16" alt="arrow" border="0"></td></tr>');
}

}
globalNavTable += ('<tr><td>&nbsp;</td></tr>');

if(getHilightState[2] == "contact"){
globalNavTable += ('<tr><td class="hilightedNavCell">+&nbsp;<a class="hilightedNavLink" href="http://www.panasonic.com/industrial/contact/">Sales Reps / Distributors</a></td><td class="hilightedNavCell"><img src="http://www.panasonic.com/industrial/images/global/arrow.gif" width="7" height="16" alt="arrow" border="0"></td></tr>');
}else{
globalNavTable += ('<tr><td class="defaultNavCell">+&nbsp;<a class="defaultNavLink" href="http://www.panasonic.com/industrial/contact/">Sales Reps / Distributors</a></td><td><img src="http://www.panasonic.com/industrial/images/common/pixel.gif" width="7" height="16" alt="arrow" border="0"></td></tr>');
}
globalNavTable += ('<tr><td>' + businessLink + '</td></tr>');

globalNavTable += ('<tr><td>' + stockSearch + '</td></tr>');

globalNavTable += ('<tr><td>&nbsp;</td></tr>');


if(getHilightState[2] == ""){
globalNavTable += ('<tr><td class="defaultNavCell">+&nbsp;<a class="defaultNavLink" href="http://www.panasonic.com/industrial/">Industrial Home</a></td><td><img src="http://www.panasonic.com/industrial/images/common/pixel.gif" width="7" height="16" alt="arrow" border="0"></td></tr>');

}else{
globalNavTable += ('<tr><td class="defaultNavCell">+&nbsp;<a class="defaultNavLink" href="http://www.panasonic.com/industrial/">Industrial Home</a></td><td><img src="http://www.panasonic.com/industrial/images/common/pixel.gif" width="7" height="16" alt="arrow" border="0"></td></tr>');
}

if(getHilightState[2] == ""){
globalNavTable += ('<tr><td class="defaultNavCell">+&nbsp;<a class="defaultNavLink" href="http://www.panasonicfa.com/">Factory Automation Home</a></td><td><img src="http://www.panasonic.com/industrial/images/common/pixel.gif" width="7" height="16" alt="arrow" border="0"></td></tr>');

}else{
globalNavTable += ('<tr><td class="defaultNavCell">+&nbsp;<a class="defaultNavLink" href="http://www.panasonicfa.com/">Factory Automation Home</a></td><td><img src="http://www.panasonic.com/industrial/images/common/pixel.gif" width="7" height="16" alt="arrow" border="0"></td></tr>');
}

globalNavTable += ('<style type="text/css">');
globalNavTable += ('<!--');
globalNavTable += ('.combobox {');
globalNavTable += ('background-color: #000000;');
globalNavTable += ('color: #99ccff;');
globalNavTable += ('font-size: 8pt;');
globalNavTable += ('font-family: arial;');
globalNavTable += ('font-weight: normal;');
globalNavTable += ('}');
globalNavTable += ('-->');
globalNavTable += ('</style>');
globalNavTable += ('<form>');
globalNavTable += ('<table border="0" cellspacing="0">');
globalNavTable += ('<tr><td bgcolor="#000000">');
globalNavTable += ('<table border="0" cellspacing="0" cellpadding="3">');
globalNavTable += ('<tr ><td width="0%">'+ dropdown);
globalNavTable += ('<select class="combobox" name="SiteMap" onchange="if(options[selectedIndex].value){location = options[selectedIndex].value}" size="1">');
globalNavTable += ('<option selected>Regional Sites</option><option value="http://www.panasonic.com.sg/industry/">Asia</option><option value="http://www.psihk.panasonic.com.hk/">China</option><option value="http://www.panasonic-industrial.com">Europe</option><option value="http://industrial.panasonic.com/ww/index_e.html">Japan</option>');
globalNavTable += ('</select>');
globalNavTable += ('</td></tr>');
globalNavTable += ('</table>');
globalNavTable += ('</td></tr>');
globalNavTable += ('</table>');


globalNavTable += ('<br><img src="http://www.panasonic.com/industrial/images/common/pixel.gif" width="1" height="100" alt="" border="0">');

// #### END GLOBAL NAV STRING BUILDER #### //


// #### BEGIN FOOTER STRING BUILDER ####
var copyrightFooter = '';
 copyrightFooter += '<align="center"><img src="http://www.panasonic.com/industrial/images/common/pixel.gif" width="468" height="1" alt="" border="0">';
 copyrightFooter += '   <a href="http://www.panasonic.com/pol_docs/copyright-prv.html"><img src="http://www.panasonic.com/images/copyright-prv-wht.gif" width="350" height="25" alt="Privacy Statement" border="0" align="center"></a><br>';
 copyrightFooter += '<br><br>';
// #### END FOOTER STRING BUILDER ####


// #### BEGIN BANNER IMAGEMAP BUILDER ####
var mapCoords = '';
mapCoords += '<map name="banner">';
mapCoords += '  <area shape="rect" coords="9,12,260,40" href="http://www.panasonic.com" alt="Go To Panasonic Home Page" title="Go To Panasonic Home Page">';
mapCoords += '  <area shape="rect" coords="570,33,695,49" href="http://www.panasonic.com/VoiceOfCustomer/Scripts/OEMCustomerSupport.asp" alt="Customer Support" title="Customer Support">';
mapCoords += '  <area shape="rect" coords="512,33,567,49" href="http://www.panasonic.com" alt="Go To Panasonic Home Page" title="Go To Panasonic Home Page">';
// 4 tabb // mapCoords += '  <area shape="rect" coords="614,36,690,48" href="http://www.prodcat.panasonic.com/dealer/search.asp" alt="How To Buy" title="How To Buy">';
mapCoords += '  <area shape="rect" coords="698,33,760,49" href="http://search.panasonic.com/polnav_index.html" alt="Search Panasonic Website" title="Search Panasonic Website">';
mapCoords += '</map>';
// #### END BANNER IMAGEMAP BUILDER ####


