//--------------------------------------------------------------------------------
//
//    File name   : dynamicTemplate.js
//    Project     : UWS Dynamic Template
//    Description : This js file used to display the Dynamic template menus 
//                  ,footer and tools js file loading process.
//    version     : 1.0 
//--------------------------------------------------------------------------------

//--------------------------------------------------------------------------------
// Dynamic Template server (Do not customoize)
// Server - https://www.honeywell.com
// Note: For testing, we have given staging server URL in the below.
//--------------------------------------------------------------------------------

var dtServer = "https://www.honeywell.com";

//--------------------------------------------------------------------------------
//
//  Color palettes are defined in the UWS Style Guide and different colors 
//  are typically aligned with different business units.
//   
//  Possible colours
//       - green
//       - navy
//       - indigo
//       - brightblue
//       - red
//       - darktan
//--------------------------------------------------------------------------------

var uws_palette = 'brightblue';

//--------------------------------------------------------------------------------
//   N1N2 Menu controlling variable   
//        -  uws (menus will be loaded from the uws server)
//        -  custom (menus will be loaded from the n1n2filepath value) 
//---------------------------------------------------------------------------------

var menuType = "custom";  

//-------------------------------------------------------------------------------------
//  File path of the N1N2 menu variable.This value is needed if menuType set as 'own' 
//-------------------------------------------------------------------------------------

var n1n2filepath = '/xt3/honeywell/menu_N1N2.js';

//--------------------------------------------------------------------------------
//  N1N2 Menu site id: Based on this value menus will be displayed.
//    Possible values
//          - honeywell (Honeywell)
//          - sm        (Specialty Material)
//          - em        (Electronic Material)
//          - rlss      (Research and Life science solutions)
//          - bandj     (Burdick & Jackson)
//          - gen       (Genetron® Refrigerants)
//          - genesolv  (Genesolv® Solvents)
//          - acs       (Automation and Control Solutions)
//          - aero      (Aerospace)
//          - turbo     (Turbo Technologies)       
//          - enovate   (Enovate® 3000)       
//--------------------------------------------------------------------------------

var n1n2MenuSiteID = 'aero';  


//--------------------------------------------------------------------------------
//
//  Breadcrumb type. 
//        -  uws (Breadcrumb will be loaded from the uws server.uws_breadcrumb must needed)
//        -  custom (Breadcrumb will be loaded from the n1n2filepath value) 
//
//--------------------------------------------------------------------------------

var breadcrumbType = 'custom';

//--------------------------------------------------------------------------------
//
//  UWS Breadcrumb
//          - honeywell (Honeywell)
//          - sm        (Specialty Material)
//          - em        (Electronic Material)
//          - rlss      (Research and Life science solutions)
//          - bandj     (Burdick & Jackson)
//          - gen       (Genetron® Refrigerants)
//          - genesolv  (Genesolv® Solvents)
//          - acs       (Automation and Control Solutions)
//          - aero      (Aerospace)
//          - turbo     (Turbo Technologies)       
//          - enovate   (Enovate® 3000)       
//  Custom Breadcrumb
//          - siteID ( Site id of your website)
//--------------------------------------------------------------------------------

var uws_breadcrumb = 'sm';

//--------------------------------------------------------------------------------
//
//  Custom Breadcrumb 
//
//  custom_taxonomy_bc = { 'siteID' : ['ParentSiteID','mySiteURL','ImageFileWithSiteName'] };
//
//--------------------------------------------------------------------------------

var custom_taxonomy_bc = { 
          
          'parent' : ['honeywell','https://www.myserver.com','images/txt_mySite.gif'] ,
          'siteID' : ['parent','https://www.myserver.com/mysite/','images/txt_mySite.gif']
          
          };


//--------------------------------------------------------------------------------
// eMetrics enabling field.value can be true or false.(can be customize)
//--------------------------------------------------------------------------------

var use_eMetrics = true;

