/* [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','401',jdecode('Welcome+%21'),jdecode(''),'/401.html','true',[],'',''],
	['PAGE','17401',jdecode('Activities'),jdecode(''),'/17401.html','true',[],'',''],
	['PAGE','494',jdecode('Malvern+Cottage'),jdecode(''),'/494.html','true',[],'',''],
	['PAGE','473',jdecode('Leckhampton+Cottage'),jdecode(''),'/473.html','true',[],'',''],
	['PAGE','557',jdecode('Bredon+Cottage'),jdecode(''),'/557.html','true',[],'',''],
	['PAGE','536',jdecode('Cleeve+Cottage'),jdecode(''),'/536.html','true',[],'',''],
	['PAGE','3501',jdecode('Birdlip+Cottage'),jdecode(''),'/3501.html','true',[],'',''],
	['PAGE','8801',jdecode('Prices+and+details'),jdecode(''),'/8801.html','true',[],'',''],
	['PAGE','17901',jdecode('Useful+links'),jdecode(''),'/17901.html','true',[],'',''],
	['PAGE','8822',jdecode('Contact'),jdecode(''),'/8822.html','true',[],'',''],
	['PAGE','45201',jdecode('Directions+and+map'),jdecode(''),'/45201.html','true',[],'',''],
	['PAGE','44801',jdecode('Arrival'),jdecode(''),'/44801.html','true',[],'',''],
	['PAGE','44827',jdecode('Guest+comments'),jdecode(''),'/44827.html','true',[],'',''],
	['PAGE','44601',jdecode('Question'),jdecode(''),'/44601.html','true',[],'',''],
	['PAGE','45227',jdecode('Photo+album'),jdecode(''),'/45227.html','true',[],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Symmetry';
theSitetree.paletteFamily='A3A766';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10779';
theSitetree.graphicsetId='10873';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='A3A766';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Symmetry',
				paletteFamily: 	'A3A766',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10779',
				graphicsetId: 	'10873',
				contentColor: 	'FFFFFF',
				contentBGColor: 'A3A766',
				a_color: 		'A3A766',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-1768']={
webappId:    '7008',
documentId:  '8822',
internalId:  '1768',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20100401-173342'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17401',
internalId:  '',
customField: '20090422-115903'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3501',
internalId:  '',
customField: '20090417-200610'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '494',
internalId:  '',
customField: '20100208-215835'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20090417-201337'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '557',
internalId:  '',
customField: '20090422-115954'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '536',
internalId:  '',
customField: '20090415-140609'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8801',
internalId:  '',
customField: '20100208-213335'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17901',
internalId:  '',
customField: '20100401-173800'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8822',
internalId:  '',
customField: '20090417-083353'
};
webappMappings['7005']=webappMappings['7005-135']={
webappId:    '7005',
documentId:  '44601',
internalId:  '135',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44601',
internalId:  '',
customField: '20090416-212621'
};
webappMappings['1002']=webappMappings['1002-44827anbt10inxf8d']={
webappId:    '1002',
documentId:  '44827',
internalId:  '44827anbt10inxf8d',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44827',
internalId:  '',
customField: '20090416-220132'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44801',
internalId:  '',
customField: '20090416-215523'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '45201',
internalId:  'location',
customField: 'language:en;country:GB;isIncluded:true;'
};
webappMappings['7060']=webappMappings['7060-41a9e9d869b9cf728de0074c4a56103d']={
webappId:    '7060',
documentId:  '45227',
internalId:  '41a9e9d869b9cf728de0074c4a56103d',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45201',
internalId:  '',
customField: '20090417-200410'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45227',
internalId:  '',
customField: '20100401-173430'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10INXF8D';
var companyName   = 'Church+Court+Cottages%2C+The+Cotswolds%2C+England%2C+UK';
var htmlTitle	  = 'Church+Court+Cottages%2C+self+catering+in+The+Cotswolds';
var metaKeywords  = 'cottages+selfcatering+cotswolds+cheltenham+racing+prestbury+churchcourtcottages+church+court+cottages+4-5stars+visitbritain';
var metaContents  = 'cottages+selfcatering+cotswolds+';
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();
};
