/* [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','4901',jdecode('Home'),jdecode(''),'/4901.html','true',[],'',''],
	['PAGE','5027',jdecode('Inside+The+Little+Barn'),jdecode(''),'/5027.html','true',[],'',''],
	['PAGE','5080',jdecode('What+we+offer'),jdecode(''),'/5080/index.html','true',[ 
		['PAGE','5106',jdecode('Special+Offers'),jdecode(''),'/5080/5106.html','true',[],'','']
	],'',''],
	['PAGE','15601',jdecode('Our+area+and+things+to+do'),jdecode(''),'/15601.html','true',[],'',''],
	['PAGE','5001',jdecode('About+us'),jdecode(''),'/5001.html','true',[],'',''],
	['PAGE','5158',jdecode('Prices+and+contact+us.'),jdecode(''),'/5158.html','true',[],'',''],
	['ITEM','14501',jdecode('Book+or+Reserve'),jdecode(''),'http://web.guestlink.co.uk/bookonline.aspx?pid=1591271','true',[],'','_blank'],
	['PAGE','5132',jdecode('The+Guestbook'),jdecode(''),'/5132.html','true',[],'',''],
	['ITEM','5079',jdecode('links'),jdecode(''),'http://www.northyorkmoors.org.uk ','true',[],'','_blank']];
var siteelementCount=10;
theSitetree.topTemplateName='Livinginamerica';
theSitetree.paletteFamily='A7A664';
theSitetree.keyvisualId='6313';
theSitetree.keyvisualName='kv_6313.jpg';
theSitetree.fontsetId='11154';
theSitetree.graphicsetId='11960';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='E1E0C5';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Livinginamerica',
				paletteFamily: 	'A7A664',
				keyvisualId: 	'6313',
				keyvisualName: 	'kv_6313.jpg',
				fontsetId: 		'11154',
				graphicsetId: 	'11960',
				contentColor: 	'000000',
				contentBGColor: 'E1E0C5',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['1002']=webappMappings['1002-5132anbt30in3uz2']={
webappId:    '1002',
documentId:  '5132',
internalId:  '5132anbt30in3uz2',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4901',
internalId:  '',
customField: '20110307-170551'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20110113-165302'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5027',
internalId:  '',
customField: '20110113-154601'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '15601',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5080',
internalId:  '',
customField: '20110307-171138'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5106',
internalId:  '',
customField: '20110307-142726'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5132',
internalId:  '',
customField: '20110310-161615'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5158',
internalId:  '',
customField: '20110309-161023'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '4901',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '5027',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '5080',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '5106',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15601',
internalId:  '',
customField: '20110310-103526'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '5001',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '5158',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '5132',
internalId:  '',
customField: 'language:en;country:GB;'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT30IN3UZ2';
var companyName   = 'THE+LITTLE+BARN';
var htmlTitle	  = 'The+Little+Barn+self-catering+cottage+on+the+North+York+Moors+near+Pickering';
var metaKeywords  = '%3CMETA+name%3D%22keywords%22+content%3D%22holiday+cottages+north+yorkshire%2Cpickering+holiday+cottages%2Cgoathland+holiday+cottages+%2Choliday+cottage+whitby%2Choliday+homes+north+yorkshire+%2Choliday+cottages+north+yorkshire+moors+%2Cb%26b+north+yorkshire+%2Cbed+and+breakfast+goathland%2Cbed+and+breakfast+north+yorkshire%2Cwhitby+b%26b+%2Cbb+whitby+%2Cbed+breakfast+pickering%2Cpickering+self+catering+%2Cself-catering+north+yorkshire+%2Cself+catering+whitby%2Cself+catering+cottage+whitby%2Cself+catering+north+yorkshire%2Cnorth+yorkshire+holidays%2Cweekend+break+north+yorkshire%2Cwhitby+holiday+lets%2Cshort+breaks+in+whitby+%2Cfarmhouse+holiday+whitby%2Cwalking+in+north+yorkshire%2Ccycling+holiday+whitby+%2Cwalking+in+goathland+%2C+www.thelittlebarn.info%22%3E';
var metaContents  = 'This+cosy+17th+C+cottage+with+oak+beams+lies+in+a+peaceful+garden+in+Lockton+village+on+the+North+York+Moors.+It+offers+superb+3+Star+accommodation+for+2+to+4+.+Perfect+for+walkers%2C+cyclists+and+horse+riders.+Easy+access+to+moorland+%26+forestry.';
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();
};

