/* [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','501',jdecode('Home'),jdecode(''),'/501.html','true',[],'',''],
	['PAGE','636',jdecode('Wer+bin+ich%3F'),jdecode(''),'/636.html','true',[],'',''],
	['PAGE','762',jdecode('Meine+Vision+f%C3%BCr+Bern'),jdecode(''),'/762/index.html','true',[ 
		['PAGE','783',jdecode('Familien+'),jdecode(''),'/762/783.html','true',[],'',''],
		['PAGE','804',jdecode('Gute+Steuerzahler+'),jdecode(''),'/762/804.html','true',[],'',''],
		['PAGE','825',jdecode('Tourismus+%26+Standort+'),jdecode(''),'/762/825.html','true',[],'',''],
		['PAGE','846',jdecode('Umwelt%2C+Verkehr+'),jdecode(''),'/762/846.html','true',[],'','']
	],'',''],
	['PAGE','573',jdecode('Neuigkeiten'),jdecode(''),'/573.html','true',[],'',''],
	['PAGE','741',jdecode('Meine+Politik'),jdecode(''),'/741.html','true',[],'',''],
	['PAGE','72101',jdecode('Freunde+werden'),jdecode(''),'/72101.html','true',[],'',''],
	['PAGE','3801',jdecode('Bilder'),jdecode(''),'/3801.html','true',[],'',''],
	['PAGE','3506',jdecode('G%C3%A4stebuch'),jdecode(''),'/3506/index.html','true',[ 
		['PAGE','3501',jdecode('Eintr%C3%A4ge+ins+G%C3%A4stebuch'),jdecode(''),'/3506/3501.html','false',[],'','']
	],'',''],
	['PAGE','867',jdecode('Kontakt'),jdecode(''),'/867/index.html','true',[ 
		['PAGE','9301',jdecode('Kontakt+%28Folgeseite%29'),jdecode(''),'/867/9301.html','false',[],'','']
	],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Grace';
theSitetree.paletteFamily='FBB044';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='32048';
theSitetree.graphicsetId='13869';
theSitetree.contentColor='484848';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Grace',
				paletteFamily: 	'FBB044',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'32048',
				graphicsetId: 	'13869',
				contentColor: 	'484848',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1002']=webappMappings['1002-3506agt010inxpo6']={
webappId:    '1002',
documentId:  '3506',
internalId:  '3506agt010inxpo6',
customField: 'icq=false'
};
webappMappings['7060']=webappMappings['7060-c956a9cc198386e8c0fdd57c624545c6']={
webappId:    '7060',
documentId:  '3801',
internalId:  'c956a9cc198386e8c0fdd57c624545c6',
customField: 'language:de;country:CH;'
};
webappMappings['7008']=webappMappings['7008-1706']={
webappId:    '7008',
documentId:  '867',
internalId:  '1706',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3501',
internalId:  '',
customField: '20091126-052716'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20100816-051643'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '636',
internalId:  '',
customField: '20100816-052037'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '762',
internalId:  '',
customField: '20091126-052630'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '783',
internalId:  '',
customField: '20070201-221945'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '804',
internalId:  '',
customField: '20070201-100007'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '825',
internalId:  '',
customField: '20070115-210954'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '846',
internalId:  '',
customField: '20070201-100209'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3506',
internalId:  '',
customField: '20070218-210309'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '573',
internalId:  '',
customField: '20100816-054940'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '741',
internalId:  '',
customField: '20091126-052429'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '72101',
internalId:  '',
customField: '20090609-134026'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3801',
internalId:  '',
customField: '20070113-093502'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '867',
internalId:  '',
customField: '20090610-054931'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9301',
internalId:  '',
customField: '20070113-063627'
};
var canonHostname = 'wsc.genotec.ch';
var accountId     = 'AGT010INXPO6';
var companyName   = 'Reto+Nause+-+Liberal-sozial+f%C3%BCr+Bern';
var htmlTitle	  = 'Reto+Nause+-+Liberal-sozial+f%C3%BCr+Bern';
var metaKeywords  = 'Nause+Reto+CVP+Stadt+Bern+Gemeinderat+Nachfolge+Kurt+Wasserfallen+Finanzen+Steuern+B%C3%BCrgerlich+SVP+FDP+Wahlen+M%C3%A4rz+2007+liberal+liberal-sozial+sozialliberal+H%C3%BCgli+FDP+fdp+FdP+SVP+GFL+Gr%C3%BCne+SP+ARP+Stadtparlament+Stadtrat+Umwelt+Umweltschutz+Gr%C3%BCne+liberal+Liberale+Stephan+Stefan+Doris+Leuthard+CVP+Familie-Arbeit-Sicherheit+Bund+Berner+Zeitung+BR+Capital+FM+Teleb%C3%A4rn+Tele+B%C3%A4rn';
var metaContents  = 'Nause+Reto+CVP+Stadt+Bern+Gemeinderat+Nachfolge+Kurt+Wasserfallen+Finanzen+Steuern+B%C3%BCrgerlich+SVP+FDP+Wahlen+M%C3%A4rz+2007+liberal+liberal-sozial+sozialliberal+H%C3%BCgli+Stephan+Imhof+Meine+Vision+Perle+Bern+Eishockey+Hockey-WM+EM+Stade+de+Suisse+Wankdorf+L%C3%A4nggasse+Breitenrain+Kirchenfeld+B%C3%BCmpliz+G%C3%A4belbach+Sulgenau+Loeb+Loeb-Egge+Der+Bund+BZ+';
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();
};
