/* [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','3201',jdecode('Home'),jdecode(''),'/3201/index.html','true',[ 
		['PAGE','60629',jdecode('Painter%26%23x27%3Bs+News+Blog'),jdecode(''),'/3201/60629.html','true',[],''],
		['PAGE','42901',jdecode('PICK+COLOURS'),jdecode(''),'/3201/42901.html','true',[],''],
		['PAGE','23901',jdecode('PAINTING+TIPS'),jdecode(''),'/3201/23901.html','true',[],''],
		['PAGE','37101',jdecode('MY+INVENTION'),jdecode(''),'/3201/37101.html','true',[],''],
		['PAGE','73529',jdecode('GOOGLE+MAP'),jdecode(''),'/3201/73529.html','true',[],'']
	],''],
	['PAGE','3252',jdecode('PAINTING+HOUSES'),jdecode(''),'/3252.html','true',[],''],
	['PAGE','3273',jdecode('PAINTING+OFFICES'),jdecode(''),'/3273.html','true',[],''],
	['PAGE','3294',jdecode('PAINTING+FACTORY%26%23x27%3BS'),jdecode(''),'/3294.html','true',[],''],
	['PAGE','4201',jdecode('DRYWALL+%26++REPAIRS'),jdecode(''),'/4201.html','true',[],''],
	['PAGE','4222',jdecode('PLASTER+%26+REPAIRS'),jdecode(''),'/4222.html','true',[],''],
	['PAGE','4243',jdecode('STUCCO+%26+REPAIRS'),jdecode(''),'/4243.html','true',[],''],
	['PAGE','3901',jdecode('ABOUT+US'),jdecode(''),'/3901.html','true',[],''],
	['PAGE','21101',jdecode('CONTACT+US'),jdecode(''),'/21101.html','true',[],''],
	['PAGE','23201',jdecode('PICK+A+LINK'),jdecode(''),'/23201.html','false',[],''],
	['PAGE','58829',jdecode('CUSTOMERS'),jdecode(''),'/58829.html','false',[],'']];
var siteelementCount=16;
theSitetree.topTemplateName='Palette';
theSitetree.paletteFamily='CC0000';
theSitetree.keyvisualId='9342';
theSitetree.keyvisualName='kv_9342.jpg';
theSitetree.fontsetId='17396';
theSitetree.graphicsetId='12844';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Palette',
				paletteFamily: 	'CC0000',
				keyvisualId: 	'9342',
				keyvisualName: 	'kv_9342.jpg',
				fontsetId: 		'17396',
				graphicsetId: 	'12844',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				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['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3201',
internalId:  '',
customField: '20100726-235301'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3901',
internalId:  '',
customField: '20100726-232522'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3252',
internalId:  '',
customField: '20100608-162920'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3273',
internalId:  '',
customField: '20100125-122915'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3294',
internalId:  '',
customField: '20100125-123020'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4201',
internalId:  '',
customField: '20091018-193205'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4222',
internalId:  '',
customField: '20091012-223421'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4243',
internalId:  '',
customField: '20100125-131940'
};
webappMappings['1501']=webappMappings['1501-22699285']={
webappId:    '1501',
documentId:  '3201',
internalId:  '22699285',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21101',
internalId:  '',
customField: '20100726-181816'
};
webappMappings['7008']=webappMappings['7008-21223']={
webappId:    '7008',
documentId:  '21101',
internalId:  '21223',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23901',
internalId:  '',
customField: '20100726-235700'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23201',
internalId:  '',
customField: '20091102-174230'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37101',
internalId:  '',
customField: '20100726-184555'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '73529',
internalId:  '',
customField: '20100726-225923'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '60629',
internalId:  '',
customField: '20100726-235735'
};
webappMappings['7050']=webappMappings['7050-17546']={
webappId:    '7050',
documentId:  '60629',
internalId:  '17546',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '58829',
internalId:  '',
customField: '20100607-194335'
};
webappMappings['1003']=webappMappings['1003-aendu0inv58a12914c0059b']={
webappId:    '1003',
documentId:  '58829',
internalId:  'aendu0inv58a12914c0059b',
customField: 'en:US'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42901',
internalId:  '',
customField: '20100726-170301'
};
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0INV58A';
var companyName   = 'PICK+A+COLOUR+PAINTING+SERVICE';
var htmlTitle	  = 'Painting+Service+%2F++Pick+A+Colour';
var metaKeywords  = 'house+painting+jobs%2Ccommercial+painting+companies%2Cpainting+and+decorating+companies%2Cindustrial+painting+companies%2Cbest+house+painting%2Ccommercial+painting+and+decorating%2Ccommercial+painting+jobs%2Cindustrial+painting+company%2Cpainting+and+decorating+company%2Cpainting+decorating+services%2Cpainting+of+a+roombest+quality+painting%2Cpainting+and+decorating+services%2Cstucco+painting+tips%2Cinterior+house+painting+tips%2Ccommercial+painting+company%2Cprofessional+interior+painting%2Clocal+house+painters%2Cprofessional+painters%2Chigh+quality+painters%2Cprofessional+painters+prices%2Cprofessional+spray+painters%2Cquality+painters%2Chouse+painter+jobs%2Clocal+house+painter%2Cprofessional+interior+painter';
var metaContents  = 'pickacolourpainting.com+provides+painting+service%2C+painters+%2C+house+painting%2C+residential+painting%2C+office+painting';
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();
};
