/* [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 theSitetree=[ 
	['PAGE','401',jdecode('Home'),jdecode(''),'/401.html','true',[],''],
	['PAGE','2401',jdecode('Photos+'),jdecode(''),'/2401.html','true',[],''],
	['PAGE','35001',jdecode('Varnishing+'),jdecode(''),'/35001.html','true',[],''],
	['PAGE','35022',jdecode('Photos+%2B'),jdecode(''),'/35022.html','true',[],''],
	['PAGE','28301',jdecode('More+Photos'),jdecode(''),'/28301.html','true',[],''],
	['PAGE','27901',jdecode('Before+%26+After+Photos'),jdecode(''),'/27901.html','true',[],''],
	['PAGE','41464',jdecode('%2BBefore%2F+After+photos'),jdecode(''),'/41464.html','true',[],''],
	['PAGE','2422',jdecode('Tips+and+tricks'),jdecode(''),'/2422.html','true',[],''],
	['PAGE','2443',jdecode('Service'),jdecode(''),'/2443.html','true',[],''],
	['PAGE','2464',jdecode('Contact'),jdecode(''),'/2464.html','true',[],''],
	['PAGE','10101',jdecode('LICENSE+%23+893786'),jdecode(''),'/10101.html','true',[],''],
	['PAGE','10122',jdecode('+Privacy+Statement'),jdecode(''),'/10122.html','true',[],''],
	['PAGE','16901',jdecode('+Request+an+estimate'),jdecode(''),'/16901.html','true',[],''],
	['PAGE','41226',jdecode('EXTERIOR+PHOTOS'),jdecode(''),'/41226.html','true',[],''],
	['PAGE','25201',jdecode('+Our+FLYER'),jdecode(''),'/25201.html','true',[],''],
	['PAGE','40359',jdecode('PHOTO+ALBUM'),jdecode(''),'/40359.html','true',[],''],
	['PAGE','41935',jdecode('Locations+'),jdecode(''),'/41935.html','true',[],''],
	['PAGE','41953',jdecode('Voting+'),jdecode(''),'/41953.html','true',[],'']];
var siteelementCount=18;
theSitetree.topTemplateName='Nurseries';
theSitetree.paletteFamily='93B9F3';
theSitetree.keyvisualId='7912';
theSitetree.keyvisualName='kv_7912.jpg';
theSitetree.fontsetId='16877';
theSitetree.graphicsetId='12317';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='93B9F3';
var theTemplate={
				name: 			'Nurseries',
				paletteFamily: 	'93B9F3',
				keyvisualId: 	'7912',
				keyvisualName: 	'kv_7912.jpg',
				fontsetId: 		'16877',
				graphicsetId: 	'12317',
				contentColor: 	'000000',
				contentBGColor: '93B9F3',
				hasFlashNavigation: 'true',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'true',
				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['1001']=webappMappings['1001-ahw050inx3jk7f77aba30a9cb1eb']={
webappId:    '1001',
documentId:  '16901',
internalId:  'ahw050inx3jk7f77aba30a9cb1eb',
customField: ''
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-1389870']={
webappId:    '1501',
documentId:  '401',
internalId:  '1389870',
customField: '1501'
};
webappMappings['7060']=webappMappings['7060-f7414b217e7565ab1760bd7f1802e210']={
webappId:    '7060',
documentId:  '40359',
internalId:  'f7414b217e7565ab1760bd7f1802e210',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20100409-000521'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2401',
internalId:  '',
customField: '20090102-193216'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35001',
internalId:  '',
customField: '20080205-010404'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35022',
internalId:  '',
customField: '20080205-005034'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28301',
internalId:  '',
customField: '20080202-060035'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40359',
internalId:  '',
customField: '20081020-161304'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27901',
internalId:  '',
customField: '20080716-053205'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2422',
internalId:  '',
customField: '20071024-040545'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2443',
internalId:  '',
customField: '20080202-043351'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2464',
internalId:  '',
customField: '20081020-161347'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10101',
internalId:  '',
customField: '20090618-230412'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10122',
internalId:  '',
customField: '20100409-001213'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16901',
internalId:  '',
customField: '20100409-001331'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25201',
internalId:  '',
customField: '20080531-040805'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41226',
internalId:  '',
customField: '20090102-191958'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41464',
internalId:  '',
customField: '20090921-162346'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '41935',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['7005']=webappMappings['7005-515']={
webappId:    '7005',
documentId:  '41953',
internalId:  '515',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41935',
internalId:  '',
customField: '20100107-030537'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41953',
internalId:  '',
customField: '20100107-030711'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INX3JK';
var companyName   = 'AAA+PAINTING++%28323%29-600-4198+*+%28310%29-926-0021';
var htmlTitle	  = 'http%3A%2F%2Fwww.aaapainting4you.com';
var metaKeywords  = 'painter%2Cpainting%2Clos+angeels+painter%2Crosemead+painting%2Cpainting+contractors+in+ca';
var metaContents  = 'www.aaapainting4you.com';
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();
};
