/* [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','552',jdecode('Schnitzen+%2F+Drechseln'),jdecode(''), jdecode('%2F552.html'), 'true',[],'',''],
	['PAGE','36901',jdecode('Download'),jdecode(''), jdecode('%2F36901%2Findex.html'), 'true',[ 
		['PAGE','58601',jdecode('Sekundenleim'),jdecode(''), jdecode('%2F36901%2F58601.html'), 'true',[],'','']
	],'',''],
	['PAGE','5001',jdecode('Kursprogramm'),jdecode(''), jdecode('%2F5001%2Findex.html'), 'true',[ 
		['PAGE','38922',jdecode('Kurse'),jdecode(''), jdecode('%2F5001%2F38922.html'), 'true',[],'',''],
		['PAGE','56201',jdecode('Kursleiter'),jdecode(''), jdecode('%2F5001%2F56201.html'), 'true',[],'','']
	],'',''],
	['PAGE','594',jdecode('ONLINE+-SHOP'),jdecode(''), jdecode('%2F594.html'), 'true',[],'',''],
	['PAGE','57901',jdecode('Lieferkonditionen+Shop'),jdecode(''), jdecode('%2F57901.html'), 'true',[],'',''],
	['PAGE','6801',jdecode('Partner'),jdecode(''), jdecode('%2F6801.html'), 'true',[],'',''],
	['PAGE','636',jdecode('Kontakt'),jdecode(''), jdecode('%2F636.html'), 'true',[],'',''],
	['PAGE','5301',jdecode('Anfahrt'),jdecode(''), jdecode('%2F5301.html'), 'true',[],'',''],
	['PAGE','720',jdecode('Impressum'),jdecode(''), jdecode('%2F720%2Findex.html'), 'true',[ 
		['PAGE','36922',jdecode('Entstehung+'),jdecode(''), jdecode('%2F720%2F36922.html'), 'true',[],'',''],
		['PAGE','36943',jdecode('Ansprechpartner'),jdecode(''), jdecode('%2F720%2F36943.html'), 'true',[],'','']
	],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Sportive';
theSitetree.paletteFamily='F6F6E6';
theSitetree.keyvisualId='2693';
theSitetree.keyvisualName='werkzeuge.jpg';
theSitetree.fontsetId='220';
theSitetree.graphicsetId='260';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='F6F6E6';
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: 			'Sportive',
				paletteFamily: 	'F6F6E6',
				keyvisualId: 	'2693',
				keyvisualName: 	'werkzeuge.jpg',
				fontsetId: 		'220',
				graphicsetId: 	'260',
				contentColor: 	'000000',
				contentBGColor: 'F6F6E6',
				a_color: 		'F6F6E6',
				b_color: 		'CCCCC0',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '5301',
internalId:  'location',
customField: 'language:de;country:CH;isIncluded:false;'
};
webappMappings['7008']=webappMappings['7008-1138']={
webappId:    '7008',
documentId:  '636',
internalId:  '1138',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20120125-064923'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '552',
internalId:  '',
customField: '20071107-164735'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36901',
internalId:  '',
customField: '20101120-113434'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '58601',
internalId:  '',
customField: '20080114-113117'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20081103-094651'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38922',
internalId:  '',
customField: '20071106-081843'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56201',
internalId:  '',
customField: '20071102-133346'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '594',
internalId:  '',
customField: '20101120-105157'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57901',
internalId:  '',
customField: '20080804-161127'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6801',
internalId:  '',
customField: '20080313-080637'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '636',
internalId:  '',
customField: '20071101-113925'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5301',
internalId:  '',
customField: '20070927-142304'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '720',
internalId:  '',
customField: '20071101-114011'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36922',
internalId:  '',
customField: '20071101-111923'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36943',
internalId:  '',
customField: '20071102-132726'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0IN2HBZ';
var companyName   = 'Eisenwaren++%26++Schnitzereibedarf';
var htmlTitle	  = 'Eisenwaren+und+Schnitzereibedarf';
var metaKeywords  = 'Schnitzerei%3BSchnitzereibedarf%3BEisenwaren%3BSchrauben%3BWerkzeuge%3BMaschinen';
var metaContents  = 'Eisenwaren+und+Schnitzereibedarf';
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();
};

