/* [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','11101',jdecode('Home'),jdecode(''),'/11101.html','true',[],'',''],
	['PAGE','15601',jdecode('The++Cottages'),jdecode(''),'/15601.html','true',[],'',''],
	['PAGE','17190',jdecode('Amenities'),jdecode(''),'/17190.html','true',[],'',''],
	['PAGE','15627',jdecode('Symonds+Yat'),jdecode(''),'/15627.html','true',[],'',''],
	['PAGE','15653',jdecode('Tariff'),jdecode(''),'/15653.html','true',[],'',''],
	['PAGE','28990',jdecode('Special+Offers'),jdecode(''),'/28990.html','true',[],'',''],
	['PAGE','17216',jdecode('Directions'),jdecode(''),'/17216.html','true',[],'',''],
	['PAGE','15679',jdecode('Contact+Us'),jdecode(''),'/15679.html','true',[],'',''],
	['PAGE','17242',jdecode('Booking+Requests'),jdecode(''),'/17242.html','true',[],'',''],
	['PAGE','17268',jdecode('Terms+%26+Conditions'),jdecode(''),'/17268.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Fellow';
theSitetree.paletteFamily='02714A';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10637';
theSitetree.graphicsetId='10693';
theSitetree.contentColor='02714A';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Fellow',
				paletteFamily: 	'02714A',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10637',
				graphicsetId: 	'10693',
				contentColor: 	'02714A',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11101',
internalId:  '',
customField: '20100320-100802'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15601',
internalId:  '',
customField: '20100606-215738'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15653',
internalId:  '',
customField: '20100806-221118'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17242',
internalId:  '',
customField: '20100827-193808'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15679',
internalId:  '',
customField: '20090105-122824'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15627',
internalId:  '',
customField: '20090105-122246'
};
webappMappings['7008']=webappMappings['7008-3458']={
webappId:    '7008',
documentId:  '17242',
internalId:  '3458',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17268',
internalId:  '',
customField: '20100107-093619'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '11101',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17216',
internalId:  '',
customField: '20090105-122752'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17190',
internalId:  '',
customField: '20090905-161318'
};
webappMappings['1501']=webappMappings['1501-8506969']={
webappId:    '1501',
documentId:  '11101',
internalId:  '8506969',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28990',
internalId:  '',
customField: '20100705-121302'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20INERIT';
var companyName   = 'Alpine+Holiday+Cottages';
var htmlTitle	  = 'Alpine+Holiday+Cottages+-+Symonds+Yat+West';
var metaKeywords  = 'holiday+cottages+herefordshire+%2Ccottages+herefordshire+%2Cself+catering+cottages+herefordshire+%2Ccottage+to+rent+in+herefordshire+%2Cluxury+cottages+in+herefordshire%2Csymonds+yat+hotels+%2Csymonds+yat+cottage+%2Cguest+house+symonds+yat+%2Chotels+near+symonds+yat+%2Csymonds+yat+holidays+%2Cross+on+wye+hotel+%2Cross+on+wye+accommodation+%2Cself+catering+ross+on+wye+%2Choliday+cottages+ross+on+wye+%2Cguest+house+ross+on+wye+%2Criver+wye+fishing+holiday+%2Criver+wye+hotel+%2Cself+catering+holiday+herefordshire+%2Cself+catering+herefordshire+%2Cself+catering+houses+herefordshire+%2Cholidays+in+herefordshire+%2Cweekend+break+herefordshire+%2Calpine+cottage+%2Calpine+holiday+cottages';
var metaContents  = 'Alpine+Holiday+Cottages%2C+self+catering+accommodation+on+the+bank+of+the+river+Wye+in+Symonds+Yat+Herefordshire.';
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();
};
