/* [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','45812',jdecode('ACTIVE+EDGE+MORZINE'),jdecode(''), jdecode('%2F45812.html'), 'true',[],'',''],
	['PAGE','19012',jdecode('Morzine'),jdecode(''), jdecode('%2F19012.html'), 'true',[],'',''],
	['PAGE','43512',jdecode('CHALET+CHELMER'),jdecode(''), jdecode('%2F43512.html'), 'true',[],'',''],
	['PAGE','39612',jdecode('CHELMER+Photos'),jdecode(''), jdecode('%2F39612.html'), 'true',[],'',''],
	['PAGE','86223',jdecode('Prices+and+Availabilty+2011%2F2012'),jdecode(''), jdecode('%2F86223.html'), 'true',[],'',''],
	['PAGE','69323',jdecode('CHALET+BANITA'),jdecode(''), jdecode('%2F69323.html'), 'true',[],'',''],
	['PAGE','71523',jdecode('Prices+%26+Availability'),jdecode(''), jdecode('%2F71523.html'), 'true',[],'',''],
	['PAGE','30312',jdecode('SUMMER+SEASON+2011'),jdecode(''), jdecode('%2F30312.html'), 'true',[],'',''],
	['PAGE','85223',jdecode('Prices+and+Availability'),jdecode(''), jdecode('%2F85223.html'), 'true',[],'',''],
	['PAGE','17801',jdecode('Booking+conditions'),jdecode(''), jdecode('%2F17801.html'), 'true',[],'',''],
	['PAGE','35312',jdecode('Guestbook'),jdecode(''), jdecode('%2F35312.html'), 'true',[],'',''],
	['PAGE','77323',jdecode('Guests%26%23x27%3B+photos'),jdecode(''), jdecode('%2F77323.html'), 'true',[],'',''],
	['PAGE','21612',jdecode('Photo+Gallery'),jdecode(''), jdecode('%2F21612.html'), 'true',[],'',''],
	['PAGE','37412',jdecode('Useful+contacts'),jdecode(''), jdecode('%2F37412.html'), 'true',[],'',''],
	['PAGE','20012',jdecode('Special+Offers'),jdecode(''), jdecode('%2F20012.html'), 'true',[],'',''],
	['PAGE','95123',jdecode('CONTACT+US'),jdecode(''), jdecode('%2F95123.html'), 'true',[],'','']];
var siteelementCount=16;
theSitetree.topTemplateName='Livinginamerica';
theSitetree.paletteFamily='6971B1';
theSitetree.keyvisualId='6307';
theSitetree.keyvisualName='kv_6307.jpg';
theSitetree.fontsetId='11151';
theSitetree.graphicsetId='11956';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='D6DAF6';
var localeDef={
  language: 'en',
  country: 'GB'
};
var prodDef={
  wl_name: 'easily_co_uk',
  product: 'WSCSYSSSSLY0XVDH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Livinginamerica',
				paletteFamily: 	'6971B1',
				keyvisualId: 	'6307',
				keyvisualName: 	'kv_6307.jpg',
				fontsetId: 		'11151',
				graphicsetId: 	'11956',
				contentColor: 	'000000',
				contentBGColor: 'D6DAF6',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '85223',
internalId:  '',
customField: '20110803-163815'
};
webappMappings['7008']=webappMappings['7008-9202']={
webappId:    '7008',
documentId:  '95123',
internalId:  '9202',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17801',
internalId:  '',
customField: '20100113-203806'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19012',
internalId:  '',
customField: '20091002-211423'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20012',
internalId:  '',
customField: '20111027-231334'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21612',
internalId:  '',
customField: '20090904-211759'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '69323',
internalId:  '',
customField: '20120116-224954'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '45812',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30312',
internalId:  '',
customField: '20100721-220014'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '86223',
internalId:  '',
customField: '20120116-225549'
};
webappMappings['1002']=webappMappings['1002-35312anbt20inend6']={
webappId:    '1002',
documentId:  '35312',
internalId:  '35312anbt20inend6',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35312',
internalId:  '',
customField: '20090128-230852'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39612',
internalId:  '',
customField: '20100610-204331'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37412',
internalId:  '',
customField: '20110903-225244'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43512',
internalId:  '',
customField: '20110903-224805'
};
webappMappings['7060']=webappMappings['7060-0066db3480a7f632cf9fe9b7a2851399']={
webappId:    '7060',
documentId:  '21612',
internalId:  '0066db3480a7f632cf9fe9b7a2851399',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45812',
internalId:  '',
customField: '20110517-182934'
};
webappMappings['1501']=webappMappings['1501-8825245']={
webappId:    '1501',
documentId:  '45812',
internalId:  '8825245',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '71523',
internalId:  '',
customField: '20120116-225920'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '77323',
internalId:  '',
customField: '20111008-170320'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '95123',
internalId:  '',
customField: '20110830-225020'
};
var webAppHostname = 'cgi.easily.co.uk:80';
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20INEND6';
var companyName   = 'ACTIVE+EDGE+MORZINE';
var htmlTitle	  = 'Active+Edge+Morzine%2C+Chalet+Chelmer';
var metaKeywords  = 'Active+Edge+Morzine%2C+Morzine%2C+Ski%2C+Portes+du+Soleil%2C+Chalet+Timeris%2C+snowboard%2Csnow%2Ccatered+accomodation';
var metaContents  = 'Chalet+Timeris+%28Active+Edge+Morzine%29+is+a+cosy+chalet+in+a+great+location+near+the+center+of++Morzine.+Chalet+Timeris+is+set+up+for+your+comfort+and+is+available+catered%2Cor+self+catered+with+breakfast%2C+so+all+you+have+to+do+is+relax+and+soak+in+the+incredible+views.+';
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();
};

