

// ----------------------------------------------------------------
// 
//   Third level menu array used in T5.htm file. 
//  
//   Data order - [ Menu Title , URL , key ]
//
// ----------------------------------------------------------------

var mystring;

displayItem('XT');


function ReadCookie(cookieName) {
 var theCookie=""+document.cookie;
 var ind=theCookie.indexOf(cookieName);
 if (ind==-1 || cookieName=="") return ""; 
 var ind1=theCookie.indexOf(';',ind);
 if (ind1==-1) ind1=theCookie.length; 
 return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}



function PageQuery(q) {
if(q.length > 1) this.q = q.substring(1, q.length);
else this.q = null;
this.keyValuePairs = new Array();
	if(q) {
		for(var i=0; i < this.q.split("&").length; i++) {
		this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.getKeyValuePairs = function() { return this.keyValuePairs; }
	this.getValue = function(s) {
		for(var j=0; j < this.keyValuePairs.length; j++) {
		if(this.keyValuePairs[j].split("=")[0] == s)
		return this.keyValuePairs[j].split("=")[1];
		}
		return false;
	}
	this.getParameters = function() {
		var a = new Array(this.getLength());
		for(var j=0; j < this.keyValuePairs.length; j++) {
		a[j] = this.keyValuePairs[j].split("=")[0];
		}
		return a;
	}
	this.getLength = function() { return this.keyValuePairs.length; } 
}

function queryString(key){
var page = new PageQuery(window.location.search); 
return unescape(page.getValue(key)); 
}
function displayItem(key){
	if(queryString(key)=='false') 
	{
		mystring = "";
	}else
	{
		mystring = queryString(key);
		//document.write ('mystring=' + mystring);
	
	}
}


function setCookie (name, value, expires) 
{
    if (!expires) expires = new Date();
		document.cookie = name + "=" + escape (value) +     
	"; expires=" + expires.toGMTString() +  "; path=/"; 
}  


function getCookie (name) {
var dcookie = document.cookie; 
var cname = name + "=";
var clen = dcookie.length;
var cbegin = 0;
    while (cbegin < clen) {
    var vbegin = cbegin + cname.length;
        if (dcookie.substring(cbegin, vbegin) == cname) { 
        var vend = dcookie.indexOf (";", vbegin);
            if (vend == -1) vend = clen;
        return unescape(dcookie.substring(vbegin, vend));
        }
    cbegin = dcookie.indexOf(" ", cbegin) + 1;
        if (cbegin == 0) break;
    }
return null;

}

function delCookie (name) 
{
    var expireNow = new Date();
    document.cookie = name + "=" +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT" +  "; path=/";
}

//document.write ('reading ='  +ReadCookie('XT'))
//if(mystring=='loggedin' || ReadCookie('XT') =='loggedin')
if(mystring=='loggedin' || getCookie("XT") =='loggedin')

{
	
	//document.cookie = "XT=loggedin;";
	
	var expdate = new Date ();
    expdate.setTime (expdate.getTime() + (1000 * 60 * 60 * 24 * 1));
    setCookie ("XT", "loggedin", expdate);
	mystring = "";
}

if(mystring=='loggedin' || getCookie("XT") =='loggedin')
{
	var menulist3 =
	[
		['Training Home', '/ats/default.html?XT=loggedin', 'item1'] ,
		//['Bulletin Board', '/ats/bulletin.html?XT=loggedin', 'item11'] ,		
		['Classroom Training', '/ats/classroom.html?XT=loggedin', 'item2'] ,
		['Online Learning', '/SCORM/userpages/Login.asp?XT=loggedin', 'item3'] ,
		['Travel Information', '/ats/travelinfo.html?XT=loggedin', 'item4'] ,
		//['Store', '/ats/store.html?XT=loggedin', 'item5'] ,
		['About Training Solutions', '/ats/general_info.html?XT=loggedin', 'item6'],	
		['My Reservations', 'https://honeywell.xtime.com/xt3/consumer/res/preResList.do', 'item7'] ,
		['My Profile', 'https://honeywell.xtime.com/xt3/consumer/profile/prepProfile.do', 'item8'] ,
		['Simulator Industry Support', '/ats/simulator_industry_info.html?XT=loggedin', 'item12'],
		//['Customer Flight Operations Support', '/ats/customer_flight_info.html?XT=loggedin', 'item13'],
		['C&PS Flight Operations', '/ats/customer_flight_info.html?XT=loggedin', 'item13'],		
		['Help', '/ats/help.html?XT=loggedin', 'item9']	,
		['Log Out', '/ats/ats_logout.asp', 'item10']
		
	];
}

else
{

	var menulist3 =
	[
		['Training Home', '/ats/default.html', 'item1'] ,
	//	['Bulletin Board', '/ats/bulletin.html', 'item11'] ,		
		['Classroom Training', '/ats/classroom.html', 'item2'] ,
		['Online Learning', '/SCORM/userpages/Login.asp', 'item3'] ,
		['Travel Information', '/ats/travelinfo.html', 'item4'] ,
		//['Store', '/ats/store.html', 'item5'] ,
		['About Training Solutions', '/ats/general_info.html', 'item6'],
		['My Reservations', 'https://honeywell.xtime.com/xt3/consumer/res/preResList.do', 'item7'] ,
		['My Profile', 'https://honeywell.xtime.com/xt3/consumer/profile/prepProfile.do', 'item8'] ,
		['Simulator Industry Support', '/ats/simulator_industry_info.html', 'item12'],
		['C&PS Flight Operations', '/ats/customer_flight_info.html', 'item13'],		
		//['Customer Flight Operations Support', '/ats/customer_flight_info.html', 'item13'],	 	
		['Help', '/ats/help.html', 'item9']
		
	];
}	


// ----------------------------------------------------------------
// 
//   Fourth level menu array for the third level menu item1
//  
//   Data order - [ Menu Title , URL , key ]
//
// ----------------------------------------------------------------

var menulist4_subitem1 = [ 
    ['Level 4 Item 1', '#', 'item1'],
    ['Level 4 Item 2', '#', 'item2'],
    ['Level 4 Item 3', '#', 'item3']    
];

// ----------------------------------------------------------------
// 
//   Fourth level menu array for the third level menu item1
//  
//   Data order - [ Menu Title , URL , key ]
//
// ----------------------------------------------------------------

if(mystring=='loggedin' || getCookie("XT") =='loggedin')
{

		var menulist4_subitem2 = [ 
		    ['Customer Login', 'https://honeywell.xtime.com/xt3/consumer/res/preResList.do', 'item1'],
		    ['Course Schedule', '/asp_reports/ConsumerReport.asp?XT=loggedin', 'item2'],   
		    ['Course Information', 'https://honeywell.xtime.com/xt3/consumer/preHome.do', 'item3'],
		    ['Special Training Requests', '/ats/specialRequest_form.asp?XT=loggedin', 'item4']  
		];

}
else
{
		var menulist4_subitem2 = [ 
	    ['Customer Login', 'https://honeywell.xtime.com/xt3/consumer/res/preResList.do', 'item1'],
	    ['Course Schedule', '/asp_reports/ConsumerReport.asp', 'item2'],   
	    ['Course Information', 'https://honeywell.xtime.com/xt3/consumer/preHome.do', 'item3'],
	    ['Special Training Requests', '/ats/specialRequest_form.asp', 'item4']  
	];
}


// ----------------------------------------------------------------
// 
//   Fourth level menu array for the third level menu item1
//  
//   Data order - [ Menu Title , URL , key ]
//
// ----------------------------------------------------------------

if(mystring=='loggedin' || getCookie("XT") =='loggedin')
{
	var menulist4_subitem3 = [ 
	    ['eLearning', '/SCORM/userpages/Login.asp?XT=loggedin', 'item1']   
	];
}
else
{
	var menulist4_subitem3 = [ 
	 	['eLearning', '/SCORM/userpages/Login.asp', 'item1']   
	];
}	

// ----------------------------------------------------------------
// 
//   Fourth level menu array for the third level menu item1
//  
//   Data order - [ Menu Title , URL , key ]
//
// ----------------------------------------------------------------
if(mystring=='loggedin' || getCookie("XT") =='loggedin')
{
	var menulist4_subitem4 = [ 
	    ['Training Locations', '/ats/listLocations.asp?XT=loggedin', 'item1'],
	    ['Hotels', '/ats/listhotels.asp?XT=loggedin', 'item2']  
	];
}
else
{
		var menulist4_subitem4 = [ 
	    ['Training Locations', '/ats/listLocations.asp?XT=loggedin', 'item1'],
	    ['Hotels', '/ats/listhotels.asp', 'item2']  
	];
}

// ----------------------------------------------------------------
// 
//   Fourth level menu array for the third level menu item1
//  
//   Data order - [ Menu Title , URL , key ]
//
// ----------------------------------------------------------------

var menulist4_subitem5 = [ 
   // ['Videos', '/ats/learningTools_video.asp', 'item1'],
   // ['Interactive Software', '/ats/learningTools_software.asp', 'item2']
];

// ----------------------------------------------------------------
// 
//   Fourth level menu array for the third level menu item1
//  
//   Data order - [ Menu Title , URL , key ]
//
// ----------------------------------------------------------------
if(mystring=='loggedin' || getCookie("XT") =='loggedin')
{
	var menulist4_subitem6 = [ 
	    ['Vision', '/ats/vision.asp?XT=loggedin', 'item1'],
	   // ['Our Staff', '/ats/staff.asp', 'item2'],
	    ['Policies', '/ats/listpolicies.asp?XT=loggedin', 'item2'],
	    ['Curriculum', '/ats/curriculum.asp?XT=loggedin', 'item3']
	    // ['Policies', 'listpolicies.asp', 'item4']
	];
}
else
{
		var menulist4_subitem6 = [ 
	    ['Vision', '/ats/vision.asp', 'item1'],
	   // ['Our Staff', '/ats/staff.asp', 'item2'],
	    ['Policies', '/ats/listpolicies.asp', 'item2'],
	    ['Curriculum', '/ats/curriculum.asp', 'item3']
	    // ['Policies', 'listpolicies.asp', 'item4']
	];
}

// ----------------------------------------------------------------
// 
//   Fourth level menu array for the third level menu item1
//  
//   Data order - [ Menu Title , URL , key ]
//
// ----------------------------------------------------------------
if(mystring=='loggedin' || getCookie("XT") =='loggedin')
{
	var menulist4_subitem7 = [ 
	    ['Frequently Asked Questions', '/ats/faq.asp?XT=loggedin', 'item1'],
	    ['Directions', '/ats/forms.asp?XT=loggedin', 'item2'],
	    ['Contact Us', '/ats/contactus.asp?XT=loggedin', 'item3']
	];
}
else
{
		var menulist4_subitem7 = [ 
	    ['Frequently Asked Questions', '/ats/faq.asp', 'item1'],
	    ['Directions', '/ats/forms.asp', 'item2'],
	    ['Contact Us', '/ats/contactus.asp', 'item3']
	];

}

if(mystring=='loggedin' || getCookie("XT") =='loggedin')
{
	var menulist4_subitem8 = [ 
	    ['About Simulator Support', '/ats/about_simulator_support.asp?XT=loggedin', 'item1'],
	    ['Technical Publications', '/ats/technical_pubs.asp?XT=loggedin', 'item2'],
	    ['Contact Us', '/ats/contact_simulator_support.asp?XT=loggedin', 'item3']
	    
	];
}
else
{
		var menulist4_subitem8 = [ 
	    ['About Simulator Support', '/ats/about_simulator_support.asp', 'item1'],
	    ['Technical Publications', '/ats/technical_pubs.asp', 'item2'],
	    ['Contact Us', '/ats/contact_simulator_support.asp', 'item3']
	    
	];
}

if(mystring=='loggedin' || getCookie("XT") =='loggedin')
{
	var menulist4_subitem9 = [ 
		['Contact Us ', '/ats/contact_customer_flight.asp?XT=loggedin', 'item1']
	  // ['About Customer Flight Operations Support', '/ats/about_customer_flight.asp?XT=loggedin', 'item1'],
	  // ['Technical Publications ', '/ats/customer_technical_pubs.asp?XT=loggedin', 'item2'],
	  //['Contact Us ', '/ats/contact_customer_flight.asp?XT=loggedin', 'item3']
	   
	];
}
else
{
		var menulist4_subitem9 = [ 
		
	   // ['About Customer Flight Operations Support', '/ats/about_customer_flight.asp', 'item1'],
	  //  ['Technical Publications ', '/ats/customer_technical_pubs.asp', 'item2'],
	   // ['Contact Us ', '/ats/contact_customer_flight.asp', 'item3']
	    ['Contact Us ', '/ats/contact_customer_flight.asp?XT=loggedin', 'item1']
	   
	];
}
// ----------------------------------------------------------------
// 
//   Hash-map for N4 level menus (the hash key should exist in n3_keys)
//  
//   Data order - [ N3 menu key : N4 menu array ]
//
// ----------------------------------------------------------------

var n4_menus = {'item2' : menulist4_subitem2, 'item3' : menulist4_subitem3,  'item4' : menulist4_subitem4,  'item5' : menulist4_subitem5,  'item6' : menulist4_subitem6,  'item9' : menulist4_subitem7,  'item12' : menulist4_subitem8,  'item13' : menulist4_subitem9};

