/* [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','32',jdecode('Home'),jdecode(''),'/32/index.html','true',[ 
		['PAGE','1430',jdecode('History'),jdecode(''),'/32/1430.html','true',[],'','']
	],'',''],
	['PAGE','1073',jdecode('Services'),jdecode(''),'/1073.html','true',[],'',''],
	['PAGE','1082',jdecode('Clients'),jdecode(''),'/1082/index.html','true',[ 
		['PAGE','1285',jdecode('General+Contractor%26%23x27%3Bs'),jdecode(''),'/1082/1285.html','true',[],'',''],
		['PAGE','1294',jdecode('Building+Contractor%26%23x27%3Bs'),jdecode(''),'/1082/1294.html','true',[],'',''],
		['PAGE','1303',jdecode('Utility+Contractor%26%23x27%3Bs'),jdecode(''),'/1082/1303.html','true',[],'',''],
		['PAGE','1312',jdecode('Subcontractor%26%23x27%3Bs'),jdecode(''),'/1082/1312.html','true',[],'','']
	],'',''],
	['PAGE','1091',jdecode('Projects'),jdecode(''),'/1091/index.html','true',[ 
		['PAGE','1321',jdecode('Commercial'),jdecode(''),'/1091/1321.html','true',[],'',''],
		['PAGE','1330',jdecode('Industrial'),jdecode(''),'/1091/1330.html','true',[],'',''],
		['PAGE','1339',jdecode('Educational'),jdecode(''),'/1091/1339.html','true',[],'',''],
		['PAGE','1348',jdecode('Hospitals'),jdecode(''),'/1091/1348.html','true',[],'',''],
		['PAGE','1357',jdecode('Roadways'),jdecode(''),'/1091/1357.html','true',[],'',''],
		['PAGE','1366',jdecode('Bridges'),jdecode(''),'/1091/1366.html','true',[],'',''],
		['PAGE','1375',jdecode('Utilities'),jdecode(''),'/1091/1375.html','true',[],'','']
	],'',''],
	['PAGE','1100',jdecode('Rates'),jdecode(''),'/1100.html','true',[],'',''],
	['PAGE','1109',jdecode('Contact+Us'),jdecode(''),'/1109.html','true',[],'','']];
var siteelementCount=18;
theSitetree.topTemplateName='Time';
theSitetree.paletteFamily='272740';
theSitetree.keyvisualId='2289';
theSitetree.keyvisualName='architekt.jpg';
theSitetree.fontsetId='268';
theSitetree.graphicsetId='336';
theSitetree.contentColor='';
theSitetree.contentBGColor='';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Time',
				paletteFamily: 	'272740',
				keyvisualId: 	'2289',
				keyvisualName: 	'architekt.jpg',
				fontsetId: 		'268',
				graphicsetId: 	'336',
				contentColor: 	'',
				contentBGColor: '',
				a_color: 		'272740',
				b_color: 		'6D6DA7',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '32',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32',
internalId:  '',
customField: '20080811-140138'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1100',
internalId:  '',
customField: '20100728-144226'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1430',
internalId:  '',
customField: '20060323-024818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1073',
internalId:  '',
customField: '20070718-141336'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1082',
internalId:  '',
customField: '20060803-180106'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1285',
internalId:  '',
customField: '20080811-061733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1294',
internalId:  '',
customField: '20080811-062101'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1303',
internalId:  '',
customField: '20060803-175519'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1312',
internalId:  '',
customField: '20060323-023643'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1091',
internalId:  '',
customField: '20060323-002843'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1321',
internalId:  '',
customField: '20060323-023643'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1330',
internalId:  '',
customField: '20060323-023643'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1339',
internalId:  '',
customField: '20060323-023643'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1348',
internalId:  '',
customField: '20060323-023643'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1357',
internalId:  '',
customField: '20060323-023643'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1366',
internalId:  '',
customField: '20060323-023643'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1375',
internalId:  '',
customField: '20060323-023643'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1109',
internalId:  '',
customField: '20060803-170322'
};
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3D0Q';
var companyName   = 'Contractor%27s+Line+%26+Grade+Co.%2C+Inc.';
var htmlTitle	  = '';
var metaKeywords  = '';
var metaContents  = '';
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();
};
