/* [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','2401',jdecode('Home'),jdecode(''),'/2401.html','true',[],'',''],
	['PAGE','18401',jdecode('Wir+%C3%BCber+uns'),jdecode(''),'/18401.html','true',[],'',''],
	['PAGE','18601',jdecode('Metallbau'),jdecode(''),'/18601/index.html','true',[ 
		['PAGE','3122',jdecode('Bildergalerie+Metallbau'),jdecode(''),'/18601/3122.html','true',[],'','']
	],'',''],
	['PAGE','35701',jdecode('Stahlbau+und+Hallenbau'),jdecode(''),'/35701/index.html','true',[ 
		['PAGE','35743',jdecode('Bildergalerie+Stahlbau'),jdecode(''),'/35701/35743.html','true',[],'','']
	],'',''],
	['PAGE','20101',jdecode('Allg.+Maschinenbau'),jdecode(''),'/20101/index.html','true',[ 
		['PAGE','20143',jdecode('Bildergalerie+Maschinenbau'),jdecode(''),'/20101/20143.html','true',[],'','']
	],'',''],
	['PAGE','25201',jdecode('Apparatebau'),jdecode(''),'/25201/index.html','true',[ 
		['PAGE','25243',jdecode('Bildergalerie+Apparatebau'),jdecode(''),'/25201/25243.html','true',[],'','']
	],'',''],
	['PAGE','25264',jdecode('Fahrzeugbau'),jdecode(''),'/25264/index.html','true',[ 
		['PAGE','25306',jdecode('Bildergalerie+Fahrzeugbau'),jdecode(''),'/25264/25306.html','true',[],'','']
	],'',''],
	['PAGE','25327',jdecode('Anlagenbau'),jdecode(''),'/25327/index.html','true',[ 
		['PAGE','25369',jdecode('Bildergalerie+Anlagenbau'),jdecode(''),'/25327/25369.html','true',[],'','']
	],'',''],
	['PAGE','25390',jdecode('Dienstleistungen'),jdecode(''),'/25390.html','true',[],'',''],
	['PAGE','11801',jdecode('Referenzen+Metallbau'),jdecode(''),'/11801.html','true',[],'',''],
	['PAGE','20122',jdecode('Referenzen+Maschinenbau'),jdecode(''),'/20122.html','true',[],'',''],
	['PAGE','26001',jdecode('Jobs'),jdecode(''),'/26001.html','true',[],'',''],
	['PAGE','3501',jdecode('Kontakt'),jdecode(''),'/3501.html','true',[],'',''],
	['PAGE','7801',jdecode('Lageplan'),jdecode(''),'/7801/index.html','true',[ 
		['PAGE','33001',jdecode('Routenplaner'),jdecode(''),'/7801/33001.html','true',[],'','']
	],'','']];
var siteelementCount=21;
theSitetree.topTemplateName='Displace';
theSitetree.paletteFamily='02325B';
theSitetree.keyvisualId='11074';
theSitetree.keyvisualName='kv_11074.jpg';
theSitetree.fontsetId='31959';
theSitetree.graphicsetId='13796';
theSitetree.contentColor='AFD0F2';
theSitetree.contentBGColor='02325B';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Displace',
				paletteFamily: 	'02325B',
				keyvisualId: 	'11074',
				keyvisualName: 	'kv_11074.jpg',
				fontsetId: 		'31959',
				graphicsetId: 	'13796',
				contentColor: 	'AFD0F2',
				contentBGColor: '02325B',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2401',
internalId:  '',
customField: '20100218-104534'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18401',
internalId:  '',
customField: '20100219-115002'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3122',
internalId:  '',
customField: '20100125-142920'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11801',
internalId:  '',
customField: '20090716-182032'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '7801',
internalId:  'location',
customField: 'language:de;country:CH;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7801',
internalId:  '',
customField: '20100217-145219'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3501',
internalId:  '',
customField: '20100625-145717'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18601',
internalId:  '',
customField: '20100219-115033'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20101',
internalId:  '',
customField: '20100219-115154'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20122',
internalId:  '',
customField: '20090625-082422'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20143',
internalId:  '',
customField: '20090629-144740'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25390',
internalId:  '',
customField: '20100219-115343'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26001',
internalId:  '',
customField: '20090721-100326'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25201',
internalId:  '',
customField: '20100219-115214'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25264',
internalId:  '',
customField: '20100219-115235'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25327',
internalId:  '',
customField: '20100219-115322'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35701',
internalId:  '',
customField: '20100219-115133'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33001',
internalId:  '',
customField: '20090618-154433'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '33001',
internalId:  'routing',
customField: 'de_CH'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35743',
internalId:  '',
customField: '20090721-102816'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25306',
internalId:  '',
customField: '20090724-121626'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25243',
internalId:  '',
customField: '20090629-152209'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25369',
internalId:  '',
customField: '20090724-121756'
};
var canonHostname = 'wsc02.webland.ch';
var accountId     = 'AWB010INXL7S';
var companyName   = 'CONTECCA+PLAN+AG+++Engineering';
var htmlTitle	  = 'Contecca+Plan+AG+%3A+Engineering';
var metaKeywords  = '';
var metaContents  = '';
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();
};
