/* [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','401',jdecode('home'),jdecode(''),'/401.html','true',[],'',''],
	['PAGE','5201',jdecode('angebote'),jdecode(''),'/5201/index.html','true',[ 
		['PAGE','15122',jdecode('villen'),jdecode(''),'/5201/15122.html','true',[],'',''],
		['PAGE','15143',jdecode('h%C3%A4user'),jdecode(''),'/5201/15143.html','true',[],'',''],
		['PAGE','5243',jdecode('wohnungen'),jdecode(''),'/5201/5243.html','true',[],'','']
	],'',''],
	['PAGE','5285',jdecode('kontakte'),jdecode(''),'/5285/index.html','true',[ 
		['PAGE','98623',jdecode('profil'),jdecode(''),'/5285/98623.html','true',[],'','']
	],'',''],
	['PAGE','19001',jdecode('links'),jdecode(''),'/19001.html','true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Displace';
theSitetree.paletteFamily='CFCFCF';
theSitetree.keyvisualId='11074';
theSitetree.keyvisualName='kv_11074.jpg';
theSitetree.fontsetId='31959';
theSitetree.graphicsetId='13799';
theSitetree.contentColor='342500';
theSitetree.contentBGColor='CFCFCF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Displace',
				paletteFamily: 	'CFCFCF',
				keyvisualId: 	'11074',
				keyvisualName: 	'kv_11074.jpg',
				fontsetId: 		'31959',
				graphicsetId: 	'13799',
				contentColor: 	'342500',
				contentBGColor: 'CFCFCF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20100326-170427'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5201',
internalId:  '',
customField: '20100411-193129'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15143',
internalId:  '',
customField: '20100629-164624'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5243',
internalId:  '',
customField: '20100326-170652'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19001',
internalId:  '',
customField: '20100326-170150'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '98623',
internalId:  '',
customField: '20100506-104306'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15122',
internalId:  '',
customField: '20100613-114412'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5285',
internalId:  '',
customField: '20100326-165844'
};
var canonHostname = 'wsc.genotec.ch';
var accountId     = 'AGT010INXPLB';
var companyName   = 'exklusive+liegenschaften';
var htmlTitle	  = '';
var metaKeywords  = 'eigenheim%2C+eigentumswohnung%2C+haeuserkauf%2C+hauskauf%2C+immobilienagentur%2C+immobilienhandel%2C+immobilienmakler%2C+immobilienmarkt%2C+immobilientreuhand%2C+immobilienverwaltung%2C+liegenschaftenhandel%2C+liegenschaftenmarkt%2C+liegenschaftenverwaltung%2C+liegenschaftshandel%2C+liegenschaftsverwaltung%2C+makler%2C+mietwohnung%2C+mietwohnungen%2C+pacht%2C+wohnraumvermittlung%2C+wohnung%2C+wohnungen%2C+wohnungsagentur%2C+wohnungshandel%2C+wohnungskauf%2C+wohnungsmakler%2C+wohnungsmarkt%2C+wohnungsvermittlung%2C+wohnungsverwaltung++Vermittlung+von+Immobilien%2C+Verwaltung+von+Immobilien%2C+Kauf+und+Verkauf+von+Immobilien+auf+eigene+Rechnung%2C+Immobilienkauf%2C+Immobilienverkauf%2C++Immobilienvermittlung%2C+Liegenschaftsverwaltungen%2C+Immobilienverwaltung%2C+Immobilientreuhand';
var metaContents  = 'Suche+nach+Kaufobjekten%2C+kauf%2C+Wohnungen%2C+H%C3%A4user%2C+neubau%2C+haus%2C+Neubau-Projekte%2C+wohnobjekte+in+den+Bergen%2C+Bauland%2C+B%C3%BCro%2C+Gewerbe%2C+Ladenlokale%2C+Mehrfamilienh%C3%A4user%2C+Villen%2C+Grundst%C3%BCcke%2C+grundst%C3%BCck%2CGewerbeh%C3%A4user%2C+Wohnh%C3%A4user%2C+Gewerbeland%2C+Sch%C3%A4tzungenm%2C+mfh%2C+MFH%2C+++++';
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();
};
