/* [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','1801',jdecode('Home'),jdecode(''), jdecode('%2F1801.html'), 'true',[],'',''],
	['PAGE','4001',jdecode('News'),jdecode(''), jdecode('%2F4001.html'), 'true',[],'',''],
	['PAGE','10801',jdecode('Portr%C3%A4t'),jdecode(''), jdecode('%2F10801%2Findex.html'), 'true',[ 
		['PAGE','31201',jdecode('Organigramm'),jdecode(''), jdecode('%2F10801%2F31201.html'), 'true',[],'',''],
		['PAGE','4064',jdecode('Presse'),jdecode(''), jdecode('%2F10801%2F4064.html'), 'true',[],'',''],
		['PAGE','5301',jdecode('Jobs'),jdecode(''), jdecode('%2F10801%2F5301.html'), 'true',[],'','']
	],'',''],
	['PAGE','29801',jdecode('-+Metallbau'),jdecode(''), jdecode('%2F29801%2Findex.html'), 'true',[ 
		['PAGE','15106',jdecode('T%C3%BCren+und+Tore'),jdecode(''), jdecode('%2F29801%2F15106.html'), 'true',[],'',''],
		['PAGE','15022',jdecode('Vord%C3%A4cher'),jdecode(''), jdecode('%2F29801%2F15022.html'), 'true',[],'',''],
		['PAGE','30401',jdecode('Windf%C3%A4nge'),jdecode(''), jdecode('%2F29801%2F30401.html'), 'true',[],'',''],
		['PAGE','15043',jdecode('Winterg%C3%A4rten'),jdecode(''), jdecode('%2F29801%2F15043.html'), 'true',[],'',''],
		['PAGE','18501',jdecode('Pergolas'),jdecode(''), jdecode('%2F29801%2F18501.html'), 'true',[],'',''],
		['PAGE','15085',jdecode('Treppenbau'),jdecode(''), jdecode('%2F29801%2F15085.html'), 'true',[],'',''],
		['PAGE','15127',jdecode('Gel%C3%A4nder'),jdecode(''), jdecode('%2F29801%2F15127.html'), 'true',[],'',''],
		['PAGE','15148',jdecode('Verglasungen'),jdecode(''), jdecode('%2F29801%2F15148.html'), 'true',[],'',''],
		['PAGE','30422',jdecode('Blechbearbeitung'),jdecode(''), jdecode('%2F29801%2F30422.html'), 'true',[],'','']
	],'',''],
	['PAGE','15064',jdecode('-+Stahlbau'),jdecode(''), jdecode('%2F15064%2Findex.html'), 'true',[ 
		['PAGE','15001',jdecode('Balkonanbauten'),jdecode(''), jdecode('%2F15064%2F15001.html'), 'true',[],'',''],
		['PAGE','30443',jdecode('Liftt%C3%BCrme'),jdecode(''), jdecode('%2F15064%2F30443.html'), 'true',[],'',''],
		['PAGE','30464',jdecode('Spez.+Konstruktionen'),jdecode(''), jdecode('%2F15064%2F30464.html'), 'true',[],'','']
	],'',''],
	['PAGE','29843',jdecode('-+Fassadenbau'),jdecode(''), jdecode('%2F29843%2Findex.html'), 'true',[ 
		['PAGE','30485',jdecode('Fassaden'),jdecode(''), jdecode('%2F29843%2F30485.html'), 'true',[],'',''],
		['PAGE','30506',jdecode('Fenster'),jdecode(''), jdecode('%2F29843%2F30506.html'), 'true',[],'',''],
		['PAGE','31001',jdecode('Hub-%2FSenkfenster'),jdecode(''), jdecode('%2F29843%2F31001.html'), 'true',[],'',''],
		['PAGE','30527',jdecode('T%C3%BCren'),jdecode(''), jdecode('%2F29843%2F30527.html'), 'true',[],'','']
	],'',''],
	['PAGE','27801',jdecode('Referenzen'),jdecode(''), jdecode('%2F27801.html'), 'true',[],'',''],
	['PAGE','13601',jdecode('Reparaturauftrag'),jdecode(''), jdecode('%2F13601.html'), 'true',[],'',''],
	['PAGE','31222',jdecode('Kontakt'),jdecode(''), jdecode('%2F31222%2Findex.html'), 'true',[ 
		['PAGE','24801',jdecode('Merenschwand'),jdecode(''), jdecode('%2F31222%2F24801.html'), 'true',[],'',''],
		['PAGE','6301',jdecode('Z%C3%BCrich'),jdecode(''), jdecode('%2F31222%2F6301.html'), 'true',[],'',''],
		['PAGE','4085',jdecode('Mitteilung'),jdecode(''), jdecode('%2F31222%2F4085.html'), 'true',[],'','']
	],'','']];
var siteelementCount=31;
theSitetree.topTemplateName='Bow';
theSitetree.paletteFamily='0086C2';
theSitetree.keyvisualId='12019';
theSitetree.keyvisualName='kv_12019.jpg';
theSitetree.fontsetId='33246';
theSitetree.graphicsetId='14115';
theSitetree.contentColor='333333';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MX'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Bow',
				paletteFamily: 	'0086C2',
				keyvisualId: 	'12019',
				keyvisualName: 	'kv_12019.jpg',
				fontsetId: 		'33246',
				graphicsetId: 	'14115',
				contentColor: 	'333333',
				contentBGColor: 'FFFFFF',
				a_color: 		'F2F5F8',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1801',
internalId:  '',
customField: '20110307-210220'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15106',
internalId:  '',
customField: '20120102-123913'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '29801',
internalId:  '-',
customField: '20120102-011254'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4001',
internalId:  '',
customField: '20120102-012004'
};
webappMappings['7008']=webappMappings['7008-8062']={
webappId:    '7008',
documentId:  '4085',
internalId:  '8062',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '30422',
internalId:  '-',
customField: '20120101-223432'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4064',
internalId:  '',
customField: '20111231-181144'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4085',
internalId:  '',
customField: '20111231-175832'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1801',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '30401',
internalId:  '-',
customField: '20120102-114750'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6301',
internalId:  '',
customField: '20120102-155450'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5301',
internalId:  '',
customField: '20111231-180638'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '29843',
internalId:  '-',
customField: '20120102-011420'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15085',
internalId:  '',
customField: '20120102-144603'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15064',
internalId:  '',
customField: '20120102-011136'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15022',
internalId:  '',
customField: '20091206-001545'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15043',
internalId:  '',
customField: '20120102-150451'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10801',
internalId:  '',
customField: '20110307-210433'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15127',
internalId:  '',
customField: '20120102-142801'
};
webappMappings['7008']=webappMappings['7008-8146']={
webappId:    '7008',
documentId:  '13601',
internalId:  '8146',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15001',
internalId:  '',
customField: '20120102-141742'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13601',
internalId:  '',
customField: '20091202-203141'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15148',
internalId:  '',
customField: '20120102-150009'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18501',
internalId:  '',
customField: '20120102-130051'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24801',
internalId:  '',
customField: '20120102-155326'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27801',
internalId:  '',
customField: '20110307-212118'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '30443',
internalId:  '-',
customField: '20120102-010907'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '30464',
internalId:  '-',
customField: '20120102-114915'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '30485',
internalId:  '-',
customField: '20120102-123526'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '30506',
internalId:  '-',
customField: '20120102-152103'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '31001',
internalId:  '-',
customField: '20120102-120305'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '30527',
internalId:  '-',
customField: '20120102-123638'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '31222',
internalId:  '-',
customField: '20120102-011934'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '31201',
internalId:  '-',
customField: '20120101-235900'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW330INEYZ8';
var companyName   = '';
var htmlTitle	  = 'Joos+Metall+%2B+Stahlbau+AG';
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();
};

