/* [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','1410',jdecode('Home'),jdecode(''),'/1410/index.html','true',[ 
		['PAGE','1467',jdecode('Aktuell'),jdecode(''),'/1410/1467.html','true',[],'',''],
		['PAGE','1494',jdecode('Agrarhandel'),jdecode(''),'/1410/1494.html','true',[],'',''],
		['PAGE','1521',jdecode('Heiz%C3%B6l+%2F+Diesel%C3%B6l'),jdecode(''),'/1410/1521.html','true',[],'',''],
		['PAGE','1548',jdecode('Landi-M%C3%A4rkte'),jdecode(''),'/1410/1548.html','true',[],'',''],
		['PAGE','1575',jdecode('Volg-L%C3%A4den'),jdecode(''),'/1410/1575.html','true',[],'',''],
		['PAGE','1602',jdecode('%C3%9Cber+uns'),jdecode(''),'/1410/1602.html','true',[],'',''],
		['PAGE','1629',jdecode('Kontakt'),jdecode(''),'/1410/1629.html','true',[],'','']
	],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Lunch';
theSitetree.paletteFamily='77432E';
theSitetree.keyvisualId='3845';
theSitetree.keyvisualName='kv_3845.jpg';
theSitetree.fontsetId='10697';
theSitetree.graphicsetId='11066';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='91543C';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Lunch',
				paletteFamily: 	'77432E',
				keyvisualId: 	'3845',
				keyvisualName: 	'kv_3845.jpg',
				fontsetId: 		'10697',
				graphicsetId: 	'11066',
				contentColor: 	'FFFFFF',
				contentBGColor: '91543C',
				a_color: 		'77432E',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'D2A390',
				e_color: 		'D2A390',
				f_color: 		'D2A390',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1467',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1410',
internalId:  '',
customField: '20090306-161203'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1467',
internalId:  '',
customField: '20091015-142752'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1575',
internalId:  '',
customField: '20101105-144453'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1602',
internalId:  '',
customField: '20100210-165936'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1494',
internalId:  '',
customField: '20071108-140742'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1521',
internalId:  '',
customField: '20081118-153055'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1548',
internalId:  '',
customField: '20081118-150155'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1629',
internalId:  '',
customField: '20101105-144631'
};
var canonHostname = 'webomat01.hostpoint.ch';
var accountId     = 'Ahp010INE1NC';
var companyName   = 'Landi+Untersee+und+Rhy';
var htmlTitle	  = 'Landi+Untersee+und+Rhy';
var metaKeywords  = 'nat%C3%BCrlichunterseethurgaueschenzheiz%C3%B6llandicoolbestens';
var metaContents  = 'Landi+Untersee+und+Rhy+-+Alles+f%C3%BCr+den+Landwirt%2C+G%C3%A4rtner%2C+Hobbyg%C3%A4rtner%2C+Kleintierhalter%2C+Heimwerker%2C+Weinliebhaber%2C+Heim%2BHobbybedarf%2C+Handel+von+Heiz%C3%B6l+und+Diesel%C3%B6l';
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();
};

