/* [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','6101',jdecode('Home'),jdecode(''),'/6101.html','true',[],'',''],
	['PAGE','6152',jdecode('Accommodation'),jdecode(''),'/6152.html','true',[],'',''],
	['PAGE','6178',jdecode('Meals'),jdecode(''),'/6178.html','true',[],'',''],
	['PAGE','6204',jdecode('Prices'),jdecode(''),'/6204.html','true',[],'',''],
	['PAGE','47901',jdecode('Special+Offers'),jdecode(''),'/47901.html','true',[],'',''],
	['PAGE','6230',jdecode('Coach+House+History'),jdecode(''),'/6230.html','true',[],'',''],
	['PAGE','6256',jdecode('Guest+Comments'),jdecode(''),'/6256.html','true',[],'',''],
	['PAGE','6282',jdecode('About+Derby'),jdecode(''),'/6282.html','true',[],'',''],
	['PAGE','6308',jdecode('Directions'),jdecode(''),'/6308.html','true',[],'',''],
	['PAGE','6334',jdecode('Contact+Us'),jdecode(''),'/6334.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Commander';
theSitetree.paletteFamily='87700';
theSitetree.keyvisualId='2437';
theSitetree.keyvisualName='blanko.jpg';
theSitetree.fontsetId='391';
theSitetree.graphicsetId='440';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='E0E0E0';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Commander',
				paletteFamily: 	'87700',
				keyvisualId: 	'2437',
				keyvisualName: 	'blanko.jpg',
				fontsetId: 		'391',
				graphicsetId: 	'440',
				contentColor: 	'000000',
				contentBGColor: 'E0E0E0',
				a_color: 		'E0E0E0',
				b_color: 		'54601',
				c_color: 		'43A53C',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-4232']={
webappId:    '7008',
documentId:  '6334',
internalId:  '4232',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6101',
internalId:  '',
customField: '20100331-152230'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6152',
internalId:  '',
customField: '20100331-152521'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6230',
internalId:  '',
customField: '20100331-154935'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6178',
internalId:  '',
customField: '20100331-152855'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6256',
internalId:  '',
customField: '20100331-164529'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6334',
internalId:  '',
customField: '20100331-165841'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6204',
internalId:  '',
customField: '20100331-154747'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6282',
internalId:  '',
customField: '20100331-165010'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6308',
internalId:  '',
customField: '20100331-165545'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '6101',
internalId:  '1006',
customField: '1006'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '6101',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '6152',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '6178',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '6204',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '6230',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '6256',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '6282',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '6308',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '6334',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47901',
internalId:  '',
customField: '20100106-084936'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20INEFPL';
var companyName   = 'CROMPTON+COACH++HOUSE';
var htmlTitle	  = 'Crompton+Coach+House%2C+Derby+Bed+and+Breakfast%2C+Guest+Accommodation%2C+B+%26+B%2C+Guesthouse+Derby';
var metaKeywords  = 'Derby+Bed+and+Breakfast%2CBed++Breakfast+Derby%2C+B++B+Derby+%2CGuesthouse+Derby%2CGuest+House+Derby%2C+Bed+and+Breakfast+Derby%2C+Derby+City+Centre+Accommodation%2C+DE1+Guest+Accommodation%2CWhere+to+Stay+Derby%2C+Guesthhouse%2C+Guest+House%2C+Bed+and+Breakfast%2C+B++B%2C+Bed++Breakfast%2C+B++B%2C+Guest+house%2C+Guest+House%2C+Guest+Accommodation%2C+Guest+HouseMETA+name%3Dkeywords+content%3Db+and+b+derbyshire%2Cbb+derby%2Cbed+breakfast+derbyshire%2Cbb+derbyshire%2Cbed+and+breakfast+derby%2Cbed+breakfast+derbyshire+uk%2Cderbyshire+bb+accommodation%2Cself+catering+accommodation+derbyshire%2Cderbyshire+holiday+accommodation%2Caccommodation+in+derby%2Caccommodation+derbyshire%2Ccoach+house+derbyshire%2Cbed+and+breakfast+east+midlands+england%2Cbed+and+breakfast+east+midlands%2Cmidlands+bb+holidays%2Cmidlands+bb+breaks%2Cb++b+accommodation+midlands%2Cb++b+midlands%2Cholidays+derby%2Cderbyshire+holidays%2Cshort+breaks+in+derbyshire%2Choliday+house+derbyshire%2Cshort+break+in+derby%2Choliday+homes+derbyshire%2C+www.cromptoncoachhouse.co.uk';
var metaContents  = 'Crompton+Coach+House%2C+Bed+and+Breakfast+Derby%2CGuesthouse+Derby%2CB++B+Derby%2C+Bed++Breakfast+Derby%2CGuest+House+Derby%2C+Derby+City+Centre+Accommodation%2C+DE1+Guest+Accommodation%2C+Where+to+stay+Derby%2C+Hotel%2C+Bed+and+Breakfast%2C+Guesthouse%2C+Guest+House%2C+Guest+Accommodation';
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();
};
