/* [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','4556',jdecode('HOME'),jdecode(''),'/4556.html','true',[],'',''],
	['PAGE','244083',jdecode('CELOMMI+Pasquale'),jdecode(''),'/244083/index.html','true',[ 
		['PAGE','125458',jdecode('Letteratura++'),jdecode(''),'/244083/125458.html','true',[],'',''],
		['PAGE','125485',jdecode('Esposizioni'),jdecode(''),'/244083/125485.html','true',[],'',''],
		['PAGE','28055',jdecode('Galleria+delle+opere'),jdecode(''),'/244083/28055.html','true',[],'','']
	],'',''],
	['PAGE','28001',jdecode('CELOMMI+Raffaello'),jdecode(''),'/28001/index.html','true',[ 
		['PAGE','125431',jdecode('Letteratura'),jdecode(''),'/28001/125431.html','true',[],'',''],
		['PAGE','28028',jdecode('Galleria+delle+opere'),jdecode(''),'/28001/28028.html','true',[],'','']
	],'',''],
	['PAGE','242167',jdecode('CELOMMI+Luigi'),jdecode(''),'/242167/index.html','true',[ 
		['PAGE','242194',jdecode('Esposizioni'),jdecode(''),'/242167/242194.html','true',[],'',''],
		['PAGE','124840',jdecode('Galleria'),jdecode(''),'/242167/124840.html','true',[],'','']
	],'',''],
	['PAGE','28082',jdecode('CELOMMI+Riccardo'),jdecode(''),'/28082/index.html','true',[ 
		['PAGE','28136',jdecode('Esposizioni'),jdecode(''),'/28082/28136.html','true',[],'',''],
		['PAGE','124867',jdecode('Galleria+delle+opere'),jdecode(''),'/28082/124867.html','true',[],'','']
	],'',''],
	['PAGE','125931',jdecode('Contatti+%26+Ricerca'),jdecode(''),'/125931/index.html','true',[ 
		['PAGE','126462',jdecode('Contact+%28Folgeseite%29'),jdecode(''),'/125931/126462.html','false',[],'','']
	],'','']];
var siteelementCount=16;
theSitetree.topTemplateName='Startup';
theSitetree.paletteFamily='999966';
theSitetree.keyvisualId='1399';
theSitetree.keyvisualName='astern.jpg';
theSitetree.fontsetId='232';
theSitetree.graphicsetId='282';
theSitetree.contentColor='A00000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'fr',
  country: 'FR'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Startup',
				paletteFamily: 	'999966',
				keyvisualId: 	'1399',
				keyvisualName: 	'astern.jpg',
				fontsetId: 		'232',
				graphicsetId: 	'282',
				contentColor: 	'A00000',
				contentBGColor: 'FFFFFF',
				a_color: 		'999966',
				b_color: 		'333333',
				c_color: 		'000000',
				d_color: 		'FF0000',
				e_color: 		'FF0000',
				f_color: 		'FF0000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4556',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '244083',
internalId:  '',
customField: '20100205-224600'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4556',
internalId:  '',
customField: '20100131-131051'
};
webappMappings['7008']=webappMappings['7008-4345']={
webappId:    '7008',
documentId:  '125931',
internalId:  '4345',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '125458',
internalId:  '',
customField: '20091027-003114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '125485',
internalId:  '',
customField: '20091027-191546'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28055',
internalId:  '',
customField: '20100131-132606'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28001',
internalId:  '',
customField: '20091027-192726'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '125431',
internalId:  '',
customField: '20070924-234339'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28028',
internalId:  '',
customField: '20090508-230818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '242167',
internalId:  '',
customField: '20070924-224340'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '242194',
internalId:  '',
customField: '20070818-165842'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '124840',
internalId:  '',
customField: '20070924-230931'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28082',
internalId:  '',
customField: '20071203-012540'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28136',
internalId:  '',
customField: '20070818-145938'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '124867',
internalId:  '',
customField: '20090928-225535'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '125931',
internalId:  '',
customField: '20091025-163712'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '126462',
internalId:  '',
customField: '20040830-170750'
};
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW0X0INXVIG';
var companyName   = 'LA++TETRADE+++ROSETANA';
var htmlTitle	  = '';
var metaKeywords  = 'L%60ARTE+DEI+CELOMMI-+La+Lavandaia++Ex+collezione+Paolo+Francesco+d%60Aloisio%0D%0A%0D%0A%0D%0A%0D%0A+';
var metaContents  = 'La+Lavandaia+di+Pasquale+Celommi%2C+Museo+Nazionale+d%60Abruzzo++%0D%0AEx+Collezione+Paolo+Francesco+d%60Aloisio+';
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();
};

