/* [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','17620',jdecode('Aktuell+'),jdecode(''), jdecode('%2F17620.html'), 'true',[],'',''],
	['PAGE','1678',jdecode('Theaterkurse%2FWorkshop'),jdecode(''), jdecode('%2F1678.html'), 'true',[],'',''],
	['PAGE','48133',jdecode('Neue+Projekte'),jdecode(''), jdecode('%2F48133.html'), 'true',[],'',''],
	['PAGE','49833',jdecode('Presse+%2B+Auszeichnungen'),jdecode(''), jdecode('%2F49833.html'), 'true',[],'',''],
	['PAGE','28033',jdecode('Bisherige+Projekte'),jdecode(''), jdecode('%2F28033.html'), 'true',[],'',''],
	['PAGE','1513',jdecode('Konzept+%2B+Arbeitsweise'),jdecode(''), jdecode('%2F1513.html'), 'true',[],'',''],
	['PAGE','3601',jdecode('Das+Team+'),jdecode(''), jdecode('%2F3601.html'), 'true',[],'',''],
	['PAGE','20420',jdecode('Kontakt'),jdecode(''), jdecode('%2F20420.html'), 'true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Alpha';
theSitetree.paletteFamily='555454';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10555';
theSitetree.graphicsetId='10892';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'hostpoint',
  product: 'WSCSYSSSSLYTC21A'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Alpha',
				paletteFamily: 	'555454',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10555',
				graphicsetId: 	'10892',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'555454',
				e_color: 		'555454',
				f_color: 		'555454',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '17620',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17620',
internalId:  '',
customField: '20120112-102817'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28033',
internalId:  '',
customField: '20111128-105708'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3601',
internalId:  '',
customField: '20091005-081451'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48133',
internalId:  '',
customField: '20111128-103925'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1678',
internalId:  '',
customField: '20120112-105530'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '49833',
internalId:  '',
customField: '20101013-093555'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1513',
internalId:  '',
customField: '20080714-181608'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20420',
internalId:  '',
customField: '20091010-114439'
};
var webAppHostname = 'cgi.webomat.ch:80';
var canonHostname = 'webomat01.hostpoint.ch';
var accountId     = 'Ahp010INE1PM';
var companyName   = '+11+bis+80%2B++++++';
var htmlTitle	  = 'Wechselstrom+-+intergeneratives+Theaterprojekt';
var metaKeywords  = 'Theaterkurse+11+bis+80%2B%2C+Burg+Basel%2CGenerationentheater+Wechselstrom%2CPriska+Sager%2C+Antonio+Turchiarelli%2C+Kinder%2CJugendliche%2CErwachsene%2CImprovisation%2CTheater%2CSchreibwerkstatt%2CProzessorientiert%2CGruppendynamik%2CTheaterp%C3%A4dagogik%2C+intergenerative+Theaterp%C3%A4dagogik%2CWorkshop%2CKurse%2CKommunikation%2CRhetorik%2CPr%C3%A4sentationen+Theaterprojekt%2C+Treibfeder%2C+Was+uns+antreibt+und+wohin+wir+treiben%2C+Neider%2C+Zeitlupe%2C+%C3%9Cberall+und+Irgendwo%2C+Treibfeder+-+Was+uns+antreibt+und+wohin+wir+treiben%2C+Kindertheater%2C+Theater+f%C3%BCr+Kinder%2C+Improvisation%2C+Text%2C+kinderkurse';
var metaContents  = 'Theaterkurse%2C+Basel%2CWechselstrom%2CGenerationentheater%2C+Priska+Sager%2CAntonio+Turchiarelli%2C+Simone+L%C3%BCdi%2C+Kajta+Fusek%2C+Kinder%2C+Erwachsene+%2CProzessorientiert%2C+Gruppendynamik%2C+Theaterp%C3%A4dagogik%2C+intergenerative+Theaterp%C3%A4dagogik%2C+Workshop%2C+Kurse%2C+Kommunikation%2C+Rhetorik%2C+Pr%C3%A4sentationen%2C+Theaterprojekt%2C+Treibfeder%2C+Was+uns+antreibt+und+wohin+wir+treiben%2C+Neider%2C+Zeitlupe%2C+%C3%9Cberall+und+Irgendwo%2C+Treibfeder+-+Was+uns+antreibt+und+wohin+wir+treiben%2C+Kindertheater%2C+Theater+f%C3%BCr+Kinder%2C+Improvisation%2C+Text%2C+Kinderkurse';
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();
};

