/* [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','105001',jdecode('SERVICES+-+ABOUT+US'),jdecode(''),'/105001.html','true',[],'',''],
	['PAGE','594',jdecode('CONTRACTOR+Lookup'),jdecode(''),'/594.html','true',[],'',''],
	['PAGE','615',jdecode('Schedule+ESTIMATE+'),jdecode(''),'/615.html','true',[],'',''],
	['PAGE','5201',jdecode('PROJECTS'),jdecode(''),'/5201.html','true',[],'',''],
	['PAGE','201501',jdecode('EMPLOYMENT'),jdecode(''),'/201501.html','true',[],'','']];
var siteelementCount=5;
theSitetree.topTemplateName='Unity';
theSitetree.paletteFamily='FF9F09';
theSitetree.keyvisualId='11840';
theSitetree.keyvisualName='kv_11840.jpg';
theSitetree.fontsetId='33140';
theSitetree.graphicsetId='14073';
theSitetree.contentColor='363636';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Unity',
				paletteFamily: 	'FF9F09',
				keyvisualId: 	'11840',
				keyvisualName: 	'kv_11840.jpg',
				fontsetId: 		'33140',
				graphicsetId: 	'14073',
				contentColor: 	'363636',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				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['7008']=webappMappings['7008-733']={
webappId:    '7008',
documentId:  '615',
internalId:  '733',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5201',
internalId:  '',
customField: '20101121-112041'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '594',
internalId:  '',
customField: '20101107-190633'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '615',
internalId:  '',
customField: '20101109-182407'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '201501',
internalId:  '',
customField: '20101118-110453'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '105001',
internalId:  '',
customField: '20101202-173356'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '105001',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '594',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '615',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '5201',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '201501',
internalId:  '',
customField: 'language:en;country:US;'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0IN209A';
var companyName   = 'Go+Play+...+let+Handyman+Crew+do+the+work%21++++';
var htmlTitle	  = 'Handyman+Crew+LLC+Remodeling%2CGeneral+Contractor%2CRepairs';
var metaKeywords  = 'handyman%2Chandyman+service%2C+remodel%2Cremodeling%2Ccontractor%2Chome+repair%2Cremodeling+contractors%2Chome+improvement%2Cbath+remodeling%2C+kitchen+remodel%2Ckitchen%2Cbath%2Csiding%2Ckitchen+design%2C+installers%2Ccontractor%2Ctile+repair%2Cwindow+install%2Cwindow+replacement%2Cdoors%2Cdoor+replacement%2C+flooring%2C+tile+work%2Crepair+work%2Cdecks%2Cpainting%2Cdryrot+repair%2Cdrywall+repair%2Cflooring%2Cflooring+contractor%2Clights%2C+garages%2Cvancouver+wa%2Cvancouver+handman%2Chandyman+vancouver+wa%2Ccontractor+remodeling+and+repair%2CVancouver+WA%2CVancouver+Handyman%2C+Vancouver+Contractors%2CRemodeling+%26+Repair';
var metaContents  = 'handyman%2Chandyman+service%2C+romodeling+service%2C+remodeling+%26+repair%2Cremodeling+contractor%2Ckitchen+design%2Cbath+remodeling%2Ckitchen+remodel%2Chome+improvement%2Chome+repair%2Cbath%2Csiding%2Cfence+installers%2Csiding%2Ctile+repair%2Cwindow+install%2Cwindow+replacement%2Cdoors%2Cdoor+replacement%2C+flooring%2C+tile+work%2Crepair+work%2Cdecks%2Cpainting%2Cdryrot+repair%2Cdrywall+repair%2Cflooring%2Clights%2C+garages%2Cflooring+contractor%2C+contractor+remodeing+and+repair%2CVancouver+WA%2CVancouver+Handyman%2C+Vancouver+Remodeling+Contractors';
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();
};

