/* [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','301',jdecode('Home'),jdecode(''),'/301.html','true',[],'',''],
	['PAGE','134334',jdecode('Minimundus+-+Shop'),jdecode(''),'/134334.html','true',[],'',''],
	['PAGE','82001',jdecode('Unser+Ladengesch%C3%A4ft'),jdecode(''),'/82001.html','true',[],'',''],
	['PAGE','6701',jdecode('unser+Angebot'),jdecode(''),'/6701.html','true',[],'',''],
	['PAGE','131134',jdecode('Neuheiten'),jdecode(''),'/131134.html','true',[],'',''],
	['PAGE','72901',jdecode('Szenen'),jdecode(''),'/72901.html','true',[],'',''],
	['PAGE','70201',jdecode('H%C3%A4user'),jdecode(''),'/70201.html','true',[],'',''],
	['PAGE','117201',jdecode('Lundby+1%3A18'),jdecode(''),'/117201.html','true',[],'',''],
	['PAGE','18901',jdecode('AGB'),jdecode(''),'/18901.html','true',[],'',''],
	['PAGE','6743',jdecode('Messen'),jdecode(''),'/6743.html','true',[],'',''],
	['PAGE','56401',jdecode('Anfahrt'),jdecode(''),'/56401.html','true',[],'',''],
	['PAGE','21201',jdecode('Links'),jdecode(''),'/21201.html','true',[],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Anniversary';
theSitetree.paletteFamily='5D539D';
theSitetree.keyvisualId='3717';
theSitetree.keyvisualName='kv_3717.jpg';
theSitetree.fontsetId='10472';
theSitetree.graphicsetId='10946';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='F3EFDB';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Anniversary',
				paletteFamily: 	'5D539D',
				keyvisualId: 	'3717',
				keyvisualName: 	'kv_3717.jpg',
				fontsetId: 		'10472',
				graphicsetId: 	'10946',
				contentColor: 	'000000',
				contentBGColor: 'F3EFDB',
				a_color: 		'F7EFDE',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'828181',
				e_color: 		'828181',
				f_color: 		'828181',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '56401',
internalId:  'location',
customField: 'language:de;country:CH;isIncluded:false;'
};
webappMappings['7060']=webappMappings['7060-e6f74ddae54664c1ee2a2072eba031e3']={
webappId:    '7060',
documentId:  '70201',
internalId:  'e6f74ddae54664c1ee2a2072eba031e3',
customField: 'language:de;country:CH;'
};
webappMappings['7060']=webappMappings['7060-3c38c64b45b470b71aaff23d75eec30e']={
webappId:    '7060',
documentId:  '72901',
internalId:  '3c38c64b45b470b71aaff23d75eec30e',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '134334',
internalId:  '',
customField: '20100314-124355'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '301',
internalId:  '',
customField: '20100427-122116'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '82001',
internalId:  '',
customField: '20090423-124209'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6701',
internalId:  '',
customField: '20090923-144004'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '72901',
internalId:  '',
customField: '20080323-000444'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '70201',
internalId:  '',
customField: '20080322-211404'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '131134',
internalId:  '',
customField: '20100219-204507'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '117201',
internalId:  '',
customField: '20090422-132013'
};
webappMappings['4001']=webappMappings['4001-23181586']={
webappId:    '4001',
documentId:  '134334',
internalId:  '23181586',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18901',
internalId:  '',
customField: '20080318-154210'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6743',
internalId:  '',
customField: '20100119-200920'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56401',
internalId:  '',
customField: '20090219-162637'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21201',
internalId:  '',
customField: '20100115-134153'
};
var canonHostname = 'webomat01.hostpoint.ch';
var accountId     = 'AHOPT0INELQU';
var companyName   = 'Atelier+1%3A12';
var htmlTitle	  = 'atelier1%2F12';
var metaKeywords  = 'Puppenhaus+Puppenstuben+Miniaturen+1zu12+1%2F12';
var metaContents  = 'Alles+f%C3%BCr+das+Puppenhaus++Puppenstuben+Miniaturen';
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();
};
