/* [nodename, id, name, navigationtext, href, isnavigation, childs[], templatename] */

if (typeof(decodeURIComponent) == 'undefined') {
  decodeURIComponent = function(s) {
    return unescape(s);
  }
}

function jdecode(s) {
    s = s.replace(/\+/g, "%20")
    return decodeURIComponent(s);
}

var POS_NODENAME=0;
var POS_ID=1;
var POS_NAME=2;
var POS_NAVIGATIONTEXT=3;
var POS_HREF=4;
var POS_ISNAVIGATION=5;
var POS_CHILDS=6;
var POS_TEMPLATENAME=7;
var POS_TARGET=8;
var theSitetree=[ 
	['PAGE','11501',jdecode('Home'),jdecode(''),'/11501.html','true',[],'',''],
	['PAGE','12501',jdecode('Contact'),jdecode(''),'/12501.html','true',[],'',''],
	['PAGE','14101',jdecode('News%21'),jdecode(''),'/14101.html','true',[],'',''],
	['PAGE','14501',jdecode('Links'),jdecode(''),'/14501.html','true',[],'',''],
	['PAGE','15601',jdecode('Clients+Only'),jdecode(''),'/15601/index.html','true',[ 
		['PAGE','15643',jdecode('Lifestyle+Nets+News'),jdecode(''),'/15601/15643.html','true',[],'',''],
		['PAGE','17701',jdecode('Download'),jdecode(''),'/15601/17701.html','true',[],'',''],
		['PAGE','15622',jdecode('RRSP-Info%2C+FAQ+%26+Links'),jdecode(''),'/15601/15622.html','true',[],'','']
	],'',''],
	['PAGE','21101',jdecode('BRC'),jdecode(''),'/21101/index.html','true',[ 
		['PAGE','22901',jdecode('%22Preferred%22+Runner%3F'),jdecode(''),'/21101/22901.html','true',[],'','']
	],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Commander';
theSitetree.paletteFamily='2B25A2';
theSitetree.keyvisualId='2383';
theSitetree.keyvisualName='highway.jpg';
theSitetree.fontsetId='391';
theSitetree.graphicsetId='439';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='E0E0E0';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Commander',
				paletteFamily: 	'2B25A2',
				keyvisualId: 	'2383',
				keyvisualName: 	'highway.jpg',
				fontsetId: 		'391',
				graphicsetId: 	'439',
				contentColor: 	'000000',
				contentBGColor: 'E0E0E0',
				a_color: 		'E0E0E0',
				b_color: 		'5762CA',
				c_color: 		'A1A4D2',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11501',
internalId:  '',
customField: '20100630-131441'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12501',
internalId:  '',
customField: '20100117-141313'
};
webappMappings['7008']=webappMappings['7008-6317']={
webappId:    '7008',
documentId:  '12501',
internalId:  '6317',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14501',
internalId:  '',
customField: '20100212-091742'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14101',
internalId:  '',
customField: '20100322-081633'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15601',
internalId:  '',
customField: '20100429-094405'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15622',
internalId:  '',
customField: '20100429-092904'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15643',
internalId:  '',
customField: '20100506-123923'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17701',
internalId:  '',
customField: '20100215-193433'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21101',
internalId:  '',
customField: '20100421-081301'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22901',
internalId:  '',
customField: '20100429-094158'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INVXYT';
var companyName   = 'Lifestyle+Nets++++++++416.273.4123';
var htmlTitle	  = 'Lifestyle+Nets+-+Werner+Tars+-+416.273.4123+-+Financial+Safety+Nets+for+Responsible+People';
var metaKeywords  = 'disability+insurance%2C+critical+illness+insurance%2C+living+benefits%2C+life+insurance%2C+term+insurance%2C+Werner+Tars%2C+Lifestyle+Nets%2C+Financial+Safety+Nets+for+Responsible+People%2C+Capital+Solutions%2C+Lifestyle+Nets+Specialist%2C+life+insurance+agent%2C+life+insurance+broker%2C+GTA%2C+Toronto%2C+Burlington%2C+Oakville%2C+Muskoka';
var metaContents  = 'Critical+Illness%2C+Disability%2C+Life+Insurance+-+Financial+Safety+Nets+for+Responsible+People';
theSitetree.getById = function(id, ar) {
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		if (ar[i][POS_ID] == id){
			return ar[i];
		}
		if (ar[i][POS_CHILDS].length > 0) {
			var result=this.getById(id, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getParentById = function(id, ar) {
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		for (var j = 0; j < ar[i][POS_CHILDS].length; j++) {
			if (ar[i][POS_CHILDS][j][POS_ID] == id) {
				// child found
				return ar[i];
			}
			var result=this.getParentById(id, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getName = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_NAME];
	}
	return null;
};

theSitetree.getNavigationText = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_NAVIGATIONTEXT];
	}
	return null;
};

theSitetree.getHREF = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_HREF];
	}
	return null;
};

theSitetree.getIsNavigation = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_ISNAVIGATION];
	}
	return null;
};

theSitetree.getTemplateName = function(id, lastTemplateName, ar) {
	if (typeof(lastTemplateName) == 'undefined'){
		lastTemplateName = this.topTemplateName;
	}
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		var actTemplateName = ar[i][POS_TEMPLATENAME];
		if (actTemplateName == ''){
			actTemplateName = lastTemplateName;
		}
		if (ar[i][POS_ID] == id) {
			return actTemplateName;
		}
		if (ar[i][POS_CHILDS].length > 0) {
			var result=this.getTemplateName(id, actTemplateName, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getByXx = function(lookup, xx, ar) {
    if (typeof(ar) == 'undefined'){
    	ar = this;
    }
    for (var i=0; i < ar.length; i++) {
        if (ar[i][xx] == lookup){
        	return ar[i];
        }
        if (ar[i][POS_CHILDS].length > 0) {
        	var result=this.getByXx(lookup, xx, ar[i][POS_CHILDS]);
            if (result != null){
                return result;
               }
        }
    }
    return null;
};

function gotoPage(lookup) {
	if(__path_prefix__ == "/servlet/CMServeRES" && typeof (changePage) == 'function'){
		changePage(lookup);
		return;
	}
	var page = theSitetree.getHREF(lookup);
	if (!page) {
		var testFor = [ POS_NAME, POS_NAVIGATIONTEXT ];
		for (var i=0 ; i < testFor.length ; i++) {
			var p = theSitetree.getByXx(lookup, testFor[i]);
			if (p != null) {
				page = p[POS_HREF];
				break;
			}
		}
	}
	document.location.href = (new URL(__path_prefix__ + page, true, true)).toString();
};
