/* [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','38812',jdecode('Was+heisst+b%26%23x27%3Btreff%3F%3F%3F'),jdecode(''), jdecode('%2F38812.html'), 'true',[],'',''],
	['PAGE','12001',jdecode('AKTUELL%21'),jdecode(''), jdecode('%2F12001.html'), 'true',[],'',''],
	['PAGE','43412',jdecode('%C3%96ffnungszeiten'),jdecode(''), jdecode('%2F43412.html'), 'true',[],'',''],
	['PAGE','1346',jdecode('Home'),jdecode(''), jdecode('%2F1346.html'), 'true',[],'',''],
	['PAGE','1367',jdecode('%C3%9Cber+uns'),jdecode(''), jdecode('%2F1367%2Findex.html'), 'true',[ 
		['PAGE','43612',jdecode('Leitung+b%26%23x27%3Btreff'),jdecode(''), jdecode('%2F1367%2F43612.html'), 'true',[],'',''],
		['PAGE','5901',jdecode('Das+b%26%23x27%3Btreff+Team'),jdecode(''), jdecode('%2F1367%2F5901.html'), 'true',[],'',''],
		['PAGE','14901',jdecode('Spendenkonto'),jdecode(''), jdecode('%2F1367%2F14901.html'), 'true',[],'','']
	],'',''],
	['PAGE','2701',jdecode('Unsere+Angebote'),jdecode(''), jdecode('%2F2701.html'), 'true',[],'',''],
	['PAGE','63912',jdecode('jobb%C3%B6rse'),jdecode(''), jdecode('%2F63912.html'), 'true',[],'',''],
	['PAGE','61512',jdecode('Der+neue+b%26%23x27%3Btreff'),jdecode(''), jdecode('%2F61512.html'), 'true',[],'',''],
	['PAGE','50612',jdecode('Flawiler+Preis+2011'),jdecode(''), jdecode('%2F50612.html'), 'true',[],'',''],
	['PAGE','36312',jdecode('b%26%23x27%3Btreff+Fest+2011'),jdecode(''), jdecode('%2F36312.html'), 'true',[],'',''],
	['PAGE','45333',jdecode('Adieu+Els'),jdecode(''), jdecode('%2F45333.html'), 'false',[],'',''],
	['PAGE','45354',jdecode('Ferienbuchmarkt'),jdecode(''), jdecode('%2F45354.html'), 'true',[],'',''],
	['PAGE','56712',jdecode('frauentreff'),jdecode(''), jdecode('%2F56712.html'), 'true',[],'',''],
	['PAGE','56733',jdecode('Bring-+und+Holtisch'),jdecode(''), jdecode('%2F56733.html'), 'true',[],'',''],
	['PAGE','12501',jdecode('Lebensmittel'),jdecode(''), jdecode('%2F12501.html'), 'true',[],'',''],
	['PAGE','29701',jdecode('Volle+Taschen......'),jdecode(''), jdecode('%2F29701.html'), 'true',[],'',''],
	['PAGE','10501',jdecode('Stutz+ufw%C3%A4rts'),jdecode(''), jdecode('%2F10501.html'), 'true',[],'',''],
	['PAGE','5143',jdecode('Kontakt+%2B+Lage'),jdecode(''), jdecode('%2F5143.html'), 'true',[],'',''],
	['PAGE','58912',jdecode('Ihre+Meinung'),jdecode(''), jdecode('%2F58912.html'), 'true',[],'','']];
var siteelementCount=22;
theSitetree.topTemplateName='Plainly';
theSitetree.paletteFamily='ABC600';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='32114';
theSitetree.graphicsetId='13925';
theSitetree.contentColor='6e6e6d';
theSitetree.contentBGColor='fbfae8';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'webland',
  product: 'WSCSYSSSSLY0XFFS'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Plainly',
				paletteFamily: 	'ABC600',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'32114',
				graphicsetId: 	'13925',
				contentColor: 	'6e6e6d',
				contentBGColor: 'fbfae8',
				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['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '5143',
internalId:  'location',
customField: 'language:de;country:CH;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5901',
internalId:  '',
customField: '20111010-191351'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56733',
internalId:  '',
customField: '20111106-104152'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45333',
internalId:  '',
customField: '20111010-194528'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1346',
internalId:  '',
customField: '20111010-190938'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1367',
internalId:  '',
customField: '20111106-100244'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2701',
internalId:  '',
customField: '20111106-100756'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45354',
internalId:  '',
customField: '20111010-190857'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56712',
internalId:  '',
customField: '20111010-191311'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10501',
internalId:  '',
customField: '20111010-184412'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '12001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5143',
internalId:  '',
customField: '20111017-184151'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50612',
internalId:  '',
customField: '20111102-191757'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12001',
internalId:  '',
customField: '20111102-210415'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12501',
internalId:  '',
customField: '20111016-204233'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38812',
internalId:  '',
customField: '20111010-184608'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43412',
internalId:  '',
customField: '20110923-183840'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43612',
internalId:  '',
customField: '20110923-183227'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14901',
internalId:  '',
customField: '20111017-183230'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29701',
internalId:  '',
customField: '20111017-183531'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36312',
internalId:  '',
customField: '20111017-183413'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '61512',
internalId:  '',
customField: '20111102-203438'
};
webappMappings['7008']=webappMappings['7008-12343']={
webappId:    '7008',
documentId:  '58912',
internalId:  '12343',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '58912',
internalId:  '',
customField: '20111010-202446'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '63912',
internalId:  '',
customField: '20120119-205627'
};
var webAppHostname = 'wsc-app.webland.ch:80';
var canonHostname = 'wsc02.webland.ch';
var accountId     = 'AWB010IN25EZ';
var companyName   = 'b%27treff+Flawil+ist+online';
var htmlTitle	  = 'b%27treff+Flawil+ist+online%21';
var metaKeywords  = 'Armut%2C+Arbeitslos%2C+stellensuchend%2C';
var metaContents  = 'Treffpunkt+f%C3%BCr+armutsbetroffene+Mitmenschen';
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();
};

