/* [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','5501',jdecode('Wir+%C3%BCber+uns'),jdecode(''),'/5501.html','true',[],'',''],
	['PAGE','473',jdecode('Dienstleistungen'),jdecode(''),'/473.html','true',[],'',''],
	['PAGE','11801',jdecode('Ferienresidenzen'),jdecode(''),'/11801/index.html','true',[ 
		['PAGE','34101',jdecode('Seestrasse+42'),jdecode(''),'/11801/34101.html','true',[],'',''],
		['PAGE','22822',jdecode('Adyton+6'),jdecode(''),'/11801/22822.html','true',[],'',''],
		['PAGE','34122',jdecode('Crapera+Damiez+11A'),jdecode(''),'/11801/34122.html','true',[],'',''],
		['PAGE','34143',jdecode('La+Riva+501'),jdecode(''),'/11801/34143.html','true',[],'',''],
		['PAGE','30322',jdecode('Leveloh'),jdecode(''),'/11801/30322.html','true',[],'','']
	],'',''],
	['PAGE','536',jdecode('Kontakt'),jdecode(''),'/536/index.html','true',[ 
		['PAGE','9701',jdecode('Kontaktformular'),jdecode(''),'/536/9701.html','true',[],'','']
	],'',''],
	['PAGE','39901',jdecode('%22Weitersagen%22'),jdecode(''),'/39901.html','true',[],'',''],
	['PAGE','14801',jdecode('Referenzen'),jdecode(''),'/14801.html','false',[],'',''],
	['PAGE','25901',jdecode('Links'),jdecode(''),'/25901.html','true',[],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Seifenblase';
theSitetree.paletteFamily='FF9B5E';
theSitetree.keyvisualId='2353';
theSitetree.keyvisualName='blanko.jpg';
theSitetree.fontsetId='379';
theSitetree.graphicsetId='430';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Seifenblase',
				paletteFamily: 	'FF9B5E',
				keyvisualId: 	'2353',
				keyvisualName: 	'blanko.jpg',
				fontsetId: 		'379',
				graphicsetId: 	'430',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'FFFFFF',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'CC3300',
				e_color: 		'FF3300',
				f_color: 		'FF9966',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39901',
internalId:  '',
customField: '20110303-104408'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22822',
internalId:  '',
customField: '20110303-105248'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20110303-103003'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11801',
internalId:  '',
customField: '20110303-103151'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34101',
internalId:  '',
customField: '20110303-105043'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5501',
internalId:  '',
customField: '20110303-102746'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20110303-095717'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '536',
internalId:  '',
customField: '20110303-112857'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14801',
internalId:  '',
customField: '20100908-215630'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9701',
internalId:  '',
customField: '20080906-190656'
};
webappMappings['7008']=webappMappings['7008-4038']={
webappId:    '7008',
documentId:  '9701',
internalId:  '4038',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25901',
internalId:  '',
customField: '20090601-134821'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34143',
internalId:  '',
customField: '20110303-111913'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30322',
internalId:  '',
customField: '20110303-112739'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34122',
internalId:  '',
customField: '20110303-111706'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW1X0INED9I';
var companyName   = 'LAI+Verwaltungen+GmbH';
var htmlTitle	  = 'LAI+Verwaltungen+GmbH';
var metaKeywords  = 'Ferienwohnung%2C+Ferienhaus%2C+Chalet%2C+Lenzerheide%2C+Ferien%2C+Vaz%2FObervaz%2C+Zorten%2C+Muldain%2C+Lain%2C+Gaeste%2C+Persoenlich%2C+Office+Management%2C+Residenzen%2C+Ferieneigentum%2C+Pflege%2C+Liegenschaften%2C+Ferienresidenzen%2C+Dienstleistung%2C+Verwaltung%2C+Vermietung%2C+Buchhaltungen%2C+Administration%2C+Sekretariat%2C+Fakturierung%2C+Marketing%2C+Werbung%2C+Telefonservice%2C+Chur';
var metaContents  = 'LAI+Verwaltungen+GmbH%2C+die+Adresse+fuer+Buchhaltungen%2C+Mehrwertsteuer%2C+Gehaelter+%2C+Marketing%2C+Sekretariatsarbeiten%2C+Liegenschaften-Verwaltungen+sowie+die+Vermietung+Ihrer+Ferienresidenzen+in+der+Region+Lenzerheide.';
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();
};

