/* [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','2201',jdecode('Home'),jdecode(''),'/2201.html','true',[],'',''],
	['PAGE','4401',jdecode('B%C3%A4r+des+Monats'),jdecode(''),'/4401.html','true',[],'',''],
	['PAGE','15801',jdecode('B%C3%A4ren+und+anderes'),jdecode(''),'/15801.html','true',[],'',''],
	['PAGE','16001',jdecode('Adoptieren'),jdecode(''),'/16001.html','true',[],'',''],
	['PAGE','29101',jdecode('NEU%3A+Tatzengalerie'),jdecode(''),'/29101.html','true',[],'',''],
	['PAGE','2252',jdecode('%C3%9Cber+mich+und+die+B%C3%A4ren'),jdecode(''),'/2252/index.html','true',[ 
		['PAGE','23601',jdecode('Oft+gefragt'),jdecode(''),'/2252/23601.html','true',[],'','']
	],'',''],
	['PAGE','16022',jdecode('Kontakt'),jdecode(''),'/16022/index.html','true',[ 
		['PAGE','4443',jdecode('Kontakt'),jdecode(''),'/16022/4443.html','true',[],'',''],
		['PAGE','16043',jdecode('Hier+sind+wir+zu+finden'),jdecode(''),'/16022/16043.html','true',[],'','']
	],'',''],
	['PAGE','4464',jdecode('AGB'),jdecode(''),'/4464.html','true',[],'',''],
	['PAGE','26122',jdecode('Versandkosten'),jdecode(''),'/26122.html','true',[],'',''],
	['PAGE','15822',jdecode('G%C3%A4stebuch'),jdecode(''),'/15822.html','true',[],'',''],
	['PAGE','21901',jdecode('B%C3%A4rige+Empfehlungen'),jdecode(''),'/21901.html','true',[],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Corpus';
theSitetree.paletteFamily='A19A7E';
theSitetree.keyvisualId='8954';
theSitetree.keyvisualName='kv_8954.jpg';
theSitetree.fontsetId='17258';
theSitetree.graphicsetId='12681';
theSitetree.contentColor='7F723C';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Corpus',
				paletteFamily: 	'A19A7E',
				keyvisualId: 	'8954',
				keyvisualName: 	'kv_8954.jpg',
				fontsetId: 		'17258',
				graphicsetId: 	'12681',
				contentColor: 	'7F723C',
				contentBGColor: 'FFFFFF',
				a_color: 		'bdaf77',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2201',
internalId:  '',
customField: '20100801-082937'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2252',
internalId:  '',
customField: '20100225-094453'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16022',
internalId:  '',
customField: '20100123-161533'
};
webappMappings['7008']=webappMappings['7008-1332']={
webappId:    '7008',
documentId:  '4443',
internalId:  '1332',
customField: 'language:de;country:CH;'
};
webappMappings['7008']=webappMappings['7008-1338']={
webappId:    '7008',
documentId:  '16001',
internalId:  '1338',
customField: 'language:de;country:CH;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2201',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4401',
internalId:  '',
customField: '20100801-105632'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4443',
internalId:  '',
customField: '20100123-120529'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4464',
internalId:  '',
customField: '20100131-120513'
};
webappMappings['7002']=webappMappings['7002-946']={
webappId:    '7002',
documentId:  '15822',
internalId:  '946',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16043',
internalId:  '',
customField: '20100123-161334'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15801',
internalId:  '',
customField: '20100131-120219'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16001',
internalId:  '',
customField: '20100123-154318'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21901',
internalId:  '',
customField: '20100123-160448'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15822',
internalId:  '',
customField: '20100123-160701'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23601',
internalId:  '',
customField: '20100228-182206'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29101',
internalId:  '',
customField: '20100228-192335'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26122',
internalId:  '',
customField: '20100131-204448'
};
webappMappings['1501']=webappMappings['1501-3891958']={
webappId:    '1501',
documentId:  '2201',
internalId:  '3891958',
customField: '1501'
};
var canonHostname = 'wsc.genotec.ch';
var accountId     = 'AGT340IN2TD2';
var companyName   = '++++++++CheckerB%C3%A4rFactory';
var htmlTitle	  = 'checkerbaerfactory';
var metaKeywords  = 'Checkerb%C3%A4ren+B%C3%A4ren+Teddyb%C3%A4ren+Teddies+';
var metaContents  = 'K%C3%BCnstlerb%C3%A4ren+alles+andere+als+kleinkariert';
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();
};
