/* [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','1701',jdecode('Home'),jdecode(''),'/1701.html','true',[],'',''],
	['PAGE','2401',jdecode('The+Rooms'),jdecode(''),'/2401.html','true',[],'',''],
	['PAGE','1878',jdecode('Price+and+service'),jdecode(''),'/1878.html','true',[],'',''],
	['PAGE','1857',jdecode('Our+Neighbourhood'),jdecode(''),'/1857.html','true',[],'',''],
	['PAGE','33371',jdecode('Activities+'),jdecode(''),'/33371.html','true',[],'',''],
	['PAGE','1899',jdecode('Online+reservation'),jdecode(''),'/1899.html','true',[],'',''],
	['PAGE','33871',jdecode('Reviews'),jdecode(''),'/33871.html','true',[],'',''],
	['PAGE','41871',jdecode('Deer+Ridge+Pottery'),jdecode(''),'/41871.html','true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Enjoy';
theSitetree.paletteFamily='BB9C60';
theSitetree.keyvisualId='2252';
theSitetree.keyvisualName='reise2.jpg';
theSitetree.fontsetId='364';
theSitetree.graphicsetId='417';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='BB9C60';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Enjoy',
				paletteFamily: 	'BB9C60',
				keyvisualId: 	'2252',
				keyvisualName: 	'reise2.jpg',
				fontsetId: 		'364',
				graphicsetId: 	'417',
				contentColor: 	'FFFFFF',
				contentBGColor: 'BB9C60',
				a_color: 		'BB9C60',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1701',
internalId:  '',
customField: '20100716-192205'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2401',
internalId:  '',
customField: '20110728-175743'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1899',
internalId:  '',
customField: '20090224-210507'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1878',
internalId:  '',
customField: '20110701-175750'
};
webappMappings['7008']=webappMappings['7008-3175']={
webappId:    '7008',
documentId:  '1899',
internalId:  '3175',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33871',
internalId:  '',
customField: '20090906-143348'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1857',
internalId:  '',
customField: '20100226-134749'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41871',
internalId:  '',
customField: '20110510-234109'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33371',
internalId:  '',
customField: '20091214-190051'
};
webappMappings['1002']=webappMappings['1002-33871aendu0in2ybm']={
webappId:    '1002',
documentId:  '33871',
internalId:  '33871aendu0in2ybm',
customField: 'icq=false'
};
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0IN2YBM';
var companyName   = 'Deer+Ridge+Lodge+-+B%26B';
var htmlTitle	  = 'Deer+Ridge+Lodge++Bed++Breakfast%2CCrawford+Bay%2C+British+Columbia%2C+Canada';
var metaKeywords  = 'Bed+and++Breakfast%2Cbb%2C+BB%2Cb%2C+B+and+B%2C+bed+and+breakfast%2C+British+Columbia%2C+Canada%2C+Kootenays%2C+Deer+Ridge%2C+Kootenay+Lake%2C+Crawford+Bay%2C+Lodge%2C+lodging%2C+places+to+stay%2C+deer+ridge%2C+artisan%2C+artisans%2Ctourism%2C+accommodation%2C+hotel%2C+Ainsworth%2C+hot+springs%2C+Kokanee+Glacier%2C+Kokanee%2C+Kokanee+Springs+Golf+Course%2C+bird+watching%2C+golf%2C+mountain+biking%2C+sailing%2C+motorcycling%2C+swimming%2C+caving%2C+yoga%2C+acupuncture%2C+Chinese+medicine%2C+cooking%2C+food%2C+quilt+festival%2C+artisans%2C+crafts%2C+potters%2C+jazz%2C+Star+Belly+Jam%2C+music+festival%2C+canoeing%2C+kayaking%2C+fishing%2C+hiking%2C+water+skiing%2C+boating%2C+Balfour%2C+Boswell%2C+Castlegar%2C+Cranbrook%2C+Crawford+Bay%2C+Creston%2C+Gray+Creek%2C+Invermere%2C+Kaslo%2C+Kelowna%2C+Mirror+Lake%2C+Nelson%2C+Queen+City%2C+Riondel%2C+Deer+Ridge+pottery+and+quilt+studio%2C+pottery+studio%2C+pottery%2C+quilts';
var metaContents  = 'Lodge+in+Crawford+Bay%2C+BC%2C+Canada%2C+The+Kootenays+offer+a+wealth+of+activities+and+experiences+such+as+Hiking+and+walking%2C+biking%2C+canoeing%2C+kayaking%2C+golfing%2C+fishing%2C+driving+tours%2C+relaxing+and+birding.+Deer+Ridge+Lodge+is+on+the+highway+in+the+middle+of+the+renowned+Crawford+Bay+Artisan+Community.';
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();
};

