/* [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','401',jdecode('Home'),jdecode(''),'/401.html','true',[],'',''],
	['PAGE','24301',jdecode('About+us'),jdecode(''),'/24301/index.html','true',[ 
		['PAGE','24322',jdecode('The+Members'),jdecode(''),'/24301/24322.html','true',[],'',''],
		['PAGE','29301',jdecode('Local+816+Photos'),jdecode(''),'/24301/29301.html','true',[],'','']
	],'',''],
	['PAGE','452',jdecode('Contractors'),jdecode(''),'/452.html','true',[],'',''],
	['PAGE','24364',jdecode('Jobs'),jdecode(''),'/24364/index.html','true',[ 
		['PAGE','24385',jdecode('Tips+%26+Tricks'),jdecode(''),'/24364/24385.html','true',[],'','']
	],'',''],
	['PAGE','24406',jdecode('News'),jdecode(''),'/24406/index.html','true',[ 
		['PAGE','24427',jdecode('Calendar+of+Events'),jdecode(''),'/24406/24427.html','true',[],'',''],
		['PAGE','24448',jdecode('Monthly+Newsletter'),jdecode(''),'/24406/24448.html','true',[],'','']
	],'',''],
	['PAGE','24469',jdecode('How+To+Join+The+Union'),jdecode(''),'/24469/index.html','true',[ 
		['PAGE','24490',jdecode('Journeyman'),jdecode(''),'/24469/24490.html','true',[],'',''],
		['PAGE','24511',jdecode('Apprentice+With+Industry+Experience'),jdecode(''),'/24469/24511.html','true',[],'',''],
		['PAGE','24532',jdecode('New+Apprentice'),jdecode(''),'/24469/24532.html','true',[],'','']
	],'',''],
	['PAGE','24553',jdecode('Links'),jdecode(''),'/24553.html','true',[],'',''],
	['PAGE','473',jdecode('Contact'),jdecode(''),'/473/index.html','true',[ 
		['PAGE','26201',jdecode('Map'),jdecode(''),'/473/26201.html','true',[],'','']
	],'','']];
var siteelementCount=17;
theSitetree.topTemplateName='Display';
theSitetree.paletteFamily='222222';
theSitetree.keyvisualId='11379';
theSitetree.keyvisualName='kv_11379.jpg';
theSitetree.fontsetId='31963';
theSitetree.graphicsetId='13802';
theSitetree.contentColor='1B1B1B';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Display',
				paletteFamily: 	'222222',
				keyvisualId: 	'11379',
				keyvisualName: 	'kv_11379.jpg',
				fontsetId: 		'31963',
				graphicsetId: 	'13802',
				contentColor: 	'1B1B1B',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['7060']=webappMappings['7060-ea4da61a623fb7d2cc75cb335e15b3e5']={
webappId:    '7060',
documentId:  '29301',
internalId:  'ea4da61a623fb7d2cc75cb335e15b3e5',
customField: 'language:en;country:US;'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '26201',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20090618-094557'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24301',
internalId:  '',
customField: '20080415-081909'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24322',
internalId:  '',
customField: '20080402-161624'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29301',
internalId:  '',
customField: '20080606-123703'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20090618-094858'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24364',
internalId:  '',
customField: '20080606-131504'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24385',
internalId:  '',
customField: '20080402-161624'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24406',
internalId:  '',
customField: '20080402-161624'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24427',
internalId:  '',
customField: '20090618-100113'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24448',
internalId:  '',
customField: '20090618-100244'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24469',
internalId:  '',
customField: '20080606-142341'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24490',
internalId:  '',
customField: '20080606-142402'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24511',
internalId:  '',
customField: '20080606-142426'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24532',
internalId:  '',
customField: '20080606-142452'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24553',
internalId:  '',
customField: '20100210-134641'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20100510-112533'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26201',
internalId:  '',
customField: '20090618-101631'
};
var canonHostname = 'wscwrk01.ehost-services.com';
var accountId     = 'AEN020INERZ5';
var companyName   = 'Residential+Carpenters+Local+Union+816';
var htmlTitle	  = 'Residential+Carpenters+Local+Union+816';
var metaKeywords  = 'Carpenters+Union++Residential+Construction++United+Brotherhood+of+Carpenters';
var metaContents  = 'Carpenters+Union+Residential+Construction+Washington+Framing+Siding+United+Brotherhood';
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();
};

