/* [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','1522',jdecode('Home'),jdecode(''),'/1522.html','true',[],''],
	['PAGE','32101',jdecode('Wir+%C3%BCber+uns'),jdecode(''),'/32101.html','true',[],''],
	['PAGE','1501',jdecode('Kontakt'),jdecode(''),'/1501.html','true',[],''],
	['PAGE','15801',jdecode('Leistungskatalog'),jdecode(''),'/15801.html','true',[],''],
	['PAGE','38701',jdecode('Dachwartung'),jdecode(''),'/38701.html','true',[],''],
	['PAGE','3264',jdecode('Referenzen'),jdecode(''),'/3264.html','true',[],''],
	['PAGE','38301',jdecode('Notdienstzuschl%C3%A4ge+'),jdecode(''),'/38301.html','true',[],''],
	['PAGE','7001',jdecode('Partner+Seiten'),jdecode(''),'/7001.html','true',[],''],
	['PAGE','3327',jdecode('Impressum'),jdecode(''),'/3327.html','true',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Startup';
theSitetree.paletteFamily='990000';
theSitetree.keyvisualId='1374';
theSitetree.keyvisualName='werkzeugtasche.jpg';
theSitetree.fontsetId='232';
theSitetree.graphicsetId='279';
theSitetree.contentColor='A00000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'DE'
};
var theTemplate={
				name: 			'Startup',
				paletteFamily: 	'990000',
				keyvisualId: 	'1374',
				keyvisualName: 	'werkzeugtasche.jpg',
				fontsetId: 		'232',
				graphicsetId: 	'279',
				contentColor: 	'A00000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'990000',
				b_color: 		'333333',
				c_color: 		'000000',
				d_color: 		'FF0000',
				e_color: 		'FF0000',
				f_color: 		'FF0000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1522',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1501',
internalId:  '',
customField: '20090814-114018'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1522',
internalId:  '',
customField: '20091212-194817'
};
webappMappings['7008']=webappMappings['7008-376']={
webappId:    '7008',
documentId:  '1501',
internalId:  '376',
customField: 'language:de;country:DE;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32101',
internalId:  '',
customField: '20100329-204750'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38301',
internalId:  '',
customField: '20100307-234156'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3264',
internalId:  '',
customField: '20100329-204621'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38701',
internalId:  '',
customField: '20100307-233102'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15801',
internalId:  '',
customField: '20091208-231815'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3327',
internalId:  '',
customField: '20091011-222412'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7001',
internalId:  '',
customField: '20100111-204116'
};
var canonHostname = 'cm4all3.netcologne.de';
var accountId     = 'ANC330IN2BH2';
var companyName   = '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Bedachungen+Ralf+Brandt+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Bedachungen+Ralf+Brandt';
var htmlTitle	  = 'Dachdecker+K%C3%B6ln';
var metaKeywords  = 'Dachdecker%2C+Dachdecker+K%C3%B6ln%2C+Dachdecker+Notdienst%2C+Bedachungen%2CBedachungen+Brandt%2C';
var metaContents  = 'Dachdecker%2C+Dachdecker+K%C3%B6ln%2C+Bedachungen%2C+Dachdecker+Notdienst+K%C3%B6ln%2CFlachdachsanierung%2CBalkonabdichtungen%2CTerrassenabdichtungen%2CDachbegr%C3%BCnung%2CNaturschiefereindeckungen%2CRestaurierungsarbeiten%2CFaserzementeindeckungen%2CSanierungsarbeiten%2CDacheindeckungen%2CDachklempnerarbeiten%2CDachausbauten%2CDachentw%C3%A4sserung%2CDachfenstermontage%2CW%C3%A4rmed%C3%A4mmung%2CKaminsanierung%2CFassadenverkleidungen%2CGer%C3%BCstbau%2CSolaranlagen%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();
};
