/* [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','4501',jdecode('Home'),jdecode(''),'/4501.html','true',[],'',''],
	['PAGE','5401',jdecode('Norway+in+the+Summer'),jdecode(''),'/5401.html','true',[],'',''],
	['PAGE','5427',jdecode('Mountain+Biking'),jdecode(''),'/5427.html','true',[],'',''],
	['PAGE','5453',jdecode('Hafjell+Bike+Trails'),jdecode(''),'/5453.html','true',[],'',''],
	['PAGE','5479',jdecode('Golf'),jdecode(''),'/5479.html','true',[],'',''],
	['PAGE','5505',jdecode('White+Water+Rafting'),jdecode(''),'/5505.html','true',[],'',''],
	['PAGE','5557',jdecode('Family+Activities'),jdecode(''),'/5557.html','true',[],'',''],
	['PAGE','5583',jdecode('About+Us'),jdecode(''),'/5583.html','true',[],'',''],
	['PAGE','5531',jdecode('Accommodation+Details'),jdecode(''),'/5531.html','true',[],'',''],
	['PAGE','5609',jdecode('Prices'),jdecode(''),'/5609.html','true',[],'',''],
	['PAGE','6301',jdecode('Winter+Holidays'),jdecode(''),'/6301.html','true',[],'',''],
	['PAGE','6401',jdecode('Contact+Us'),jdecode(''),'/6401.html','true',[],'',''],
	['PAGE','6501',jdecode('Enquiry+form'),jdecode(''),'/6501.html','true',[],'','']];
var siteelementCount=13;
theSitetree.topTemplateName='Architekt';
theSitetree.paletteFamily='8CBBD8';
theSitetree.keyvisualId='1685';
theSitetree.keyvisualName='abendstimmung.jpg';
theSitetree.fontsetId='280';
theSitetree.graphicsetId='348';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='8CBBD8';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Architekt',
				paletteFamily: 	'8CBBD8',
				keyvisualId: 	'1685',
				keyvisualName: 	'abendstimmung.jpg',
				fontsetId: 		'280',
				graphicsetId: 	'348',
				contentColor: 	'000000',
				contentBGColor: '8CBBD8',
				a_color: 		'8CBBD8',
				b_color: 		'338299',
				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:  '4501',
internalId:  '',
customField: '20100409-133232'
};
webappMappings['1501']=webappMappings['1501-5890396']={
webappId:    '1501',
documentId:  '4501',
internalId:  '5890396',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5401',
internalId:  '',
customField: '20100409-131646'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5427',
internalId:  '',
customField: '20080718-165931'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5453',
internalId:  '',
customField: '20080522-100546'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5479',
internalId:  '',
customField: '20100409-133659'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5505',
internalId:  '',
customField: '20100409-133924'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5531',
internalId:  '',
customField: '20100409-135251'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5557',
internalId:  '',
customField: '20080522-124816'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5583',
internalId:  '',
customField: '20100409-134128'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5609',
internalId:  '',
customField: '20100409-150105'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4501',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-1311']={
webappId:    '7008',
documentId:  '6501',
internalId:  '1311',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6301',
internalId:  '',
customField: '20100409-134156'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6401',
internalId:  '',
customField: '20100409-140141'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6501',
internalId:  '',
customField: '20080508-155937'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20IN2BMC';
var companyName   = 'Norwegian+Wood+Travel+Ltd';
var htmlTitle	  = 'Norway+Summer';
var metaKeywords  = 'Norway+summer+holidays+mountain+biking+holidays+mountain+biking+walking+holidays+golf+holidays+downhill+biking+trips+downhill+biking+activity+holidays+white+water+rafting+family+holidays+norway+cycling+holidays+hiking+holidays+keep+fit+holidays+outdoor+holidays+ski+holidays+summer+skiing+';
var metaContents  = 'Norway+Summer%2C+mountain+biking%2C+hiking%2C+walking%2C+white+water+rafting+and+much+more%21+A+holiday+with+a+difference%21';
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();
};
