/* [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','4459',jdecode('portrait'),jdecode(''),'/4459.html','true',[],'',''],
	['PAGE','4516',jdecode('work'),jdecode(''),'/4516.html','true',[],'',''],
	['PAGE','4570',jdecode('event'),jdecode(''),'/4570.html','true',[],'',''],
	['PAGE','4597',jdecode('archive'),jdecode(''),'/4597.html','true',[],'',''],
	['PAGE','4678',jdecode('link'),jdecode(''),'/4678.html','true',[],'',''],
	['PAGE','6178',jdecode('guestbook'),jdecode(''),'/6178.html','true',[],'',''],
	['PAGE','4543',jdecode('contact'),jdecode(''),'/4543.html','true',[],'','']];
var siteelementCount=7;
theSitetree.topTemplateName='Alpha';
theSitetree.paletteFamily='555454';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10461';
theSitetree.graphicsetId='10892';
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: 			'Alpha',
				paletteFamily: 	'555454',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10461',
				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:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4570',
internalId:  '',
customField: '20090728-233144'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4597',
internalId:  '',
customField: '20090728-233204'
};
webappMappings['1002']=webappMappings['1002-6178ahp010inxf44']={
webappId:    '1002',
documentId:  '6178',
internalId:  '6178ahp010inxf44',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4459',
internalId:  '',
customField: '20090728-232949'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4516',
internalId:  '',
customField: '20090728-233043'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4678',
internalId:  '',
customField: '20090729-134107'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6178',
internalId:  '',
customField: '20090728-233403'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4543',
internalId:  '',
customField: '20090728-233423'
};
var canonHostname = 'webomat01.hostpoint.ch';
var accountId     = 'Ahp010INXF44';
var companyName   = 'installation%2C+photographie+%26+malerei';
var htmlTitle	  = 'graustufen.ch+%5Batelier+senn%5D';
var metaKeywords  = 'Photographie%2C+Photograph%2C+photographer%2C+Fotografie%2C+Fotograf%2C+Malerei%2C+paintings%2C+Rauminstallation%2C+roominstallations%2C+Momentaufnahmen%2C+Foto%2C+Fotos%2C+Photo%2C+Photos%2C+Photographie%2C+Photographien%2C+Fotografien%2C+Bilder%2C+photography%2C+pic%2C+pics%2C+picture%2C+pictures%2C+pixel%2C+image%2C+images%2C+imagedatabase%2C+Bilddatenbank%2C+Datenbank%2C+Archiv%2C+Archive%2C+Fotoarchiv%2C+Photoarchiv%2C+archives%2C+photoarchives%2C+Galerie%2C+Galerien%2C+Fotogalerie%2C+Fotogalerien%2C+gallery%2C+photogallery%2C+fotogallery%2C+Bildarchiv%2C+Bildarchive%2C+Bildgalerie%2C+Bildgalerien%2C+Fotoarchiv%2C+Photoarchiv%2C+Fotoarchive%2C+Photoarchive%2C+schwarzweiss%2C+black%2Bwhite%2C+black+and+white%2C+graustufen%2C+graustufe%2C+Graustufen%2C+Graustufe%2C+grayscale%2C+Abzuege%2C+Abzuege%2C++Auftragsfotografie%2C+Auftragsphotographie%2C+Fotoauftraege%2C+Photoauftraege%2C+Fotoauftrag%2C+Photoauftrag%2C+fotografieren%2C+photographieren%2C+fotographieren%2C+fotoshootings%2C+shootigs%2C+Modeaufnahmen%2C+Mode%2C+Models%2C+Portraits%2C+Portrait%2C+Stil%2C+stil%2C+Still%2C+Still%2C+Stilleben%2C+Natur%2C+Umwelt%2C+Tiere%2C+Landschaft%2C+Landschaften%2C+Architektur%2C+Gebaeude%2C+Dokumentationen%2C+Personen%2C+Postkarten%2C+postcards%2C+e-card%2C+e-cards%2C+serielle+Arbeiten%2C+Serien%2C+series%2C+Unikat%2C+Unikate%2C+Kunst%2C+Kultur%2C+events%2C+event%2C+Ausstellung%2C+Ausstellungen%2C+nicola%2C+claude%2C+reto%2C+senn%2C+graustufen.ch%2C+graustufe.ch';
var metaContents  = 'nicola+senn%3A+autodidakt.+seit+2001+freies+schaffen+zwischen+malerei%2C+photographie+und+rauminstallation.';
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();
};
