/* [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','2147',jdecode('Home'),jdecode(''),'/2147.html','true',[],'',''],
	['PAGE','6601',jdecode('About+Me+'),jdecode(''),'/6601.html','true',[],'',''],
	['PAGE','6801',jdecode('Cakes+Available'),jdecode(''),'/6801.html','true',[],'',''],
	['PAGE','3901',jdecode('Cake+Gallery'),jdecode(''),'/3901/index.html','true',[ 
		['PAGE','8001',jdecode('Wedding+Cakes'),jdecode(''),'/3901/8001.html','true',[],'',''],
		['PAGE','8301',jdecode('Birthday+Cakes'),jdecode(''),'/3901/8301.html','true',[],'',''],
		['PAGE','8327',jdecode('Anniversary+%2F+Celebration+Cakes'),jdecode(''),'/3901/8327.html','true',[],'',''],
		['PAGE','8353',jdecode('Christening+Cakes'),jdecode(''),'/3901/8353.html','true',[],'',''],
		['PAGE','8379',jdecode('Seasonal+Cakes'),jdecode(''),'/3901/8379.html','true',[],'','']
	],'',''],
	['PAGE','6201',jdecode('Fillings+%26+Flavours'),jdecode(''),'/6201.html','true',[],'',''],
	['PAGE','10401',jdecode('Prices'),jdecode(''),'/10401.html','true',[],'',''],
	['PAGE','3927',jdecode('Areas+Covered'),jdecode(''),'/3927.html','true',[],'',''],
	['PAGE','3979',jdecode('Contact'),jdecode(''),'/3979.html','true',[],'',''],
	['PAGE','3953',jdecode('Comments+Page'),jdecode(''),'/3953.html','true',[],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Seniorparty';
theSitetree.paletteFamily='F0CCDE';
theSitetree.keyvisualId='10383';
theSitetree.keyvisualName='kv_10383.jpg';
theSitetree.fontsetId='21227';
theSitetree.graphicsetId='13368';
theSitetree.contentColor='604663';
theSitetree.contentBGColor='F0CCDE';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Seniorparty',
				paletteFamily: 	'F0CCDE',
				keyvisualId: 	'10383',
				keyvisualName: 	'kv_10383.jpg',
				fontsetId: 		'21227',
				graphicsetId: 	'13368',
				contentColor: 	'604663',
				contentBGColor: 'F0CCDE',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3901',
internalId:  '',
customField: '20100217-124414'
};
webappMappings['7002']=webappMappings['7002-2486']={
webappId:    '7002',
documentId:  '3953',
internalId:  '2486',
customField: 'language:en;country:GB;'
};
webappMappings['7008']=webappMappings['7008-5350']={
webappId:    '7008',
documentId:  '3979',
internalId:  '5350',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10401',
internalId:  '',
customField: '20100411-205703'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2147',
internalId:  '',
customField: '20100217-160121'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3927',
internalId:  '',
customField: '20100217-130627'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '3927',
internalId:  'location',
customField: 'language:en;country:GB;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3979',
internalId:  '',
customField: '20100126-095527'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3953',
internalId:  '',
customField: '20100210-203536'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6201',
internalId:  '',
customField: '20100217-130557'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6601',
internalId:  '',
customField: '20100217-123936'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6801',
internalId:  '',
customField: '20100217-124229'
};
webappMappings['7060']=webappMappings['7060-ed0c614f753a9b47f4ea6c9855255401']={
webappId:    '7060',
documentId:  '8001',
internalId:  'ed0c614f753a9b47f4ea6c9855255401',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8001',
internalId:  '',
customField: '20100217-124734'
};
webappMappings['7060']=webappMappings['7060-a5c205b13537b9ae02f6b470ed041561']={
webappId:    '7060',
documentId:  '8301',
internalId:  'a5c205b13537b9ae02f6b470ed041561',
customField: 'language:en;country:GB;'
};
webappMappings['7060']=webappMappings['7060-78928cab1d0b174676c28dbc7f54e432']={
webappId:    '7060',
documentId:  '8327',
internalId:  '78928cab1d0b174676c28dbc7f54e432',
customField: 'language:en;country:GB;'
};
webappMappings['7060']=webappMappings['7060-f0cc0d3a39735ffba30b2a5b912dbc5c']={
webappId:    '7060',
documentId:  '8353',
internalId:  'f0cc0d3a39735ffba30b2a5b912dbc5c',
customField: 'language:en;country:GB;'
};
webappMappings['7060']=webappMappings['7060-a366250499fc2b61060b4b41a177eec8']={
webappId:    '7060',
documentId:  '8379',
internalId:  'a366250499fc2b61060b4b41a177eec8',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8301',
internalId:  '',
customField: '20100217-125517'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8327',
internalId:  '',
customField: '20100217-125953'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8353',
internalId:  '',
customField: '20100217-130201'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8379',
internalId:  '',
customField: '20100217-130455'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN30E6';
var companyName   = 'Cakes+by+Natalie';
var htmlTitle	  = 'Natalie+-+Online+Gallery';
var metaKeywords  = '';
var metaContents  = '';
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();
};
