/* [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(''),'/4521.html','true',[],'',''],
	['PAGE','167296',jdecode('%C3%B6ffnungszeiten'),jdecode(''),'/167296.html','true',[],'',''],
	['PAGE','14402',jdecode('Online-Shop'),jdecode(''),'/14402.html','true',[],'',''],
	['PAGE','14502',jdecode('G%C3%A4stebuch'),jdecode(''),'/14502/index.html','true',[ 
		['PAGE','14503',jdecode('Eintr%C3%A4ge'),jdecode(''),'/14502/14503.html','false',[],'','']
	],'',''],
	['PAGE','14561',jdecode('Ihr+Weg+zu+uns'),jdecode(''),'/14561.html','true',[],'',''],
	['PAGE','69578',jdecode('Anfahrt'),jdecode(''),'/69578.html','true',[],'',''],
	['PAGE','58066',jdecode('Kontakt'),jdecode(''),'/58066/index.html','true',[ 
		['PAGE','68821',jdecode('Kontakt+%28Form+followup+page%29'),jdecode(''),'/58066/68821.html','false',[],'','']
	],'',''],
	['PAGE','24825',jdecode('AGB%C2%B4s'),jdecode(''),'/24825.html','true',[],'',''],
	['PAGE','168694',jdecode('Impressum'),jdecode(''),'/168694.html','true',[],'','']];
var siteelementCount=11;
theSitetree.topTemplateName='Profile';
theSitetree.paletteFamily='990000';
theSitetree.keyvisualId='1280';
theSitetree.keyvisualName='feder.jpg';
theSitetree.fontsetId='193';
theSitetree.graphicsetId='232';
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: 			'Profile',
				paletteFamily: 	'990000',
				keyvisualId: 	'1280',
				keyvisualName: 	'feder.jpg',
				fontsetId: 		'193',
				graphicsetId: 	'232',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'990000',
				b_color: 		'333333',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['4001']=webappMappings['4001-N8yW_icw2_XHvy_N']={
webappId:    '4001',
documentId:  '14402',
internalId:  'N8yW_icw2_XHvy_N',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '167296',
internalId:  '',
customField: '20070423-174101'
};
webappMappings['1002']=webappMappings['1002-14502ABW0X0INXXC4']={
webappId:    '1002',
documentId:  '14502',
internalId:  '14502ABW0X0INXXC4',
customField: 'icq=false'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '14561',
internalId:  'routing',
customField: 'de_CH'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14402',
internalId:  '',
customField: '20100629-102932'
};
webappMappings['1009']=webappMappings['1009-6353462']={
webappId:    '1009',
documentId:  '68821',
internalId:  '6353462',
customField: 'isFollowupPage:true;documentId:58066;'
};
webappMappings['7008']=webappMappings['7008-1176']={
webappId:    '7008',
documentId:  '58066',
internalId:  '1176',
customField: 'language:de;country:CH;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4521',
internalId:  '1006',
customField: '1006'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '69578',
internalId:  'location',
customField: 'language:de;country:CH;isIncluded:false;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4521',
internalId:  '',
customField: '20100204-110814'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14502',
internalId:  '',
customField: '20060217-152147'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14503',
internalId:  '',
customField: '20060217-152147'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14561',
internalId:  '',
customField: '20070803-140809'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '69578',
internalId:  '',
customField: '20070803-140832'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '58066',
internalId:  '',
customField: '20070803-140929'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '68821',
internalId:  '',
customField: '20060228-121725'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24825',
internalId:  '',
customField: '20070321-081019'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '168694',
internalId:  '',
customField: '20080731-100324'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INXXC4';
var companyName   = 'Wuzel-Huus+Luzernerstrasse+66++6010+Kriens++';
var htmlTitle	  = '+Wuzel-Huus+Tabakshop+Naturreine+Tabake+Zigarettenmaschinen+Wasserpfeifen+Shisha+PipooZigarettenmaschine+Zigaretten+selber+machen+Cigarren';
var metaKeywords  = 'Wuzel-Huus%2C+Tabakshop%2C+Naturreine+Tabake%2C+Zigarettenmaschinen%2C+Filterh%C3%BClsen%2C+Zigaretten+selber+machen%2C+Wasserpfeifen%2C+Shisha%2C+Tabak%2C+Pipoo%2C+Zigarettenmaschine%2C+Cigarren';
var metaContents  = 'Wuzel-Huus+Tabakshop+-+Naturreine+Tabake+ohne+Zusatzstoffe%2C+von+ultra+bis+kr%C3%A4ftig.+Diverse+Zigarettenmaschinen+und+Filterh%C3%BClsen+zum+Zigaretten+selber+machen.+Orginelle+Wasserpfeifen%2C+Shisha%2C+Tabak+und+Kohle.+Pipoo.+Zigarettenmaschine.+Cigarren';
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();
};
