/* [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','4606',jdecode('Home'),jdecode(''), jdecode('%2F4606.html'), 'true',[],'',''],
	['PAGE','13460',jdecode('Museum'),jdecode(''), jdecode('%2F13460%2Findex.html'), 'true',[ 
		['PAGE','13901',jdecode('Suche+nach+Relikten'),jdecode(''), jdecode('%2F13460%2F13901.html'), 'true',[],'',''],
		['PAGE','29101',jdecode('Museumskonzept'),jdecode(''), jdecode('%2F13460%2F29101.html'), 'true',[],'',''],
		['PAGE','32601',jdecode('So+finden+sie+uns'),jdecode(''), jdecode('%2F13460%2F32601.html'), 'true',[],'',''],
		['PAGE','26558',jdecode('%C3%96ffnungszeiten'),jdecode(''), jdecode('%2F13460%2F26558.html'), 'true',[],'',''],
		['PAGE','26568',jdecode('Eintrittspreise'),jdecode(''), jdecode('%2F13460%2F26568.html'), 'true',[],'',''],
		['PAGE','28201',jdecode('Gruppenbesuche'),jdecode(''), jdecode('%2F13460%2F28201.html'), 'true',[],'',''],
		['PAGE','13514',jdecode('G%C3%B6nner'),jdecode(''), jdecode('%2F13460%2F13514.html'), 'true',[],'',''],
		['PAGE','26598',jdecode('%C3%9Cber+uns'),jdecode(''), jdecode('%2F13460%2F26598.html'), 'true',[],'','']
	],'',''],
	['PAGE','13487',jdecode('Suworow+Haus'),jdecode(''), jdecode('%2F13487.html'), 'true',[],'',''],
	['PAGE','13568',jdecode('Buch+-+Brocki'),jdecode(''), jdecode('%2F13568.html'), 'true',[],'',''],
	['PAGE','15201',jdecode('Geschichte+'),jdecode(''), jdecode('%2F15201.html'), 'true',[],'',''],
	['ITEM','52901',jdecode('Blog+Walter+G%C3%A4hler'),jdecode(''), jdecode('http%3A%2F%2Fsuworowmuseum.blogspot.com%2F'), 'true',[],'','_blank'],
	['PAGE','52201',jdecode('Links'),jdecode(''), jdecode('%2F52201.html'), 'true',[ 
		['ITEM','52101',jdecode('PRO+SUWOROW'),jdecode(''), jdecode('http%3A%2F%2Fglarnerland.magix.net%2Fblog%2Fpro-suworow%2Fcategories%2F18-Suworow-Museum-zieht-um-nach-Linthal'), 'true',[],'','_blank'],
		['ITEM','52301',jdecode('Suworow+Cheller'),jdecode(''), jdecode('http%3A%2F%2Fwww.suworow.ch'), 'true',[],'','_blank']
	],'','']];
var siteelementCount=17;
theSitetree.topTemplateName='Borders';
theSitetree.paletteFamily='C9DFEE';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10432';
theSitetree.graphicsetId='10771';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='F0F2F4';
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: 			'Borders',
				paletteFamily: 	'C9DFEE',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10432',
				graphicsetId: 	'10771',
				contentColor: 	'000000',
				contentBGColor: 'F0F2F4',
				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:  '4606',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4606',
internalId:  '',
customField: '20110727-204136'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13514',
internalId:  '',
customField: '20120107-210732'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13460',
internalId:  '',
customField: '20120130-095721'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13901',
internalId:  '',
customField: '20110819-225520'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13487',
internalId:  '',
customField: '20110726-215054'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13568',
internalId:  '',
customField: '20110726-215709'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15201',
internalId:  '',
customField: '20040412-154925'
};
webappMappings['1501']=webappMappings['1501-33182840']={
webappId:    '1501',
documentId:  '4606',
internalId:  '33182840',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26558',
internalId:  '',
customField: '20110804-200046'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26568',
internalId:  '',
customField: '20110729-201503'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28201',
internalId:  '',
customField: '20110730-214054'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26598',
internalId:  '',
customField: '20110729-201924'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52201',
internalId:  '',
customField: '20110802-222854'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29101',
internalId:  '',
customField: '20120130-100326'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32601',
internalId:  '',
customField: '20110731-223438'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INX3IP';
var companyName   = '1799+**+Suworow+-+Museum+im+Glarnerland+**+1799';
var htmlTitle	  = '**1799+-+Suworow+-++im+Glarnerland+**+1799';
var metaKeywords  = '';
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();
};