//--------------------------------------------------------------------------------
// loading tools code (Path can be customize)
//--------------------------------------------------------------------------------

function uws_tools(Search,Login,Download)
{   
   if(Search)
   	document.write('<script language="JavaScript" src="/xt3/scripts/search.js"></script>');   
   if(Login)                                                                                            
   	document.write('<script language="JavaScript" src="/xt3/scripts/login.js"></script>');                
   if(Download)
   	document.write('<script language="JavaScript" src="/xt3/scripts/download.js"></script>');      
}

//--------------------------------------------------------------------------------
// loading N1N2 menu code  (Do not customoiz)
//--------------------------------------------------------------------------------

document.write("<script language='JavaScript' src='"+dtServer+"/sites/scripts/serverprops.js'></script>");

if(menuType == "uws")
document.write("<script language='JavaScript' src='"+dtServer+"/sites/scripts/dt/"+n1n2MenuSiteID+"_N1N2.js'></script>");
else
document.write("<script language='JavaScript' src='"+n1n2filepath+"'></script>");

document.write("<script language='JavaScript' src='"+dtServer+"/sites/scripts/dt/uws_main.js'></script>");
document.write("<script language='JavaScript' src='"+dtServer+"/sites/scripts/dt/hw_bc_taxonomy.js'></script>");

//--------------------------------------------------------------------------------

//--------------------------------------------------------------------------------
// Region selector (can be customized)
//--------------------------------------------------------------------------------

// No ofRegions 
var noOfRegions = 2;

// Based on this value drop list will display.(If noOfRegions less than 7 this value is needed)
var region_name_url = [
	['United States','https://www.honeywell.com'] ,
	['India', 'https://www.india.honeywell.com/index.jsp']
];
if(noOfRegions < 8)
noOfRegions = region_name_url.length;

// Region selector page url (if noOfRegions greater than 7 this value is needed)
var region_selector_url = 'https://www.honeywell.com/sites/portal?smap=honeywell&page=honeywellglobal&theme=T8';

//--------------------------------------------------------------------------------

//--------------------------------------------------------------------------------
// Region selector (can be customized)
//--------------------------------------------------------------------------------

// Based on this value language drop down list will display.
var language_url = [
	['English','https://www.honeywell.com?ln=en'] ,
	['German','https://www.honeywell.com?ln=gr']

];

//--------------------------------------------------------------------------------



//--------------------------------------------------------------------------------
// Footer code (can be customized)
//--------------------------------------------------------------------------------

// For providing the sitemap link in the footer
var sitemapURL = 'https://www.honeywell.com/sites/honeywell/sitemap.htm';

// For providing the advance search in the footer
var advanceSearchURL = 'https://search.honeywell.com/search?site=honeywell&q=&output=xml_no_dtd&client=default_frontend&proxystylesheet=default_frontend&proxycustom=%3CADVANCED/%3E';


