/* [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','1513',jdecode('Home'),jdecode(''),'/1513.html','true',[],'',''],
	['PAGE','1570',jdecode('Mumpfel-Produkte'),jdecode(''),'/1570/index.html','true',[ 
		['PAGE','16221',jdecode('Sortiment'),jdecode(''),'/1570/16221.html','false',[],'','']
	],'',''],
	['PAGE','1597',jdecode('Aktuelles'),jdecode(''),'/1597.html','true',[],'',''],
	['PAGE','1624',jdecode('%C3%9Cber+uns'),jdecode(''),'/1624.html','true',[],'',''],
	['PAGE','1651',jdecode('Bestellungen%2FKontakt'),jdecode(''),'/1651/index.html','true',[ 
		['PAGE','4291',jdecode('Bestellungen+%28Folgeseite%29'),jdecode(''),'/1651/4291.html','false',[],'','']
	],'',''],
	['PAGE','1678',jdecode('So+finden+Sie+uns'),jdecode(''),'/1678.html','true',[],'',''],
	['PAGE','5807',jdecode('G%C3%A4stebuch'),jdecode(''),'/5807/index.html','true',[ 
		['PAGE','5808',jdecode('Eintr%C3%A4ge'),jdecode(''),'/5807/5808.html','false',[],'','']
	],'',''],
	['PAGE','16621',jdecode('Fotos'),jdecode(''),'/16621.html','false',[],'','']];
var siteelementCount=11;
theSitetree.topTemplateName='Alpha';
theSitetree.paletteFamily='555454';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10461';
theSitetree.graphicsetId='10892';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Alpha',
				paletteFamily: 	'555454',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10461',
				graphicsetId: 	'10892',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'555454',
				e_color: 		'555454',
				f_color: 		'555454',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1002']=webappMappings['1002-5807ahp010in2fsm']={
webappId:    '1002',
documentId:  '5807',
internalId:  '5807ahp010in2fsm',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1597',
internalId:  '',
customField: '20090217-124211'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1570',
internalId:  '',
customField: '20100414-111051'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1513',
internalId:  '',
customField: '20100414-110517'
};
webappMappings['7008']=webappMappings['7008-2935']={
webappId:    '7008',
documentId:  '1651',
internalId:  '2935',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1624',
internalId:  '',
customField: '20090217-125216'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1651',
internalId:  '',
customField: '20090217-125254'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4291',
internalId:  '',
customField: '20060507-174951'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1678',
internalId:  '',
customField: '20090217-124333'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5807',
internalId:  '',
customField: '20050530-163837'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5808',
internalId:  '',
customField: '20050530-163837'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16221',
internalId:  '',
customField: '20100414-113426'
};
webappMappings['7060']=webappMappings['7060-c3a259e158100c6ea7cd7d08edc1dec2']={
webappId:    '7060',
documentId:  '16621',
internalId:  'c3a259e158100c6ea7cd7d08edc1dec2',
customField: 'language:de;country:CH;'
};
var canonHostname = 'webomat01.hostpoint.ch';
var accountId     = 'Ahp010IN2FSM';
var companyName   = 'Qualit%C3%A4tsprodukte+direkt+vom+Bauernhof+';
var htmlTitle	  = '';
var metaKeywords  = 'Schafuuser+Mumpfel%2C+Mumpfel%2C+Schaffhausen%2C+Kanton%2C+Bauernhof%2C+Hof%2C+Essen%2C+Trasadingen%2C+Wilchingen%2C+Qualit%EF%BF%BDt%2C+Bauernhof%2C+Tr%EF%BF%BDckli%2C+Trucke%2C+Zaanli%2C+Zaane%2C+gelte%2C+S%EF%BF%BDckli%2C+Sack%2C+Sch%EF%BF%BDchteli';
var metaContents  = 'Der+Schafuuser+Mumpfel+-+das+sind+Nahrungsmittel+aus+unserer+Region%2C+%EF%BF%BDgluschtig%EF%BF%BD+und+originell+ver%EF%BF%BDpackt.+Es+sind+auserlesene+Spezialit%EF%BF%BDten%2C+in+attraktiven+Verpackungen+sch%EF%BF%BDn+und+ansprechend+ar%EF%BF%BDrangiert+-+ein+passendes+Geschenk+f%EF%BF%BDr+jede+Ge%EF%BF%BDlegenheit%2C+frisch+vom+Bauernhof%21';
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();
};
