/* [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','25101',jdecode('Home'),jdecode(''), jdecode('%2F25101.html'), 'true',[],'',''],
	['PAGE','25152',jdecode('Ihr+Anliegen'),jdecode(''), jdecode('%2F25152.html'), 'true',[],'',''],
	['PAGE','25173',jdecode('mein+Angebot'),jdecode(''), jdecode('%2F25173.html'), 'true',[],'',''],
	['PAGE','25194',jdecode('zu+meiner+Person'),jdecode(''), jdecode('%2F25194.html'), 'true',[],'',''],
	['PAGE','25215',jdecode('so+finden+Sie+mich'),jdecode(''), jdecode('%2F25215.html'), 'true',[],'',''],
	['PAGE','25236',jdecode('Kontakt'),jdecode(''), jdecode('%2F25236.html'), 'true',[],'',''],
	['PAGE','25257',jdecode('Aktuelles'),jdecode(''), jdecode('%2F25257.html'), 'true',[],'',''],
	['PAGE','25278',jdecode('Links'),jdecode(''), jdecode('%2F25278.html'), 'true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Angkor';
theSitetree.paletteFamily='A5B351';
theSitetree.keyvisualId='6861';
theSitetree.keyvisualName='kv_6861.jpg';
theSitetree.fontsetId='11211';
theSitetree.graphicsetId='12031';
theSitetree.contentColor='657025';
theSitetree.contentBGColor='C1CF70';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'hostpoint',
  product: 'WSCSYSSSSLYTC21A'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Angkor',
				paletteFamily: 	'A5B351',
				keyvisualId: 	'6861',
				keyvisualName: 	'kv_6861.jpg',
				fontsetId: 		'11211',
				graphicsetId: 	'12031',
				contentColor: 	'657025',
				contentBGColor: 'C1CF70',
				a_color: 		'C1CF70',
				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['7008']=webappMappings['7008-5117']={
webappId:    '7008',
documentId:  '25236',
internalId:  '5117',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25101',
internalId:  '',
customField: '20111007-101115'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25152',
internalId:  '',
customField: '20111030-105137'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25194',
internalId:  '',
customField: '20111007-103745'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25173',
internalId:  '',
customField: '20111125-153147'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25215',
internalId:  '',
customField: '20111125-152638'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25236',
internalId:  '',
customField: '20111007-105637'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25257',
internalId:  '',
customField: '20111007-115859'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25278',
internalId:  '',
customField: '20111007-104251'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '25101',
internalId:  '1006',
customField: '1006'
};
var webAppHostname = 'cgi.webomat.ch:80';
var canonHostname = 'webomat01.hostpoint.ch';
var accountId     = 'AHP340INVVHD';
var companyName   = 'Rita+Sofia+Voneschen';
var htmlTitle	  = 'Rita+Voneschen';
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();
};

