/* [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','501',jdecode('Home'),jdecode(''),'/501.html','true',[],'',''],
	['PAGE','19668',jdecode('Gallery++face+painting'),jdecode(''),'/19668.html','true',[],'',''],
	['PAGE','44868',jdecode('Birthday+party+pics'),jdecode(''),'/44868.html','true',[],'',''],
	['PAGE','615',jdecode('Gallery+bump+painting'),jdecode(''),'/615.html','true',[],'',''],
	['PAGE','573',jdecode('FAQ'),jdecode(''),'/573.html','true',[],'',''],
	['PAGE','2094',jdecode('enquiry+form'),jdecode(''),'/2094.html','true',[],'',''],
	['PAGE','34368',jdecode('testimonials+%26+useful+links'),jdecode(''),'/34368.html','true',[],'',''],
	['PAGE','28773',jdecode('Guestbook'),jdecode(''),'/28773/index.html','true',[ 
		['PAGE','28768',jdecode('Read+Guestbook'),jdecode(''),'/28773/28768.html','false',[],'','']
	],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Longsights';
theSitetree.paletteFamily='D77AE8';
theSitetree.keyvisualId='6387';
theSitetree.keyvisualName='kv_6387.jpg';
theSitetree.fontsetId='11158';
theSitetree.graphicsetId='11969';
theSitetree.contentColor='6A077D';
theSitetree.contentBGColor='EFB4FA';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Longsights',
				paletteFamily: 	'D77AE8',
				keyvisualId: 	'6387',
				keyvisualName: 	'kv_6387.jpg',
				fontsetId: 		'11158',
				graphicsetId: 	'11969',
				contentColor: 	'6A077D',
				contentBGColor: 'EFB4FA',
				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:  '501',
internalId:  '',
customField: '20100718-090142'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '615',
internalId:  '',
customField: '20071202-122812'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19668',
internalId:  '',
customField: '20080923-182600'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '573',
internalId:  '',
customField: '20071202-121050'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2094',
internalId:  '',
customField: '20070623-092039'
};
webappMappings['1002']=webappMappings['1002-28773anbt10inxhib']={
webappId:    '1002',
documentId:  '28773',
internalId:  '28773anbt10inxhib',
customField: 'icq=false'
};
webappMappings['7008']=webappMappings['7008-326']={
webappId:    '7008',
documentId:  '2094',
internalId:  '326',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28768',
internalId:  '',
customField: '20070630-171524'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28773',
internalId:  '',
customField: '20071202-121408'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34368',
internalId:  '',
customField: '20080714-105159'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44868',
internalId:  '',
customField: '20080314-180541'
};
webappMappings['1501']=webappMappings['1501-5204639']={
webappId:    '1501',
documentId:  '501',
internalId:  '5204639',
customField: '1501'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10INXHIB';
var companyName   = 'chickadee+face+and+body+art';
var htmlTitle	  = 'chickadeefaces.co.uk';
var metaKeywords  = 'kid+face+painting+idea+%2Cbutterfly+face+painting+%2Cface+painting+for+boys+%2Cwildlife+face+painting+%2Cface+painting+examples+%2Ccorporate+party+entertainment+%2Ccorporate+event+team+building+uk+%2Ccorporate+event+idea+%2Ccorporate+event+company+%2Ccorporate+entertainment+package+%2Ccorporate+entertainment+uk+%2Cpregnant+bump+painting+%2Cboy+body+painting+%2Cbody+painting+artists+%2Ckid+body+painting++%2Cbump+painting+art++%2Cpregnant+belly+portraits+%2Cthemed+christmas+party+%2Cbirthday+party+pack+%2Cteenager+birthday+party+idea+%2Cbirthday+party+uk+%2Cchristmas+party+in+uk+%2Cchristmas+party+organisers+%2Centertainer+uk+%2C+www.chickadeefaces.co.uk';
var metaContents  = 'face+painting+service+for+children+and+adults+and+belly+painting+for+pregnant+women.+';
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();
};
