
// ------------------------------------------------------------------------
// 
//   FileName    : menu_N1N2.js
//   version     : 1.0
//   Description : This file contain N1 & N2 menu title url and keys.
//
//   Note:
//      In order to use custom N1 and N2  menus the following changes
//      need to be done in dynamicTemplate.js file.
//      a. Change the 'menuType' to 'custom'  
//      b. This file path need to be specified in 'n1n2filepath'.
//                    
// ------------------------------------------------------------------------

// ------------------------------------------------------------------------
// Browser variables  (do not customize)
// ------------------------------------------------------------------------

var agt = navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
var is_nav    = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1));
var is_nav4   = (is_nav && (is_major == 4));
var nav4Buff = 5;

// ------------------------------------------------------------------------
// N1 emplty pixel variable.Value will be calculated based
// on the N1 Menu title length (do not customize)
// ------------------------------------------------------------------------

var n1_empty_pixels = 0;

// ------------------------------------------------------------------------
// Font width.Used to calculate the N1 menu title length (can be customized)
// ------------------------------------------------------------------------

var fontWidth = 7;

// ------------------------------------------------------------------------
// N2 emplty pixel variable.Value will be calculated based
// on the N2 Menu title length (do not customize)
// ------------------------------------------------------------------------

var n2_empty_pixels = 0;

// ------------------------------------------------------------------------
// N2 menu array declaration (do not customize)
// ------------------------------------------------------------------------

var menulist2 = new Array();

// ------------------------------------------------------------------------
// N1 Menu key. (can be customized)
// keys length must be equal to menulist length.
// ------------------------------------------------------------------------

var n1_keys = [ 'home','item1','item2','item3','item4','item5','item6' ];

// ------------------------------------------------------------------------
// N1 Menu array (can be customized)
// Data order [ Menu Title , Menu URL , Key ]
// ------------------------------------------------------------------------

var menulist = new Array();

menulist =
[ 
	['HOME', '/careers/index.html','home'] ,
	['JOB SEARCH', '/careers/jobsearch.html','item1'] ,
	['CAREER PATHS', '/careers/careerpaths.html','item2'] ,
	['HONEYWELL &amp; YOU', '/careers/working.html','item3'] ,
	['UNIVERSITY RELATIONS', '/careers/oncampus.html','item4'] ,
	['MEET HONEYWELL', '/careers/meetus.html','item5'] ,
	['LOCATIONS', '/careers/jobsearch.html','item6'] 
];

// ------------------------------------------------------------------------
// N2 floating menu array declaration (do not customize)
// ------------------------------------------------------------------------

var n1_popup_menus = {};

// ------------------------------------------------------------------------
// Floating menu left space value variable (do not customize)
// ------------------------------------------------------------------------

var leftSpace = 0;

// ------------------------------------------------------------------------
//  
//   n1_popup_menus having the leftspace value and N2 Menu title , url and key.
//   As per uws standard Home page wont have the n1_popup_menus.
//   We can define the n1_popup_menus based on the N1 menu keys.
//
//   All the  n1_popup_menus will have 
//    [windows IE leftSpace,windows Netscape leftSpace,Mac IE leftSpace, Mac Netscape leftSpace] 
//   in the first row.Value can be customize by adding or subtracting pixel values.
//
// ------------------------------------------------------------------------


// ------------------------------------------------------------------------
// Calculation of left space for Menu1 based on the menu0 title length
// ------------------------------------------------------------------------

// job search & apply

//leftSpace = getLeftSpace(leftSpace,menulist[0][0].length);

//n1_popup_menus['item1'] = [
//    [leftSpace+4,leftSpace,leftSpace+5,leftSpace+5],
//    ['Menu 1 Item 1','url','item1']
//];

// career paths
leftSpace = getLeftSpace(leftSpace,menulist[1][0].length);

n1_popup_menus['item2'] = [
    [leftSpace+58, leftSpace+60,leftSpace+60,leftSpace+60],
	['Engineering','/careers/car_engineering.html','item1'],
	['Manufacturing','/careers/car_manufacturing.html','item2'],
	['Marketing &amp; Sales','/careers/car_marketing.html','item3'],
	['Finance','/careers/car_finance.html','item4'],
	['Information Technology','/careers/car_it.html','item5'],
	['Research &amp; Development','/careers/car_rnd.html','item6'],
	['Six Sigma','/careers/car_sixsigma.html','item7'],
	['Human Resources','/careers/car_hr.html','item8'],
	['Strategy &amp; Business Development','/careers/car_business.html','item9'],
	['Law &amp; Government Relations','/careers/car_relations.html','item10']
];


