/* [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','501',jdecode('Home'),jdecode(''), jdecode('%2F501.html'), 'true',[],'',''],
	['PAGE','573',jdecode('Fahrschule-Angebot'),jdecode(''), jdecode('%2F573.html'), 'true',[],'',''],
	['PAGE','552',jdecode('Theorie-Lokale'),jdecode(''), jdecode('%2F552.html'), 'true',[],'',''],
	['PAGE','26401',jdecode('Motorrad-Pr%C3%BCfung'),jdecode(''), jdecode('%2F26401%2Findex.html'), 'true',[ 
		['PAGE','35201',jdecode('A1+bis+125ccm'),jdecode(''), jdecode('%2F26401%2F35201.html'), 'true',[],'',''],
		['PAGE','37401',jdecode('A+bis+25+kW'),jdecode(''), jdecode('%2F26401%2F37401.html'), 'true',[],'',''],
		['PAGE','37422',jdecode('A+mehr+als+25kW'),jdecode(''), jdecode('%2F26401%2F37422.html'), 'true',[],'',''],
		['PAGE','28501',jdecode('Kursdaten'),jdecode(''), jdecode('%2F26401%2F28501.html'), 'true',[],'','']
	],'',''],
	['PAGE','18501',jdecode('Weg+zur+PW-Pr%C3%BCfung'),jdecode(''), jdecode('%2F18501%2Findex.html'), 'true',[ 
		['PAGE','45901',jdecode('Nothelferkurs'),jdecode(''), jdecode('%2F18501%2F45901.html'), 'true',[],'',''],
		['PAGE','17401',jdecode('Gesuch+einreichen'),jdecode(''), jdecode('%2F18501%2F17401.html'), 'true',[],'',''],
		['PAGE','17443',jdecode('Theoriepr%C3%BCfung'),jdecode(''), jdecode('%2F18501%2F17443.html'), 'true',[],'',''],
		['PAGE','19743',jdecode('VKU'),jdecode(''), jdecode('%2F18501%2F19743.html'), 'true',[],'',''],
		['PAGE','17485',jdecode('Fahrstunden'),jdecode(''), jdecode('%2F18501%2F17485.html'), 'true',[],'',''],
		['PAGE','17506',jdecode('Fahrpr%C3%BCfung'),jdecode(''), jdecode('%2F18501%2F17506.html'), 'true',[],'','']
	],'',''],
	['PAGE','19701',jdecode('Kursdaten+VKU'),jdecode(''), jdecode('%2F19701%2Findex.html'), 'true',[ 
		['PAGE','19722',jdecode('Pr%C3%BCfungsfragebogen'),jdecode(''), jdecode('%2F19701%2F19722.html'), 'true',[],'',''],
		['PAGE','19764',jdecode('Motorrad-Grundkurs'),jdecode(''), jdecode('%2F19701%2F19764.html'), 'true',[],'',''],
		['PAGE','21601',jdecode('Anmeldung'),jdecode(''), jdecode('%2F19701%2F21601.html'), 'true',[],'','']
	],'',''],
	['PAGE','46301',jdecode('Kursdaten+Nothelfer'),jdecode(''), jdecode('%2F46301.html'), 'true',[],'',''],
	['PAGE','17527',jdecode('Lehrmittel+Theorie'),jdecode(''), jdecode('%2F17527.html'), 'true',[],'',''],
	['PAGE','10201',jdecode('Preise'),jdecode(''), jdecode('%2F10201.html'), 'true',[],'',''],
	['PAGE','615',jdecode('Kontakt'),jdecode(''), jdecode('%2F615.html'), 'true',[],'',''],
	['PAGE','17906',jdecode('G%C3%A4stebuch'),jdecode(''), jdecode('%2F17906%2Findex.html'), 'true',[ 
		['PAGE','17901',jdecode('Eintr%C3%A4ge'),jdecode(''), jdecode('%2F17906%2F17901.html'), 'false',[],'','']
	],'',''],
	['PAGE','19301',jdecode('Anfahrt'),jdecode(''), jdecode('%2F19301%2Findex.html'), 'true',[ 
		['PAGE','18001',jdecode('Ihr+Weg+zu+uns'),jdecode(''), jdecode('%2F19301%2F18001.html'), 'true',[],'','']
	],'','']];
var siteelementCount=27;
theSitetree.topTemplateName='Trend';
theSitetree.paletteFamily='3F70CF';
theSitetree.keyvisualId='7928';
theSitetree.keyvisualName='kv_7928.jpg';
theSitetree.fontsetId='16910';
theSitetree.graphicsetId='12323';
theSitetree.contentColor='163D88';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MX'
};
var theTemplate={
				hasFlashNavigation: 'true',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				name: 			'Trend',
				paletteFamily: 	'3F70CF',
				keyvisualId: 	'7928',
				keyvisualName: 	'kv_7928.jpg',
				fontsetId: 		'16910',
				graphicsetId: 	'12323',
				contentColor: 	'163D88',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19701',
internalId:  '',
customField: '20110829-175431'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20111025-162146'
};
webappMappings['1002']=webappMappings['1002-17906abw0x0in2l80']={
webappId:    '1002',
documentId:  '17906',
internalId:  '17906abw0x0in2l80',
customField: 'icq=false'
};
webappMappings['7008']=webappMappings['7008-4866']={
webappId:    '7008',
documentId:  '21601',
internalId:  '4866',
customField: 'language:de;country:CH;'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '18001',
internalId:  'routing',
customField: 'de_CH'
};
webappMappings['1501']=webappMappings['1501-20551812']={
webappId:    '1501',
documentId:  '501',
internalId:  '20551812',
customField: '1501'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '19301',
internalId:  'location',
customField: 'language:de;country:CH;isIncluded:false;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '573',
internalId:  '',
customField: '20110919-234827'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '552',
internalId:  '',
customField: '20110716-131633'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18501',
internalId:  '',
customField: '20090103-181850'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46301',
internalId:  '',
customField: '20110919-234506'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17401',
internalId:  '',
customField: '20110310-204903'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17443',
internalId:  '',
customField: '20090103-170413'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19743',
internalId:  '',
customField: '20080217-222052'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17485',
internalId:  '',
customField: '20090103-171005'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17506',
internalId:  '',
customField: '20090103-180430'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26401',
internalId:  '',
customField: '20110110-193011'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28501',
internalId:  '',
customField: '20111025-161540'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19722',
internalId:  '',
customField: '20080217-224351'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19764',
internalId:  '',
customField: '20111025-161901'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21601',
internalId:  '',
customField: '20080208-002740'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17527',
internalId:  '',
customField: '20110310-204241'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10201',
internalId:  '',
customField: '20110110-192510'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '615',
internalId:  '',
customField: '20090103-165149'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17906',
internalId:  '',
customField: '20080204-221119'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17901',
internalId:  '',
customField: '20080204-221119'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19301',
internalId:  '',
customField: '20080204-223258'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18001',
internalId:  '',
customField: '20080204-221602'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35201',
internalId:  '',
customField: '20110110-193112'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37422',
internalId:  '',
customField: '20091129-222524'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37401',
internalId:  '',
customField: '20091129-222112'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45901',
internalId:  '',
customField: '20110310-204634'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0IN2L80';
var companyName   = 'Auto-%26+Motorradfahrschule+Heinz+J%C3%A4rmann';
var htmlTitle	  = 'Autofahrschule+und+Motorradfahrschule';
var metaKeywords  = 'Autofahrschule++Motorradfahrschule++Verkehrskundeunterricht';
var metaContents  = 'Autofahrschule++Motorradfahrschule++Verkehrskundeunterricht';
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();
};

