/* [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 theSitetree=[ 
	['PAGE','4518',jdecode('Bienvenus'),jdecode(''),'/4518/index.html','true',[ 
		['PAGE','46716',jdecode('Page+d%26%23x27%3Bacceuil+%28Folgeseite%29'),jdecode(''),'/4518/46716.html','false',[],'']
	],'']];
var siteelementCount=2;
theSitetree.topTemplateName='Neon';
theSitetree.paletteFamily='6699CC';
theSitetree.keyvisualId='908';
theSitetree.keyvisualName='antiquitaeten2.jpg';
theSitetree.fontsetId='161';
theSitetree.graphicsetId='186';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'fr',
  country: 'FR'
};
var theTemplate={
				name: 			'Neon',
				paletteFamily: 	'6699CC',
				keyvisualId: 	'908',
				keyvisualName: 	'antiquitaeten2.jpg',
				fontsetId: 		'161',
				graphicsetId: 	'186',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'666666',
				c_color: 		'000000',
				d_color: 		'6699CC',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4518',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-5727']={
webappId:    '7008',
documentId:  '4518',
internalId:  '5727',
customField: 'language:fr;country:FR;'
};
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW0X0IN2CUB';
var companyName   = 'Roomoflove...Seitensprungzimmer...';
var htmlTitle	  = 'les+studios+pour+vos+aventures%2Cnos+chambres+meubl%C3%A9es+avec+go%C3%BBt+sont+%C3%A0+louer+en+toute+discr%C3%A9tion.Die+Zimmer+der+liebe%2CSeintensprungzimmer+zu+vermieten%2Cmit+viel+Geschmack+eingerichtet.Les+chambres+pour+vos+amours+non+conventionnels';
var metaKeywords  = 'Seitensprungzimmer+vermieten+diskret+sex+Zimmer+chambre+de+lamour+chambre+discr%C3%A8te+chambre+anonyme+chambre+%C3%A0+lheure+chambre+pour+aventure+%2Cchambre%2C+sex%2C+chambre+pour+un+jour+%2Cchambre+du+matin%2C+chambre+pour+une+journ%C3%A9e+%2Cchambre+pour+une+nuit+%2Cchambre+pour+un+soir%2C+studio+pour+aventure+%2Cstudio+dun+soir%2C+studio+pour+une+nuit%2C+love%2C+room%2C+roomoflove%2C+recherche+chambre+anonyme%2C+et+discr%C3%A8te+%2Crecherche+chambre+discr%C3%A8te+%2Cchambre+secr%C3%A8te+sans+inscription%2Cstudio+%2Cstudios%2Cdiscr%C3%A9tion%2Canonymat%2Csecret%2Ccach%C3%A9%2Cinconnu%2Cr%C3%A9serv%C3%A9%2Cdisponible%2Cr%C3%A9gion%2CNeuch%C3%A2tel%2CLausanne%2CFribourg%2CDel%C3%A9mont';
var metaContents  = 'http%3A%2F%2Fwww.roomoflove.ch%2C+location+dune+chambre+discr%C3%A8te+pour+vos+aventures+amoureuses+%2C%C3%A0+lheure%2C+un+forfait+studio+anonyme+et+discr%C3%A8t%2C+Seitensprungzimmer+zu+vermieten+diskret+%2Csans+inscription%2Canonyme%2Csecret.A+Fribourg%2CLausanne%2CDel%C3%A9mont%2CNeuch%C3%A2tel%2CSt.-Ursanne';
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();
};
