/* [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','4597',jdecode('stadtmusig.ch'),jdecode(''),'/4597.html','true',[],'',''],
	['PAGE','18712',jdecode('Kurzes+Portrait'),jdecode(''),'/18712.html','false',[],'',''],
	['PAGE','65416',jdecode('Portrait'),jdecode(''),'/65416.html','true',[],'',''],
	['PAGE','18604',jdecode('Rund+um+die+SMB'),jdecode(''),'/18604/index.html','true',[ 
		['PAGE','110830',jdecode('Unser+Dirigent'),jdecode(''),'/18604/110830.html','true',[],'',''],
		['PAGE','18174',jdecode('Wie+finde+ich+die+SMB%3F'),jdecode(''),'/18604/18174.html','true',[],'',''],
		['PAGE','80427',jdecode('Internes'),jdecode(''),'/18604/80427.html','true',[],'','']
	],'',''],
	['PAGE','49946',jdecode('G%C3%A4stebuch'),jdecode(''),'/49946/index.html','true',[ 
		['PAGE','49947',jdecode('Eintr%C3%A4ge'),jdecode(''),'/49946/49947.html','false',[],'','']
	],'',''],
	['PAGE','71123',jdecode('Vermietung+Pavillon'),jdecode(''),'/71123.html','true',[],'',''],
	['PAGE','105637',jdecode('Sponsoren'),jdecode(''),'/105637.html','true',[],'',''],
	['PAGE','106509',jdecode('Links%2C+und+so...'),jdecode(''),'/106509.html','true',[],'',''],
	['PAGE','110857',jdecode('Epilog'),jdecode(''),'/110857.html','true',[],'','']];
var siteelementCount=13;
theSitetree.topTemplateName='Vignette';
theSitetree.paletteFamily='E79E6E';
theSitetree.keyvisualId='3551';
theSitetree.keyvisualName='kv_3551.jpg';
theSitetree.fontsetId='10783';
theSitetree.graphicsetId='10833';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Vignette',
				paletteFamily: 	'E79E6E',
				keyvisualId: 	'3551',
				keyvisualName: 	'kv_3551.jpg',
				fontsetId: 		'10783',
				graphicsetId: 	'10833',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'E79E6E',
				e_color: 		'886146',
				f_color: 		'C97556',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1501']=webappMappings['1501-2671931']={
webappId:    '1501',
documentId:  '4597',
internalId:  '2671931',
customField: '1501'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '18174',
internalId:  'routing',
customField: 'de_CH'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18712',
internalId:  '',
customField: '20090106-212556'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '65416',
internalId:  '',
customField: '20090322-181130'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4597',
internalId:  '1006',
customField: '1006'
};
webappMappings['1002']=webappMappings['1002-49946ABW0X0INXZFB']={
webappId:    '1002',
documentId:  '49946',
internalId:  '49946ABW0X0INXZFB',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4597',
internalId:  '',
customField: '20071111-141824'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18604',
internalId:  '',
customField: '20100607-175024'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '110830',
internalId:  '',
customField: '20100104-182803'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18174',
internalId:  '',
customField: '20051002-133215'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '80427',
internalId:  '',
customField: '20100202-232855'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '49946',
internalId:  '',
customField: '20051221-215542'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '49947',
internalId:  '',
customField: '20050523-221924'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '71123',
internalId:  '',
customField: '20100607-175115'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '105637',
internalId:  '',
customField: '20100706-220153'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '106509',
internalId:  '',
customField: '20060118-001146'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '110857',
internalId:  '',
customField: '20071111-165542'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INXZFB';
var companyName   = 'stadtmusig.ch';
var htmlTitle	  = 'stadtmusig';
var metaKeywords  = 'Stadtmusik+B%C3%BCren';
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();
};
