/* [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','1401',jdecode('GUTEN+TAG'),jdecode(''), jdecode('%2F1401.html'), 'true',[],'',''],
	['PAGE','1452',jdecode('HEIMATLAND'),jdecode(''), jdecode('%2F1452%2Findex.html'), 'true',[ 
		['PAGE','113001',jdecode('HU.+Schwaar'),jdecode(''), jdecode('%2F1452%2F113001.html'), 'true',[],'',''],
		['PAGE','98701',jdecode('HP.+Buholzer'),jdecode(''), jdecode('%2F1452%2F98701.html'), 'true',[],'',''],
		['PAGE','25901',jdecode('Verena+Z%C3%BCrcher'),jdecode(''), jdecode('%2F1452%2F25901.html'), 'true',[],'',''],
		['PAGE','124101',jdecode('Simon+Gfeller'),jdecode(''), jdecode('%2F1452%2F124101.html'), 'true',[],'','']
	],'',''],
	['PAGE','34201',jdecode('LITERATURLAND'),jdecode(''), jdecode('%2F34201%2Findex.html'), 'true',[ 
		['PAGE','98722',jdecode('Marina+Bolzli'),jdecode(''), jdecode('%2F34201%2F98722.html'), 'true',[],'',''],
		['PAGE','104601',jdecode('Christine+Brand'),jdecode(''), jdecode('%2F34201%2F104601.html'), 'true',[],'',''],
		['PAGE','98743',jdecode('Mordsgeschichten'),jdecode(''), jdecode('%2F34201%2F98743.html'), 'true',[],'',''],
		['PAGE','98764',jdecode('Hans+Herrmann'),jdecode(''), jdecode('%2F34201%2F98764.html'), 'true',[],'',''],
		['PAGE','115101',jdecode('Gruber%2FDurand'),jdecode(''), jdecode('%2F34201%2F115101.html'), 'true',[],'',''],
		['PAGE','126701',jdecode('Philippe+Ledermann'),jdecode(''), jdecode('%2F34201%2F126701.html'), 'true',[],'','']
	],'',''],
	['PAGE','89101',jdecode('KINDERLAND'),jdecode(''), jdecode('%2F89101%2Findex.html'), 'true',[ 
		['PAGE','89122',jdecode('Stefanie+Reber'),jdecode(''), jdecode('%2F89101%2F89122.html'), 'true',[],'',''],
		['PAGE','114501',jdecode('Leuenberger%2FReber'),jdecode(''), jdecode('%2F89101%2F114501.html'), 'true',[],'',''],
		['PAGE','126743',jdecode('Mukka+Emma'),jdecode(''), jdecode('%2F89101%2F126743.html'), 'true',[],'','']
	],'',''],
	['PAGE','31901',jdecode('TERMINE'),jdecode(''), jdecode('%2F31901.html'), 'true',[],'',''],
	['PAGE','1473',jdecode('PRESSE'),jdecode(''), jdecode('%2F1473.html'), 'true',[],'',''],
	['PAGE','1494',jdecode('KONTAKT'),jdecode(''), jdecode('%2F1494%2Findex.html'), 'true',[ 
		['PAGE','11501',jdecode('KONTAKT+%28Folgeseite%29'),jdecode(''), jdecode('%2F1494%2F11501.html'), 'false',[],'','']
	],'',''],
	['PAGE','101001',jdecode('LEKTORAT'),jdecode(''), jdecode('%2F101001.html'), 'true',[],'',''],
	['PAGE','79901',jdecode('AUSLIEFERUNG'),jdecode(''), jdecode('%2F79901.html'), 'true',[],'','']];
var siteelementCount=23;
theSitetree.topTemplateName='Deepcolor';
theSitetree.paletteFamily='5583CB';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10349';
theSitetree.graphicsetId='10469';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='154186';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MX'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Deepcolor',
				paletteFamily: 	'5583CB',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10349',
				graphicsetId: 	'10469',
				contentColor: 	'FFFFFF',
				contentBGColor: '154186',
				a_color: 		'5583CB',
				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['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '126701',
internalId:  '',
customField: '20120125-171519'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '89101',
internalId:  '',
customField: '20110107-124337'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '124101',
internalId:  '',
customField: '20100814-074344'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1401',
internalId:  '',
customField: '20120216-162554'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '89122',
internalId:  '',
customField: '20090327-130710'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31901',
internalId:  '',
customField: '20111102-134852'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1452',
internalId:  '',
customField: '20110107-124449'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25901',
internalId:  '',
customField: '20090327-124538'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '98701',
internalId:  '',
customField: '20091014-132146'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34201',
internalId:  '',
customField: '20110107-125706'
};
webappMappings['1501']=webappMappings['1501-26473541']={
webappId:    '1501',
documentId:  '1401',
internalId:  '26473541',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1473',
internalId:  '',
customField: '20111022-165700'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1494',
internalId:  '',
customField: '20111102-135114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11501',
internalId:  '',
customField: '20070309-165713'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '79901',
internalId:  '',
customField: '20090117-125244'
};
webappMappings['7008']=webappMappings['7008-3801']={
webappId:    '7008',
documentId:  '1494',
internalId:  '3801',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '98722',
internalId:  '',
customField: '20110502-182116'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '98743',
internalId:  '',
customField: '20110111-164417'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '98764',
internalId:  '',
customField: '20110502-182155'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '101001',
internalId:  '',
customField: '20110908-112802'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '104601',
internalId:  '',
customField: '20100814-074052'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '113001',
internalId:  '',
customField: '20110107-120942'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '114501',
internalId:  '',
customField: '20100127-142919'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '115101',
internalId:  '',
customField: '20100517-125034'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '126743',
internalId:  '',
customField: '20110207-164900'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW0X0IN2REY';
var companyName   = 'LANDVERLAG+-+LANGNAU+-+EMMENTAL';
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();
};

