/* [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','4521',jdecode('Home'),jdecode(''), jdecode('%2F4521.html'), 'true',[],'',''],
	['PAGE','4822',jdecode('Das+Team'),jdecode(''), jdecode('%2F4822.html'), 'true',[],'',''],
	['PAGE','4795',jdecode('Naturheilmittel'),jdecode(''), jdecode('%2F4795.html'), 'true',[],'',''],
	['PAGE','4849',jdecode('Sortiment'),jdecode(''), jdecode('%2F4849.html'), 'true',[],'',''],
	['PAGE','11747',jdecode('Gesundheitsberatung'),jdecode(''), jdecode('%2F11747.html'), 'true',[],'',''],
	['PAGE','4876',jdecode('Aktuell'),jdecode(''), jdecode('%2F4876.html'), 'true',[],'',''],
	['PAGE','4957',jdecode('So+finden+Sie+uns'),jdecode(''), jdecode('%2F4957.html'), 'true',[],'',''],
	['PAGE','4930',jdecode('Kontakt'),jdecode(''), jdecode('%2F4930%2Findex.html'), 'true',[ 
		['PAGE','5150',jdecode('Kontakt+%28Folgeseite%29'),jdecode(''), jdecode('%2F4930%2F5150.html'), 'true',[],'','']
	],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Mappe';
theSitetree.paletteFamily='6BB3AC';
theSitetree.keyvisualId='1929';
theSitetree.keyvisualName='apotheke.jpg';
theSitetree.fontsetId='324';
theSitetree.graphicsetId='375';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='6BB3AC';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2QE'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Mappe',
				paletteFamily: 	'6BB3AC',
				keyvisualId: 	'1929',
				keyvisualName: 	'apotheke.jpg',
				fontsetId: 		'324',
				graphicsetId: 	'375',
				contentColor: 	'000000',
				contentBGColor: '6BB3AC',
				a_color: 		'6BB3AC',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4521',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4822',
internalId:  '',
customField: '20101120-144720'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4521',
internalId:  '',
customField: '20110312-095804'
};
webappMappings['7008']=webappMappings['7008-5651']={
webappId:    '7008',
documentId:  '4930',
internalId:  '5651',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4795',
internalId:  '',
customField: '20081212-163154'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4849',
internalId:  '',
customField: '20100415-085823'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11747',
internalId:  '',
customField: '20100724-122604'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4876',
internalId:  '',
customField: '20101016-155606'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4957',
internalId:  '',
customField: '20100609-110007'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4930',
internalId:  '',
customField: '20100226-162728'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5150',
internalId:  '',
customField: '20060103-221006'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INXHH8';
var companyName   = 'Bahnhof-Drogerie+Amriswil+';
var htmlTitle	  = '';
var metaKeywords  = 'Naturheilmittel%2C+Spagyrik%2C+Parfumerie%2C+Drogerie%2C+Geisselhardt%2C+Tee%2C+Thurgau%2C+Amriswil%2C+Heidak%2C+Sch%C3%BCssler+Salze%2C+Bachbl%C3%BCten%2C+Hom%C3%B6opathie%2C+Phytotherapie%2C+';
var metaContents  = 'Die+Bahnhof-Drogerie+in+Amriswil+ist+das+Fachgesch%C3%A4ft+der+Region+f%C3%BCr+Gesundheit+und+Sch%C3%B6nheit.+Ein+kompetentes+und+freundliches+Team+geht+individuell+auf+die+W%C3%BCnsche+der+Kundschaft+ein.';
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();
};

