/* [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','2101',jdecode('Home'),jdecode(''), jdecode('%2F2101.html'), 'true',[],'',''],
	['PAGE','2122',jdecode('Ausstellungen'),jdecode(''), jdecode('%2F2122%2Findex.html'), 'true',[ 
		['PAGE','38401',jdecode('Erfolge'),jdecode(''), jdecode('%2F2122%2F38401.html'), 'true',[],'','']
	],'',''],
	['PAGE','31522',jdecode('Zucht'),jdecode(''), jdecode('%2F31522.html'), 'true',[],'',''],
	['PAGE','31501',jdecode('Sayro%2F+Arbeit'),jdecode(''), jdecode('%2F31501.html'), 'true',[],'',''],
	['PAGE','2173',jdecode('Bilder'),jdecode(''), jdecode('%2F2173.html'), 'true',[],'',''],
	['PAGE','13401',jdecode('Sayros+Eltern'),jdecode(''), jdecode('%2F13401.html'), 'true',[],'',''],
	['PAGE','4001',jdecode('Es+war+einmal'),jdecode(''), jdecode('%2F4001.html'), 'true',[],'',''],
	['PAGE','2194',jdecode('G%C3%A4stebuch'),jdecode(''), jdecode('%2F2194.html'), 'true',[],'',''],
	['PAGE','21401',jdecode('Kontakte'),jdecode(''), jdecode('%2F21401.html'), 'true',[],'',''],
	['PAGE','2236',jdecode('Links'),jdecode(''), jdecode('%2F2236.html'), 'true',[],'','']];
var siteelementCount=11;
theSitetree.topTemplateName='Triangle';
theSitetree.paletteFamily='004165';
theSitetree.keyvisualId='12003';
theSitetree.keyvisualName='kv_12003.jpg';
theSitetree.fontsetId='33260';
theSitetree.graphicsetId='14140';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='004165';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MS'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Triangle',
				paletteFamily: 	'004165',
				keyvisualId: 	'12003',
				keyvisualName: 	'kv_12003.jpg',
				fontsetId: 		'33260',
				graphicsetId: 	'14140',
				contentColor: 	'FFFFFF',
				contentBGColor: '004165',
				a_color: 		'004165',
				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['1002']=webappMappings['1002-2194abw330inebj4']={
webappId:    '1002',
documentId:  '2194',
internalId:  '2194abw330inebj4',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31501',
internalId:  '',
customField: '20111117-005928'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2122',
internalId:  '',
customField: '20120110-233604'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2101',
internalId:  '',
customField: '20120110-232721'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2173',
internalId:  '',
customField: '20120114-113454'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4001',
internalId:  '',
customField: '20111109-004038'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31522',
internalId:  '',
customField: '20111020-233031'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2236',
internalId:  '',
customField: '20110513-222912'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2194',
internalId:  '',
customField: '20100425-103643'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13401',
internalId:  '',
customField: '20100505-163503'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2101',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21401',
internalId:  '',
customField: '20110513-222700'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38401',
internalId:  '',
customField: '20110926-135315'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW330INEBJ4';
var companyName   = 'Spengler%27s+Golden';
var htmlTitle	  = '';
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();
};

