/* [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','4520',jdecode('Home'),jdecode(''),'/4520.html','true',[],'',''],
	['PAGE','4577',jdecode('Unser+Angebot'),jdecode(''),'/4577/index.html','true',[ 
		['PAGE','4604',jdecode('Die+Wohnung'),jdecode(''),'/4577/4604.html','true',[],'',''],
		['PAGE','4631',jdecode('Der+Garten'),jdecode(''),'/4577/4631.html','true',[],'','']
	],'',''],
	['PAGE','4658',jdecode('Anreise'),jdecode(''),'/4658.html','true',[],'',''],
	['PAGE','4685',jdecode('Preis+%26+Leistung'),jdecode(''),'/4685.html','true',[],'',''],
	['PAGE','4712',jdecode('Kontakt'),jdecode(''),'/4712/index.html','true',[ 
		['PAGE','11901',jdecode('Kontakt+%28Folgeseite%29'),jdecode(''),'/4712/11901.html','false',[],'','']
	],'',''],
	['PAGE','4739',jdecode('Links'),jdecode(''),'/4739.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Enjoy';
theSitetree.paletteFamily='FF9F21';
theSitetree.keyvisualId='2251';
theSitetree.keyvisualName='reise1.jpg';
theSitetree.fontsetId='366';
theSitetree.graphicsetId='418';
theSitetree.contentColor='A00000';
theSitetree.contentBGColor='FF9F21';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Enjoy',
				paletteFamily: 	'FF9F21',
				keyvisualId: 	'2251',
				keyvisualName: 	'reise1.jpg',
				fontsetId: 		'366',
				graphicsetId: 	'418',
				contentColor: 	'A00000',
				contentBGColor: 'FF9F21',
				a_color: 		'FF9F21',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4520',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4577',
internalId:  '',
customField: '20080415-184211'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4520',
internalId:  '',
customField: '20090509-210009'
};
webappMappings['7008']=webappMappings['7008-5463']={
webappId:    '7008',
documentId:  '4712',
internalId:  '5463',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4604',
internalId:  '',
customField: '20090509-204035'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4631',
internalId:  '',
customField: '20090509-204953'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4658',
internalId:  '',
customField: '20090509-205600'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4685',
internalId:  '',
customField: '20090527-232216'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4712',
internalId:  '',
customField: '20080220-210843'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11901',
internalId:  '',
customField: '20080220-210936'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4739',
internalId:  '',
customField: '20080415-184917'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0IN212K';
var companyName   = 'Ferien+in+Methoni%2C+Peloponnes%2C+GR';
var htmlTitle	  = 'Ferien+in+Methoni';
var metaKeywords  = 'Griechenland%2C+Peloponnes%2C+Methoni%2C+Ferienwohnung%2C+Zimmer%2C+Nestor%2C+Zumb%C3%BChl%2C++';
var metaContents  = 'ww.ferienmethoni.chWir+vermietenFerienwohnung+und+Zimmer+in+Methoni%2C+Peloponnes%2C+Griechenland%2C+g%C3%BCnstiger+PreiseAusflugstipps+nach+Pylos%2C+Koroni%2C+Olympia%2C+Nestor%2CEpidauros%2C+Mani%2C+Empfehlungen+f%C3%BCr+Anreise+';
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();
};