function uws_getFooterAndGlobalLinks(showRegion, showTranslate) {
	var sOut = '';

	sOut += '<form name="footerForm"><div id="footer">';
	sOut += '<table border="0" cellpadding="0" cellspacing="0" width="760" id="footrule">';
	sOut += '<tr class="footrule">';
	sOut += '<td><img src="/xt3/honeywell/c.gif" width="1" height="4" border="0"></td>';
	sOut += '</tr><tr>';
	sOut += '<td><img src="/xt3/honeywell/c.gif" width="1" height="4" border="0"></td>';
	sOut += '</tr></table>';
	sOut += '<table border="0" cellpadding="0" cellspacing="0" width="760" id="footnav">';
	sOut += '<tr class="footer" height="25">';
	sOut += '<td width="350" class="footer" height="20" colspan="7">';
	sOut += '<div class="marg16">';
	sOut += '<a href="https://www.honeywell.com/sites/portal?smap=honeywell&page=copyright&theme=T8" target="_blank">Terms & Conditions</a> | ';
	sOut += '<a href="https://www.honeywell.com/sites/portal?smap=honeywell&page=privacy&theme=T8" target="_blank">Privacy Statement</a>';
	if(sitemapURL != '')
	sOut += ' | <a href="'+sitemapURL+'">Site Map</a>';
	if(advanceSearchURL != '')
	sOut += ' | <a href="'+advanceSearchURL+'">Advanced Search</a>';
	sOut += '</div></td>';
	sOut += '<TD width="410" align="right"><table border="0" cellpadding="0" cellspacing="0"><tr><td></td>';		 
	
	if (showRegion) {	
		sOut += '<TD class="bgwhite" width="3"><IMG src="/xt3/honeywell/c.gif" width="3" height="24" border="0"></TD>';		
		if(parseInt(noOfRegions) > 7)
		{		    
		    sOut += '<TD width="40"><DIV class="marg16" id="flag"><A';
		    sOut += ' href="'+region_selector_url+'"><IMG height=14 src="images/icon_flag_usa.gif" width="20" border="0"></A></DIV></TD><TD class="footer" width="150"><A';
		    sOut += ' class="region" href="'+region_selector_url+'">Choose Your Region/Country</A></div>';	 	    
	        } else
	        {	        
	    	    sOut += '<td width="5"><IMG src="/xt3/honeywell/c.gif" height="1" width="5"></td><TD class="footer" width="170">';
	    	    sOut += '<select size="1" name="showRegion" class="footerRegion" onChange="javascript:openWindow(document.footerForm.showRegion);">';
	    	    sOut += '<option value="#"> Choose Your Region/Country ';    
		    for(var i=0;i<noOfRegions;i++)
		    {
			sOut += '<option value="'+region_name_url[i][1]+'">'+region_name_url[i][0];    
		    }
	            sOut += '</select>';
	        }	        		
      	        sOut += '</TD><td width="5"><IMG src="/xt3/honeywell/c.gif" height="1" width="5"></td>';
         }                                         
        
	 if (showTranslate) {	 
	     sOut += '<TD class=bgwhite width="3"><IMG src="/xt3/honeywell/c.gif" width="3" height="1" border="0"></TD>';
	     sOut += '<td width="5"><IMG src="/xt3/honeywell/c.gif" height="1" width="5"></td>';
	     sOut +='<td class="footer" width="135"><select class="lang" name="language" onChange="javascript:openWindow(document.footerForm.language);">';
	     sOut += '<option value="">Select Your Language';
	     for(var i=0;i<language_url.length;i++)
	     {
	     sOut += '<option value="'+language_url[i][1]+'">'+language_url[i][0];
	     }
	     sOut += '</select></td>';
	     sOut += '<td width="15"><IMG src="/xt3/honeywell/c.gif" height="1" width="15"></td>';
	 } 	

	sOut += '</tr></table></td></tr></table>';
	sOut += '</div></form>';

	document.write(sOut);
}

function openWindow(opt)
{
	if(opt.options.selectedIndex != -1 && opt.options.selectedIndex != 0)
	{
		window.open(opt.options[opt.options.selectedIndex].value);		
	}
}
//--------------------------------------------------------------------------------

//-----------------------------------------------------
// Xtime Customized N3 Code
//-----------------------------------------------------
function xtime_getN3N4() {
    if (typeof(menulist3) != 'undefined') {
        document.write('<table width="161" cellpadding="3" cellspacing="0" border="0" class="bgnav4_off" id="contact">');
        document.write('<tr><td colspan="2"><img src="' + uwsserver + uws_context + '/images/c.gif" alt="" height="2" width="1" border="0"></td></tr>');
        for (i=0; i < menulist3.length; i++) {
            xtime_getN3_item(i);
        }
        document.write('</table>');
    }
}

function toggleN4(key)
{
        var items = document.getElementsByName(key);
        var val = !is_ie ? 'table-row' : 'block';
        for (var i=0; i < items.length; i++)
        {
                var item = items.item(i);
                item.style.display = (item.style.display == 'none' ? val : 'none');
        }
}