// why work at honeywell
leftSpace = getLeftSpace(leftSpace,menulist[2][0].length);

n1_popup_menus['item3'] = [
    [leftSpace+61, leftSpace+62,leftSpace+62,leftSpace+62],
	['Benefits','/careers/working_benefits.html','item1'],
	['Learning &amp; Development','/careers/working_learning.html','item2']
];


// honeywell on campus
leftSpace = getLeftSpace(leftSpace,menulist[3][0].length);

n1_popup_menus['item4'] = [
    [leftSpace+36, leftSpace+37,leftSpace+37,leftSpace+37],
    ['Undergraduate Opportunities','/careers/camp_undergrad.html','item1'],
    ['Advanced Degree Opportunities','/careers/camp_advanced.html','item2'],
    ['Innovators Scholarship Program','/careers/innovators_program.html','item4']
];


// meet honeywell
leftSpace = getLeftSpace(leftSpace,menulist[4][0].length);

n1_popup_menus['item5'] = [
    [leftSpace+31,leftSpace+32,leftSpace+32,leftSpace+32],
    ['How We Work','/careers/howwework.html','item1'],
    ['What We Do','/careers/whatwedo.html','item2'],
    ['Our History &amp; Achievements','/careers/ourhistory.html','item3']
];

// career locations
leftSpace = getLeftSpace(leftSpace,menulist[5][0].length);

//n1_popup_menus['item6'] = [
    //[leftSpace-43,leftSpace-42,leftSpace-42,leftSpace-42],
    //['North America','/careers/loc_na.html','item1'],
    //['Europe','/careers/loc_europe.html','item2'],
    //['Asia','/careers/loc_asia.html','item3']
//];



// ------------------------------------------------------------------------
// Floating menus left space value calculating method (do not customize)
// ------------------------------------------------------------------------

function getLeftSpace(preLeftSpace,charLength)
{
	var emptySpace = (preLeftSpace + (eval(parseInt(charLength)*fontWidth)+20+2));
	if(is_nav4)
	emptySpace = emptySpace - nav4Buff;	
	return emptySpace;		
}

// ------------------------------------------------------------------------
// N2 menulist array value loading method (do not customize)
// ------------------------------------------------------------------------

function loadN2()
{	
	if(n1_popup_menus[currsection] != undefined && (n1_popup_menus.length == undefined || n1_popup_menus.length > 0))
	{	
		for(var i=1;i<n1_popup_menus[currsection].length;i++)	
 		menulist2[i-1] = n1_popup_menus[currsection][i];
 		calN2emptySpace();
	}
}

// ------------------------------------------------------------------------
// N1 empty pixel value calculating method (do not customize)
// ------------------------------------------------------------------------

function calculateN1_empty()
{
  var totalLength = 0;
  for(var i=0;i<menulist.length;i++)
  {
      totalLength = totalLength + 20 + eval(parseInt(menulist[i][0].length)*fontWidth)+2;
  }   
  if(totalLength < 760)
     n1_empty_pixels = 760 - totalLength;
}

// ------------------------------------------------------------------------
// N2 empty pixel value calculating method (do not customize)
// ------------------------------------------------------------------------

function calN2emptySpace()
{
	var n2LeftSpace = 0;
	var tmpamp = 0;
	var flag = 0;
	for(var i=0;i<menulist2.length;i++)
	{
		if(menulist2[i][0].search('&')!=-1)
			tmpamp = tmpamp + 50; 
		if(menulist2[i][0].search('Blogs')!=-1)
			flag = 1;
  		n2LeftSpace = eval(parseInt(n2LeftSpace)+10) + eval(parseInt(menulist2[i][0].length)*fontWidth);	
	}
     	if(n2LeftSpace < 760)
       	n2_empty_pixels = 760 - n2LeftSpace;	
       	if(n2_empty_pixels!=0)
       		n2_empty_pixels = n2_empty_pixels + tmpamp;
       	if(n2_empty_pixels!=0 && flag==1)
       		n2_empty_pixels = n2_empty_pixels - tmpamp + 50;
}

// ------------------------------------------------------------------------
// Invoking the N1 emptly pixel value calculating method 
//   to assign the value for n1_empty_pixels  variable (do not customize)
// ------------------------------------------------------------------------

calculateN1_empty();

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


