/* [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','74301',jdecode('Home'),jdecode(''), jdecode('%2F74301.html'), 'true',[],'',''],
	['PAGE','64201',jdecode('Vorschau'),jdecode(''), jdecode('%2F64201.html'), 'false',[],'',''],
	['PAGE','65701',jdecode('Programm'),jdecode(''), jdecode('%2F65701.html'), 'false',[],'',''],
	['PAGE','5122',jdecode('Daten'),jdecode(''), jdecode('%2F5122.html'), 'false',[],'',''],
	['PAGE','5164',jdecode('Team'),jdecode(''), jdecode('%2F5164.html'), 'true',[],'',''],
	['PAGE','5143',jdecode('Tickets'),jdecode(''), jdecode('%2F5143.html'), 'false',[],'',''],
	['PAGE','42101',jdecode('Anfahrt'),jdecode(''), jdecode('%2F42101.html'), 'true',[],'',''],
	['PAGE','40701',jdecode('Essen+%26+Trinken'),jdecode(''), jdecode('%2F40701.html'), 'false',[],'',''],
	['PAGE','5185',jdecode('Geschichte'),jdecode(''), jdecode('%2F5185.html'), 'true',[],'',''],
	['PAGE','67501',jdecode('Sch%C3%BCtzenstube'),jdecode(''), jdecode('%2F67501.html'), 'true',[],'',''],
	['PAGE','41501',jdecode('Kontakt'),jdecode(''), jdecode('%2F41501.html'), 'true',[],'',''],
	['PAGE','20832',jdecode('Sponsoren'),jdecode(''), jdecode('%2F20832.html'), 'true',[],'',''],
	['PAGE','64901',jdecode('Medien'),jdecode(''), jdecode('%2F64901.html'), 'false',[],'',''],
	['PAGE','40101',jdecode('Medien'),jdecode(''), jdecode('%2F40101.html'), 'true',[],'',''],
	['PAGE','45901',jdecode('Archiv'),jdecode(''), jdecode('%2F45901%2Findex.html'), 'true',[ 
		['PAGE','85301',jdecode('Saison+2011%2F12'),jdecode(''), jdecode('%2F45901%2F85301.html'), 'true',[],'',''],
		['PAGE','85322',jdecode('Impressionen+2011%2F12'),jdecode(''), jdecode('%2F45901%2F85322.html'), 'true',[],'',''],
		['PAGE','88901',jdecode('Abschied+Urs+Rudin'),jdecode(''), jdecode('%2F45901%2F88901.html'), 'false',[],'',''],
		['PAGE','74352',jdecode('Saison+2010%2F11'),jdecode(''), jdecode('%2F45901%2F74352.html'), 'true',[],'',''],
		['PAGE','74373',jdecode('Impressionen+2010%2F11'),jdecode(''), jdecode('%2F45901%2F74373.html'), 'true',[],'',''],
		['PAGE','34401',jdecode('Saison+2009%2F10'),jdecode(''), jdecode('%2F45901%2F34401.html'), 'true',[],'',''],
		['PAGE','62401',jdecode('Impressionen+2009%2F10'),jdecode(''), jdecode('%2F45901%2F62401.html'), 'true',[],'',''],
		['PAGE','51301',jdecode('Saison+2008%2F09'),jdecode(''), jdecode('%2F45901%2F51301.html'), 'true',[],'',''],
		['PAGE','53501',jdecode('Impressionen+2008%2F09'),jdecode(''), jdecode('%2F45901%2F53501.html'), 'true',[],'',''],
		['PAGE','5101',jdecode('Saison+2007%2F08'),jdecode(''), jdecode('%2F45901%2F5101.html'), 'true',[],'','']
	],'','']];
var siteelementCount=25;
theSitetree.topTemplateName='Retro';
theSitetree.paletteFamily='990000';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='202';
theSitetree.graphicsetId='246';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'hostpoint',
  product: 'WSCSYSSSSLYTC21F'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Retro',
				paletteFamily: 	'990000',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'202',
				graphicsetId: 	'246',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'990000',
				b_color: 		'FF9900',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'EAEAEA',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34401',
internalId:  '',
customField: '20100513-170330'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '74301',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-1074']={
webappId:    '7008',
documentId:  '41501',
internalId:  '1074',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53501',
internalId:  '',
customField: '20091022-222438'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5122',
internalId:  '',
customField: '20120130-150246'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5164',
internalId:  '',
customField: '20120130-150646'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5143',
internalId:  '',
customField: '20120130-150502'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42101',
internalId:  '',
customField: '20111009-201300'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40701',
internalId:  '',
customField: '20111009-201553'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5185',
internalId:  '',
customField: '20120130-150827'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41501',
internalId:  '',
customField: '20111031-003803'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20832',
internalId:  '',
customField: '20110919-104709'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40101',
internalId:  '',
customField: '20120130-152838'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45901',
internalId:  '',
customField: '20120130-153011'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51301',
internalId:  '',
customField: '20091018-235823'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5101',
internalId:  '',
customField: '20090408-184022'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '62401',
internalId:  '',
customField: '20100124-202551'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '64901',
internalId:  '',
customField: '20120130-152902'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '64201',
internalId:  '',
customField: '20120130-152701'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '65701',
internalId:  '',
customField: '20120130-152149'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '67501',
internalId:  '',
customField: '20120130-150852'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '74301',
internalId:  '',
customField: '20120207-123952'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '74373',
internalId:  '',
customField: '20110531-155104'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '74352',
internalId:  '',
customField: '20120130-153111'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '85301',
internalId:  '',
customField: '20120130-152055'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '88901',
internalId:  '',
customField: '20120207-123731'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '85322',
internalId:  '',
customField: '20120207-123114'
};
var webAppHostname = 'cgi.webomat.ch:80';
var canonHostname = 'webomat02.hostpoint.ch';
var accountId     = 'AHOPT0IN342C';
var companyName   = 'Willkommen+im+Vorstadt+Vari%C3%A9t%C3%A9';
var htmlTitle	  = 'Vorstadt+Vari%C3%A9t%C3%A9+Schaffhausen';
var metaKeywords  = 'Vorstadt+Vari%C3%A9t%C3%A9+Variete+Restaurant+Sch%C3%BCtzenstube+Schaffhausen+Kleinkunst+B%C3%BChne';
var metaContents  = 'Das+Vorstadt+Vari%C3%A9t%C3%A9+pr%C3%A4sentiert+von+November+bis+Januar+im+Restaurant+Sch%C3%BCtzenstube+in+Schaffhausen+ein+zweist%C3%BCndiges+Kleinkunst-Programm.';
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();
};

