/* [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','401',jdecode('Home'),jdecode(''), jdecode('%2F401.html'), 'true',[],'',''],
	['PAGE','180801',jdecode('Der+Jugendtreff'),jdecode(''), jdecode('%2F180801.html'), 'true',[],'',''],
	['PAGE','190501',jdecode('Mittwuch-Club'),jdecode(''), jdecode('%2F190501.html'), 'true',[],'',''],
	['PAGE','180864',jdecode('Hausordnung+'),jdecode(''), jdecode('%2F180864.html'), 'true',[],'',''],
	['PAGE','81001',jdecode('Team'),jdecode(''), jdecode('%2F81001.html'), 'true',[],'',''],
	['PAGE','189301',jdecode('Frohe+Aussichten'),jdecode(''), jdecode('%2F189301.html'), 'true',[],'',''],
	['PAGE','75101',jdecode('Projekte'),jdecode(''), jdecode('%2F75101.html'), 'true',[],'',''],
	['PAGE','180843',jdecode('Kontakt'),jdecode(''), jdecode('%2F180843.html'), 'true',[],'',''],
	['PAGE','15301',jdecode('Fotoalbum'),jdecode(''), jdecode('%2F15301%2Findex.html'), 'true',[ 
		['PAGE','164901',jdecode('Jugendtreff+2010'),jdecode(''), jdecode('%2F15301%2F164901.html'), 'true',[],'','']
	],'',''],
	['PAGE','131901',jdecode('Feedback%2C+W%C3%BCnsche'),jdecode(''), jdecode('%2F131901.html'), 'true',[],'',''],
	['PAGE','180885',jdecode('SOS'),jdecode(''), jdecode('%2F180885.html'), 'true',[],'',''],
	['PAGE','6343',jdecode('F%C3%BCr+Erwachsene'),jdecode(''), jdecode('%2F6343%2Findex.html'), 'true',[ 
		['PAGE','191301',jdecode('Aktuell'),jdecode(''), jdecode('%2F6343%2F191301.html'), 'true',[],'',''],
		['PAGE','191322',jdecode('Leitbild'),jdecode(''), jdecode('%2F6343%2F191322.html'), 'true',[],'',''],
		['PAGE','98701',jdecode('Jahresberichte'),jdecode(''), jdecode('%2F6343%2F98701.html'), 'true',[],'',''],
		['PAGE','200801',jdecode('JASSA'),jdecode(''), jdecode('%2F6343%2F200801.html'), 'true',[],'','']
	],'','']];
var siteelementCount=17;
theSitetree.topTemplateName='Caribic';
theSitetree.paletteFamily='7050FA';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10419';
theSitetree.graphicsetId='10707';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='B63636';
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: 			'Caribic',
				paletteFamily: 	'7050FA',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10419',
				graphicsetId: 	'10707',
				contentColor: 	'FFFFFF',
				contentBGColor: 'B63636',
				a_color: 		'000000',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '75101',
internalId:  '',
customField: '20110217-182508'
};
webappMappings['1501']=webappMappings['1501-17690943']={
webappId:    '1501',
documentId:  '401',
internalId:  '17690943',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20110415-154218'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '189301',
internalId:  '',
customField: '20111217-195614'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '190501',
internalId:  '',
customField: '20111217-195130'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '98701',
internalId:  '',
customField: '20111104-155847'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '81001',
internalId:  '',
customField: '20111118-173917'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6343',
internalId:  '',
customField: '20110519-175131'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '180843',
internalId:  '',
customField: '20110902-161613'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '191301',
internalId:  '',
customField: '20110902-162127'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '180864',
internalId:  '',
customField: '20110217-182254'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '180801',
internalId:  '',
customField: '20111217-194925'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15301',
internalId:  '',
customField: '20100916-121051'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '200801',
internalId:  '',
customField: '20110902-170258'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '180885',
internalId:  '',
customField: '20101230-115333'
};
webappMappings['7008']=webappMappings['7008-4285']={
webappId:    '7008',
documentId:  '131901',
internalId:  '4285',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '131901',
internalId:  '',
customField: '20100805-174330'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '191322',
internalId:  '',
customField: '20110217-191338'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '164901',
internalId:  '',
customField: '20101117-165624'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0IN2PBR';
var companyName   = 'JUGENDARBEIT+WEISSLINGEN';
var htmlTitle	  = 'JUGENDARBEIT+WEISSLINGEN';
var metaKeywords  = 'Jugendtreff+Weisslingen';
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();
};

