/* [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('ABOUT+US'),jdecode(''),'/105001.html','true',[],'',''],
	['PAGE','552',jdecode('SERVICES'),jdecode(''),'/552.html','true',[],'',''],
	['PAGE','594',jdecode('LOOKUP+A+CONTRACTOR'),jdecode(''),'/594.html','true',[],'',''],
	['PAGE','615',jdecode('CONTACT+US'),jdecode(''),'/615.html','true',[],'',''],
	['PAGE','5201',jdecode('PROJECTS'),jdecode(''),'/5201.html','true',[],'',''],
	['PAGE','143901',jdecode('GUESTBOOK'),jdecode(''),'/143901.html','false',[],'',''],
	['PAGE','77501',jdecode('SPECIALS'),jdecode(''),'/77501.html','false',[],'',''],
	['PAGE','201501',jdecode('EMPLOYMENT'),jdecode(''),'/201501.html','true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Meta';
theSitetree.paletteFamily='72A7D3';
theSitetree.keyvisualId='11308';
theSitetree.keyvisualName='kv_11308.jpg';
theSitetree.fontsetId='31993';
theSitetree.graphicsetId='13826';
theSitetree.contentColor='020202';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Meta',
				paletteFamily: 	'72A7D3',
				keyvisualId: 	'11308',
				keyvisualName: 	'kv_11308.jpg',
				fontsetId: 		'31993',
				graphicsetId: 	'13826',
				contentColor: 	'020202',
				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['1002']=webappMappings['1002-143901aendu0in209a']={
webappId:    '1002',
documentId:  '143901',
internalId:  '143901aendu0in209a',
customField: 'icq=false'
};
webappMappings['7008']=webappMappings['7008-733']={
webappId:    '7008',
documentId:  '615',
internalId:  '733',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '552',
internalId:  '',
customField: '20100713-172427'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5201',
internalId:  '',
customField: '20100611-112806'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '594',
internalId:  '',
customField: '20100611-112729'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '615',
internalId:  '',
customField: '20100518-223812'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '77501',
internalId:  '',
customField: '20100219-150902'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '143901',
internalId:  '',
customField: '20090928-220843'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '201501',
internalId:  '',
customField: '20100611-113439'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '105001',
internalId:  '',
customField: '20100827-110445'
};
webappMappings['7008']=webappMappings['7008-28796']={
webappId:    '7008',
documentId:  '201501',
internalId:  '28796',
customField: 'language:en;country:US;'
};
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0IN209A';
var companyName   = 'Don%27t+be+an+episode+of+Holmes+on+Homes+.+.+.+get+it+done+right+the+first+time%21';
var htmlTitle	  = 'HANDYMAN+CREW+LLC';
var metaKeywords  = 'handyman%2Chandyman+service%2Cservice%2C+repair%2Chome+repair%2C+remodel%2Cremodeling%2Cremodeling+contractor%2Chome+improvement%2Cbath+remodeling%2C+kitchen+remodel%2Ckitchen%2Cbath%2Csiding+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%2Clights%2C+garages%2Cvancouver+wa%2Cvancouver+handman%2Chandyman+vancouver';
var metaContents  = 'handyman%2Chandyman+service%2C+repair%2C+remodel%2Cremodeling%2Cbath+remodeling%2C+kitchen+remodel%2Chome+improvement+.home+repair%2Ckitchen%2Cbath%2Csiding+installers%2Csiding%2Ccontractor%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%2Cfloor';
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();
};
