/* [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','19301',jdecode('Home%2FAbout+Us'),jdecode(''),'/19301/index.html','true',[ 
		['PAGE','20801',jdecode('Services+Offered+OMIT'),jdecode(''),'/19301/20801.html','false',[],'',''],
		['PAGE','32512',jdecode('Services+Offered%2FProject+Photos'),jdecode(''),'/19301/32512.html','true',[],'',''],
		['PAGE','20822',jdecode('Interior+Photos'),jdecode(''),'/19301/20822.html','true',[],'',''],
		['PAGE','30812',jdecode('Before+%26+After+Photos'),jdecode(''),'/19301/30812.html','true',[],'',''],
		['PAGE','35412',jdecode('New+Construction+Photos'),jdecode(''),'/19301/35412.html','true',[],'',''],
		['PAGE','41823',jdecode('Community+Involvement'),jdecode(''),'/19301/41823.html','true',[],'',''],
		['PAGE','20843',jdecode('Testimonials'),jdecode(''),'/19301/20843.html','true',[],'','']
	],'',''],
	['PAGE','20864',jdecode('Contact+Us'),jdecode(''),'/20864.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Craft';
theSitetree.paletteFamily='F7EFD3';
theSitetree.keyvisualId='5725';
theSitetree.keyvisualName='kv_5725.jpg';
theSitetree.fontsetId='11049';
theSitetree.graphicsetId='11805';
theSitetree.contentColor='AE3434';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Craft',
				paletteFamily: 	'F7EFD3',
				keyvisualId: 	'5725',
				keyvisualName: 	'kv_5725.jpg',
				fontsetId: 		'11049',
				graphicsetId: 	'11805',
				contentColor: 	'AE3434',
				contentBGColor: 'FFFFFF',
				a_color: 		'AE3434',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19301',
internalId:  '',
customField: '20100610-191334'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30812',
internalId:  '',
customField: '20100107-102545'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20864',
internalId:  '',
customField: '20100610-194522'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20843',
internalId:  '',
customField: '20100106-190141'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20801',
internalId:  '',
customField: '20100106-205942'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20822',
internalId:  '',
customField: '20100106-221900'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35412',
internalId:  '',
customField: '20100110-184513'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32512',
internalId:  '',
customField: '20100110-183748'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41823',
internalId:  '',
customField: '20100610-195115'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INZCC3';
var companyName   = 'Steven+May+d%2Fb%2Fa+New+England+Home+Care';
var htmlTitle	  = 'Builder+Steven+May+dba+New+England+Home+Care+Custom+Building+and+Remodeling+New+and+Existing+Construction';
var metaKeywords  = 'Builder+Steven+May+dba+New+England+Home+Care%2C+Builders+Abington%2C+Contractors+Abington%2C+Custom+Building+Abington%2C+Remodeling+Abington%2C+Contractor+Steven+May+Abington%2C+building%2C+remodeling%2C+new+construction%2C+carpentry%2C+contractor%2C+Abington%2C+Massachusetts%2C+Steven+May+builder+Abington';
var metaContents  = 'Builder+Steven+May+dba+New+England+Home+Care+Abington+MA+Custom+Building+and+Remodeling+New+and+Existing+Construction.++Full+service+construction+company+specializing+in+residential+and+commercial+construction+from+general+home+repair+to+remodeling+and+new+construction.++carpenter+carpentry';
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();
};

