/* [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','401',jdecode('Home'),jdecode(''), jdecode('%2F401.html'), 'true',[],'',''],
	['PAGE','33422',jdecode('Franco+Gullotti'),jdecode(''), jdecode('%2F33422.html'), 'true',[],'',''],
	['PAGE','33401',jdecode('Roland+Binz'),jdecode(''), jdecode('%2F33401.html'), 'true',[],'',''],
	['PAGE','49501',jdecode('Preferred+Partners'),jdecode(''), jdecode('%2F49501.html'), 'true',[],'',''],
	['PAGE','33443',jdecode('Standort'),jdecode(''), jdecode('%2F33443.html'), 'true',[],'',''],
	['PAGE','33464',jdecode('Kontakt'),jdecode(''), jdecode('%2F33464.html'), 'true',[],'',''],
	['PAGE','44001',jdecode('English'),jdecode(''), jdecode('%2F44001.html'), 'true',[],'',''],
	['PAGE','47901',jdecode('Jobs'),jdecode(''), jdecode('%2F47901.html'), 'true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Disco';
theSitetree.paletteFamily='3D5465';
theSitetree.keyvisualId='1873';
theSitetree.keyvisualName='business.jpg';
theSitetree.fontsetId='312';
theSitetree.graphicsetId='364';
theSitetree.contentColor='DDDDDD';
theSitetree.contentBGColor='3D5465';
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: 			'Disco',
				paletteFamily: 	'3D5465',
				keyvisualId: 	'1873',
				keyvisualName: 	'business.jpg',
				fontsetId: 		'312',
				graphicsetId: 	'364',
				contentColor: 	'DDDDDD',
				contentBGColor: '3D5465',
				a_color: 		'3D5465',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '401',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20120206-064825'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '33422',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33401',
internalId:  '',
customField: '20110419-063651'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33443',
internalId:  '',
customField: '20110616-180851'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33464',
internalId:  '',
customField: '20100614-102258'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33422',
internalId:  '',
customField: '20100909-112121'
};
webappMappings['7008']=webappMappings['7008-2986']={
webappId:    '7008',
documentId:  '33464',
internalId:  '2986',
customField: 'language:de;country:CH;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '33401',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '33443',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '33464',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44001',
internalId:  '',
customField: '20110408-074805'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47901',
internalId:  '',
customField: '20111202-082503'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '49501',
internalId:  '',
customField: '20120110-070730'
};
var webAppHostname = 'cgi.webomat.ch:80';
var canonHostname = 'webomat02.hostpoint.ch';
var accountId     = 'AHOPT0INV1T4';
var companyName   = 'Gullotti+%26+Binz+%E2%94%82+Communications+%E2%94%82+Experience';
var htmlTitle	  = '';
var metaKeywords  = 'Krisenkommunikation%2C+Medien%2C+Presse%2C+Medientraining%2C+Kommunikation%2C+Image%2C+Coaching%2C+PR%2C+Litigation-PR%2C+Medienberatung%2C+Beratung%2C+Consulting%2C+Medienarbeit%2C+Pressearbeit%2C+kompetent%2C+Erfahrung%2C+Botschaften%2C+Kurse%2C+Seminare%2C+Roland+Binz%2C+Roland%2C+Binz%2C+Franco+Gullotti%2C+Gullotti';
var metaContents  = 'Krisenkommunikation+und+Rechtskommunikation+in+der+Schweiz+aus+Erfahrung.+Crisis+Communications+and+Litigation-PR+based+on+experience+and+expertise+for+Switzerland.';
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();
};

