/* [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','4437',jdecode('Home'),jdecode(''),'/4437.html','true',[],'',''],
	['PAGE','10764',jdecode('Balkone+Terrassen'),jdecode(''),'/10764.html','true',[],'',''],
	['PAGE','10845',jdecode('Treppen'),jdecode(''),'/10845.html','true',[],'',''],
	['PAGE','36401',jdecode('Gel%C3%A4nder'),jdecode(''),'/36401.html','true',[],'',''],
	['PAGE','34801',jdecode('T%C3%BCren'),jdecode(''),'/34801.html','true',[],'',''],
	['PAGE','10791',jdecode('Form'),jdecode(''),'/10791.html','true',[],'',''],
	['PAGE','38901',jdecode('Gartenobjekte'),jdecode(''),'/38901.html','true',[],'',''],
	['PAGE','39701',jdecode('Kunst'),jdecode(''),'/39701/index.html','true',[ 
		['PAGE','29501',jdecode('Max+Oertli'),jdecode(''),'/39701/29501.html','true',[],'',''],
		['PAGE','40501',jdecode('Jan+Kaeser'),jdecode(''),'/39701/40501.html','true',[],'','']
	],'',''],
	['PAGE','32501',jdecode('Renovationen'),jdecode(''),'/32501.html','true',[],'',''],
	['PAGE','10872',jdecode('Reparaturen'),jdecode(''),'/10872.html','true',[],'',''],
	['PAGE','44301',jdecode('Referenzliste'),jdecode(''),'/44301.html','true',[],'',''],
	['PAGE','5003',jdecode('Kontakt'),jdecode(''),'/5003/index.html','true',[ 
		['PAGE','6302',jdecode('Kontakt+%28Folgeseite%29'),jdecode(''),'/5003/6302.html','false',[],'','']
	],'',''],
	['PAGE','10899',jdecode('Personen'),jdecode(''),'/10899.html','true',[],'','']];
var siteelementCount=16;
theSitetree.topTemplateName='Movement';
theSitetree.paletteFamily='333F65';
theSitetree.keyvisualId='1819';
theSitetree.keyvisualName='kv_dummy.jpg';
theSitetree.fontsetId='291';
theSitetree.graphicsetId='355';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='333F65';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Movement',
				paletteFamily: 	'333F65',
				keyvisualId: 	'1819',
				keyvisualName: 	'kv_dummy.jpg',
				fontsetId: 		'291',
				graphicsetId: 	'355',
				contentColor: 	'FFFFFF',
				contentBGColor: '333F65',
				a_color: 		'333F65',
				b_color: 		'040507',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10764',
internalId:  '',
customField: '20080901-093924'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4437',
internalId:  '',
customField: '20080813-195658'
};
webappMappings['7060']=webappMappings['7060-bb1e6861114faf7e52927c23c835063b']={
webappId:    '7060',
documentId:  '29501',
internalId:  'bb1e6861114faf7e52927c23c835063b',
customField: 'language:de;country:CH;'
};
webappMappings['7060']=webappMappings['7060-343dc872b99417d9d0b1be62adbdf7fb']={
webappId:    '7060',
documentId:  '36401',
internalId:  '343dc872b99417d9d0b1be62adbdf7fb',
customField: 'language:de;country:CH;'
};
webappMappings['7060']=webappMappings['7060-91fc86f5730055fb4e9e206db9b7a2ea']={
webappId:    '7060',
documentId:  '32501',
internalId:  '91fc86f5730055fb4e9e206db9b7a2ea',
customField: 'language:de;country:CH;'
};
webappMappings['7060']=webappMappings['7060-4dfcae9930ca362795ff56b917e2146d']={
webappId:    '7060',
documentId:  '34801',
internalId:  '4dfcae9930ca362795ff56b917e2146d',
customField: 'language:de;country:CH;'
};
webappMappings['7060']=webappMappings['7060-36b0fae78665cee1d589b7bed01b29f6']={
webappId:    '7060',
documentId:  '38901',
internalId:  '36b0fae78665cee1d589b7bed01b29f6',
customField: 'language:de;country:CH;'
};
webappMappings['7008']=webappMappings['7008-1830']={
webappId:    '7008',
documentId:  '5003',
internalId:  '1830',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10845',
internalId:  '',
customField: '20081006-104823'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36401',
internalId:  '',
customField: '20080818-153040'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34801',
internalId:  '',
customField: '20080816-144732'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10791',
internalId:  '',
customField: '20080901-101821'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38901',
internalId:  '',
customField: '20080820-111125'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39701',
internalId:  '',
customField: '20080822-104702'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29501',
internalId:  '',
customField: '20080822-182858'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40501',
internalId:  '',
customField: '20081006-115745'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32501',
internalId:  '',
customField: '20080816-122748'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10872',
internalId:  '',
customField: '20050112-161427'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44301',
internalId:  '',
customField: '20080919-153127'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5003',
internalId:  '',
customField: '20050104-102812'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6302',
internalId:  '',
customField: '20041021-150040'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10899',
internalId:  '',
customField: '20051217-145057'
};
var canonHostname = 'webomat02.hostpoint.ch';
var accountId     = 'Ahp010IN2NHX';
var companyName   = 'St.+Galler+Metallbau+GmbH';
var htmlTitle	  = 'St.+Galler+Metallbau+GmbH';
var metaKeywords  = 'Metallbau%2C+Schlosserei%2C+Stahlbau%2C+Balkone%2C+Terrassen%2C+Podeste%2C+Chemin%EF%BF%BDe%2C+Cheminee%2C+Garderoben%2C+Kunstgegenst%EF%BF%BDnde%2C+Kunstgegenstaende%2C+Kunstobjekte%2C+Vitrinen%2C+Fenster%2C+T%EF%BF%BDren%2C+Tueren%2C+D%EF%BF%BDcher%2C+Daecher%2C+Treppen%2C+Gel%EF%BF%BDnder%2C+Gelaender%2C+Reparaturen%2C+Willi+Koller%2C+Urs+B%EF%BF%BDhler%2C+Koller%2C+Buehler%2C+B%EF%BF%BD';
var metaContents  = 'St.+Galler+Metallbau+GmbH%2C+Metallbau%2C+Schlosserei%2C+Treppen%2C+Chemin%EF%BF%BDe%2C+Gel%EF%BF%BDnder%2C+Kunst%2C+Koller%2C+B%EF%BF%BDhler%2C+Willi+Koller%2C+Urs+B%EF%BF%BDhler%2C+Reparaturen%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();
};

