/* [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','334',jdecode('Home'),jdecode(''),'/334.html','true',[],'',''],
	['PAGE','355',jdecode('About+us'),jdecode(''),'/355.html','true',[],'',''],
	['PAGE','373',jdecode('Price+and+service'),jdecode(''),'/373/index.html','true',[ 
		['PAGE','2928',jdecode('Painting'),jdecode(''),'/373/2928.html','true',[],'',''],
		['PAGE','2937',jdecode('Wall-papering'),jdecode(''),'/373/2937.html','true',[],'',''],
		['PAGE','2919',jdecode('Laminate+flooring'),jdecode(''),'/373/2919.html','true',[],'',''],
		['PAGE','3054',jdecode('Moldings'),jdecode(''),'/373/3054.html','true',[],'','']
	],'',''],
	['PAGE','472',jdecode('Products'),jdecode(''),'/472.html','true',[],'',''],
	['PAGE','2627',jdecode('Darker+colors+are+in'),jdecode(''),'/2627.html','true',[],'',''],
	['PAGE','517',jdecode('Contact'),jdecode(''),'/517.html','true',[],'',''],
	['PAGE','2242',jdecode('Journal+and+other+Links'),jdecode(''),'/2242.html','true',[],'',''],
	['PAGE','2251',jdecode('Guestbook'),jdecode(''),'/2251/index.html','true',[ 
		['PAGE','2250',jdecode('Read+Guestbook'),jdecode(''),'/2251/2250.html','false',[],'','']
	],'',''],
	['PAGE','2998',jdecode('Don%26%23x27%3Bt+replace+your+home%2C+simply+renew+it.'),jdecode(''),'/2998.html','true',[],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Kingston';
theSitetree.paletteFamily='680282';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='11147';
theSitetree.graphicsetId='11954';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='C59CD0';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Kingston',
				paletteFamily: 	'680282',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'11147',
				graphicsetId: 	'11954',
				contentColor: 	'000000',
				contentBGColor: 'C59CD0',
				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['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '334',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-1830775']={
webappId:    '1501',
documentId:  '334',
internalId:  '1830775',
customField: '1501'
};
webappMappings['7050']=webappMappings['7050-1328']={
webappId:    '7050',
documentId:  '2242',
internalId:  '1328',
customField: 'language:en;country:US;'
};
webappMappings['1002']=webappMappings['1002-2251AHW050IN3YXK']={
webappId:    '1002',
documentId:  '2251',
internalId:  '2251AHW050IN3YXK',
customField: 'icq=false'
};
webappMappings['7060']=webappMappings['7060-0c0f3351c83fcf1dd5abce2aabc07de0']={
webappId:    '7060',
documentId:  '2627',
internalId:  '0c0f3351c83fcf1dd5abce2aabc07de0',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-223d2b3c47ba9b00331ae30c7c647008']={
webappId:    '7060',
documentId:  '2998',
internalId:  '223d2b3c47ba9b00331ae30c7c647008',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '334',
internalId:  '',
customField: '20080415-020439'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '355',
internalId:  '',
customField: '20080227-034743'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '373',
internalId:  '',
customField: '20080112-042309'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2928',
internalId:  '',
customField: '20080112-041139'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2937',
internalId:  '',
customField: '20080112-042446'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2919',
internalId:  '',
customField: '20080112-040657'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3054',
internalId:  '',
customField: '20080227-035421'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '472',
internalId:  '',
customField: '20080112-041712'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2627',
internalId:  '',
customField: '20070404-044353'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '517',
internalId:  '',
customField: '20061011-011623'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2242',
internalId:  '',
customField: '20090725-215149'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2251',
internalId:  '',
customField: '20061011-012428'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2250',
internalId:  '',
customField: '20061011-012428'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2998',
internalId:  '',
customField: '20080112-042226'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3YXK';
var companyName   = 'M+%26+G+Painting+Plus++++++++++++++++++++++++++++++++++++++++++For+all+your+painting+needs';
var htmlTitle	  = 'M++G+Painting+Plus';
var metaKeywords  = 'painting%2C+wallpaper%2C+deck+staining%2C+home+decor%2C+home+improvement%2C+contractor%2C+paint%2C+color%2C+interior%2C+exterior%2C+new+jersey%2C+passaic+county%2C+professional%2C+spackle%2C+drywall%2C+handyman%2C+fixit%2Cmorris+county%2Cunion+county%2Cmiddlesex+county%2Cbergan+county%2Chudson+county%2Csussex+county%2C+moldings%2C+laminate+flooring%2C+floor%2C+pergo%2C+faux%2C+texture%2C+residential%2C+commercial%2C+industrial%2C+crown%2C+chair+rail%2C+base%2C+prime%2C+NJBIA%2C+municipal%2C+24%2F7%2C+';
var metaContents  = 'Painting%2C+wallpaper%2C+deck%2C+staining%2C+home+decor%2C+contractors%2C+home+improvement%2C+Moldings%2C+laminate+flooring%2C+residential%2Ccommercial%2Cindustrial%2C+';
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();
};