// show menu link highlighted
//ele = the element usually "this"
//style = the nav style 
function sxtimelink2(ele, style) {
        // choose the color 
        on = eval("nav" + style + "_on");
        
        // don't close the menu
        setClose(true);
        // change the font color to the highlighted state
        if (is_ie){
                o = eval("document.all.s_" + ele);
                if (typeof(o.style) != 'undefined') {
                  o.style.color = on;
                }
        } else {
                if(is_nav5up){
                        o = eval("document.getElementById('s_" + ele +"')");
                        o.style.color = on;
                } else {
                        //do nothing
                }
        }
}

// hide menu link highlighted
// changes font color of second nav link
// on TD mouseout
// ele = the element to change usually an <a> who's id begins with "s"
// style corresponds to the color to change it to. 
function hxtimelink2(ele, style) {
  setClose(true);
  off = eval("nav" + style  + "_off");
        if (is_ie) {
                o = eval("document.all.s_" + ele);
                if (typeof(o.style) != 'undefined') {
                   o.style.color= off;
                   o.style.cursor='hand';
                }
        } else if (is_nav) {
                if (is_nav5up) {
                    o = eval("document.getElementById('s_" + ele +"')");
                o.style.color= off;
            } else {
                // ele.bgColor=off;
            }
        }
}

function xtime_getN3_item(index) {
    var sKey = menulist3[index][2];
    if (typeof(n4_menus[sKey]) != 'undefined') {
        document.write('<tr onmouseover="slink(this,4,0);sxtimelink2(\'3_' + sKey + '\',4);changeImages(\'image'+index+'\',\'1\');" onmouseout="hlink(this,4,0);hxtimelink2(\'3_' + sKey + '\',4);changeImages(\'image'+index+'\',\'0\');">');
        document.write('<td width="10" align="right" valign="top"><img name="image'+index+'" src="'+image1off.src+'" width="3" height="3" vspace="5" hspace="0" border="0"></td>');
        document.write('<td><p class="nav4"><a href="#" id="s_3_' + sKey + '" onclick="toggleN4(\'' + sKey + '\');" class="nav4_off">' + menulist3[index][0] + '</a></p>');
        document.write('<div id="' + sKey + '" name="' + sKey + '" style="display:none">');
        document.write('<table width="141" cellpadding="3" cellspacing="0" border="0">');
        var menulist4 = n4_menus[sKey];
        for(var i=0; i< menulist4.length; i++) {
            // xtime_getN4_item(menulist4, i);
            var ikey = menulist4[i][2];
            document.write('<tr onclick="follow_url(\'' + menulist4[i][1] + '\');">');
            document.write('<td width="10" align="right" valign="top" class="nav4_off">&gt;</td>');
            document.write('<td><p class="nav4_on"><a href="' + menulist4[i][1] + '" id="s_3_' + sKey + '" class="nav4_on">' + menulist4[i][0] + '</a></p></td></tr>');
        }
        document.write('</table>');
        document.write('</td></tr>');        
        document.write('</div>');        
    } else {
        document.write('<tr onmouseover="slink(this,4,0);slink2(\'3_' + sKey + '\',4);changeImages(\'image'+index+'\',\'1\');" onmouseout="hlink(this,4,0);hlink2(\'3_' + sKey + '\',4);changeImages(\'image'+index+'\',\'0\');" onclick="follow_url(\'' + menulist3[index][1] + '\');">');
        document.write('<td width="10" align="right" valign="top"><img name="image'+index+'" src="' +image1off.src+'" width="3" height="3" vspace="5" hspace="0" border="0"></td>');
        document.write('<td><p class="nav4"><a href="' + menulist3[index][1] + '" id="s_3_' + sKey + '" class="nav4_off">' + menulist3[index][0] + '</a></p></td></tr>');
    }
}

