/* [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','5001',jdecode('Home'),jdecode(''),'/5001.html','true',[],'',''],
	['PAGE','5052',jdecode('Wir+%C3%BCber+uns'),jdecode(''),'/5052/index.html','true',[ 
		['PAGE','5073',jdecode('Geschichte'),jdecode(''),'/5052/5073.html','true',[],'',''],
		['PAGE','5094',jdecode('Unser+Team'),jdecode(''),'/5052/5094.html','true',[],'','']
	],'',''],
	['PAGE','5220',jdecode('KF+Sanierung'),jdecode(''),'/5220/index.html','true',[ 
		['PAGE','5241',jdecode('Gesetz'),jdecode(''),'/5220/5241.html','true',[],'',''],
		['PAGE','5262',jdecode('Unsere+Leistungen'),jdecode(''),'/5220/5262.html','true',[],'',''],
		['PAGE','5283',jdecode('Bilder'),jdecode(''),'/5220/5283.html','true',[],'',''],
		['PAGE','14501',jdecode('Bilder+Anlagen'),jdecode(''),'/5220/14501.html','true',[],'',''],
		['PAGE','5304',jdecode('Referenzen'),jdecode(''),'/5220/5304.html','true',[],'','']
	],'',''],
	['PAGE','5115',jdecode('Kugelfangkasten'),jdecode(''),'/5115/index.html','true',[ 
		['PAGE','10401',jdecode('Vorschriften'),jdecode(''),'/5115/10401.html','true',[],'',''],
		['PAGE','5157',jdecode('Masse+und+Leistung'),jdecode(''),'/5115/5157.html','true',[],'',''],
		['PAGE','5178',jdecode('Bilder'),jdecode(''),'/5115/5178.html','true',[],'',''],
		['PAGE','5199',jdecode('Referenzen'),jdecode(''),'/5115/5199.html','true',[],'','']
	],'',''],
	['PAGE','5325',jdecode('Hybag-Berin+Cup'),jdecode(''),'/5325/index.html','true',[ 
		['PAGE','12901',jdecode('Adressen'),jdecode(''),'/5325/12901.html','true',[],'',''],
		['PAGE','5346',jdecode('Reglement'),jdecode(''),'/5325/5346.html','true',[],'',''],
		['PAGE','5367',jdecode('Anmeldung'),jdecode(''),'/5325/5367.html','true',[],'',''],
		['PAGE','5388',jdecode('Qualifikation'),jdecode(''),'/5325/5388.html','true',[],'',''],
		['PAGE','5409',jdecode('Resultate+Final'),jdecode(''),'/5325/5409.html','true',[],'',''],
		['PAGE','5430',jdecode('Bilder+Final+2009'),jdecode(''),'/5325/5430.html','true',[],'',''],
		['PAGE','22501',jdecode('Bilder+Final+2010'),jdecode(''),'/5325/22501.html','true',[],'','']
	],'',''],
	['PAGE','5451',jdecode('Jobs'),jdecode(''),'/5451.html','true',[],'',''],
	['PAGE','5472',jdecode('Kontakt'),jdecode(''),'/5472.html','true',[],'',''],
	['PAGE','20601',jdecode('G%C3%A4stebuch'),jdecode(''),'/20601.html','true',[],'','']];
var siteelementCount=26;
theSitetree.topTemplateName='Circulation';
theSitetree.paletteFamily='1243CC';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10587';
theSitetree.graphicsetId='10562';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Circulation',
				paletteFamily: 	'1243CC',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10587',
				graphicsetId: 	'10562',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				a_color: 		'FFFFFF',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20100317-091605'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5052',
internalId:  '',
customField: '20100317-091703'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5073',
internalId:  '',
customField: '20091012-083048'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5094',
internalId:  '',
customField: '20090924-181434'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5451',
internalId:  '',
customField: '20090920-111548'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5472',
internalId:  '',
customField: '20090924-182830'
};
webappMappings['1501']=webappMappings['1501-30090092']={
webappId:    '1501',
documentId:  '5001',
internalId:  '30090092',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5115',
internalId:  '',
customField: '20100317-094211'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5220',
internalId:  '',
customField: '20100317-094510'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5241',
internalId:  '',
customField: '20090924-181557'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5157',
internalId:  '',
customField: '20090921-223805'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5325',
internalId:  '',
customField: '20090926-184629'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10401',
internalId:  '',
customField: '20090904-171712'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5178',
internalId:  '',
customField: '20100317-093035'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5346',
internalId:  '',
customField: '20100729-083220'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5367',
internalId:  '',
customField: '20100729-083328'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5388',
internalId:  '',
customField: '20100729-084115'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5409',
internalId:  '',
customField: '20100729-084047'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5430',
internalId:  '',
customField: '20090926-190626'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5262',
internalId:  '',
customField: '20090924-182022'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5283',
internalId:  '',
customField: '20090920-150758'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5304',
internalId:  '',
customField: '20090923-125658'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5199',
internalId:  '',
customField: '20090921-223855'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12901',
internalId:  '',
customField: '20091110-180249'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14501',
internalId:  '',
customField: '20091112-223433'
};
webappMappings['1002']=webappMappings['1002-20601abw330ineyc6']={
webappId:    '1002',
documentId:  '20601',
internalId:  '20601abw330ineyc6',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20601',
internalId:  '',
customField: '20090924-113723'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22501',
internalId:  '',
customField: '20090926-175843'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW330INEYC6';
var companyName   = 'Berin+GmbH';
var htmlTitle	  = 'berin-gmbh.ch';
var metaKeywords  = 'Berin-GmbHKugelfangsanierungKugelfangkasten';
var metaContents  = 'Kugelfangsanierungen+und+Kugelfangkasten';
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();
};
