/* [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','2101',jdecode('HOME%3A'),jdecode(''),'/2101/index.html','true',[ 
		['PAGE','17801',jdecode('La+Maison+au+Ruisseau%3A'),jdecode(''),'/2101/17801.html','true',[],'',''],
		['PAGE','4201',jdecode('La+Grange+%28Petite%29+Maison%3A'),jdecode(''),'/2101/4201.html','true',[],'',''],
		['PAGE','4227',jdecode('Gallery%3A'),jdecode(''),'/2101/4227.html','true',[],'','']
	],'',''],
	['PAGE','4253',jdecode('HOW+TO+GET+HERE%3A'),jdecode(''),'/4253.html','true',[],'',''],
	['PAGE','6201',jdecode('SEE+THIS%2C+DO+THAT%3A'),jdecode(''),'/6201.html','true',[],'',''],
	['PAGE','4279',jdecode('PRICING%3A'),jdecode(''),'/4279.html','true',[],'',''],
	['PAGE','2204',jdecode('CONTACT%3A'),jdecode(''),'/2204.html','true',[],'',''],
	['PAGE','22201',jdecode('TERMS+%26+CONDITIONS%3A'),jdecode(''),'/22201.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Billy';
theSitetree.paletteFamily='8D7C50';
theSitetree.keyvisualId='7078';
theSitetree.keyvisualName='kv_7078.jpg';
theSitetree.fontsetId='16391';
theSitetree.graphicsetId='12126';
theSitetree.contentColor='534625';
theSitetree.contentBGColor='8D7C50';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Billy',
				paletteFamily: 	'8D7C50',
				keyvisualId: 	'7078',
				keyvisualName: 	'kv_7078.jpg',
				fontsetId: 		'16391',
				graphicsetId: 	'12126',
				contentColor: 	'534625',
				contentBGColor: '8D7C50',
				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:  '2101',
internalId:  '',
customField: '20100608-201434'
};
webappMappings['7060']=webappMappings['7060-197ff82fb8e400f4e637045f3a61f99b']={
webappId:    '7060',
documentId:  '4227',
internalId:  '197ff82fb8e400f4e637045f3a61f99b',
customField: 'language:en;country:GB;'
};
webappMappings['7008']=webappMappings['7008-1303']={
webappId:    '7008',
documentId:  '2204',
internalId:  '1303',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4227',
internalId:  '',
customField: '20080507-091648'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4253',
internalId:  '',
customField: '20100608-201941'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4279',
internalId:  '',
customField: '20100608-202403'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2204',
internalId:  '',
customField: '20100608-202413'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4201',
internalId:  '',
customField: '20100608-201711'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2101',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22201',
internalId:  '',
customField: '20100608-190029'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17801',
internalId:  '',
customField: '20100608-190902'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6201',
internalId:  '',
customField: '20100608-202106'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20IN2IXA';
var companyName   = 'La+Maison+au+Ruisseau';
var htmlTitle	  = '';
var metaKeywords  = 'Montreuil%2C+le+touquet%2C+rural%2C+peaceful%2C+farmhouse%2C+village+setting%2C+calais%2C+seaside%2C+agincourt%2C+world+war+cemetries%2C+le+crotoy%2C+bay+of+the+somme%2C+big+open+beaches%2C+chateau+de+montreuil%2C+wine+society%2C+good+food%2C+with+in+an+hour+of+calais%2C+eurostar%2C+Boulogne%2C+Hesdin%2C+near+Paris+and+London%2C+easy+to+get+to%2C+';
var metaContents  = 'Rural+life+in+northern+france%2C+two+lovely+converted+farmhouses+%28slepp+8+and+6%29+in+village+setting+with+tennis+court+and+swimming+pool%2C+well+equiped+and+comfortable%2C+large+open+plan+living+spaces.+close+to+Montrieull+and+Le+Touquet%2C+a+great+area+for+expolring+and+relaxing+and+perfect+for+families.';
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();
};
