/* [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','1701',jdecode('Home'),jdecode(''), jdecode('%2F1701.html'), 'true',[],'',''],
	['PAGE','10464',jdecode('Neuheiten'),jdecode(''), jdecode('%2F10464.html'), 'true',[],'',''],
	['PAGE','42524',jdecode('Spiel+des+Monats'),jdecode(''), jdecode('%2F42524.html'), 'true',[],'',''],
	['PAGE','10443',jdecode('Veranstaltung'),jdecode(''), jdecode('%2F10443.html'), 'true',[],'',''],
	['PAGE','48424',jdecode('Unser+Buchtip'),jdecode(''), jdecode('%2F48424%2Findex.html'), 'true',[ 
		['PAGE','32424',jdecode('Belletristik+Hardcover'),jdecode(''), jdecode('%2F48424%2F32424.html'), 'true',[],'',''],
		['PAGE','32445',jdecode('Belletristik+Taschenbuch'),jdecode(''), jdecode('%2F48424%2F32445.html'), 'true',[],'',''],
		['PAGE','32466',jdecode('Sachbuch'),jdecode(''), jdecode('%2F48424%2F32466.html'), 'true',[],'',''],
		['PAGE','32487',jdecode('H%C3%B6rbuch'),jdecode(''), jdecode('%2F48424%2F32487.html'), 'true',[],'',''],
		['PAGE','32508',jdecode('Kinder-+und+Jugendbuch'),jdecode(''), jdecode('%2F48424%2F32508.html'), 'true',[],'','']
	],'',''],
	['PAGE','52724',jdecode('Buchbesprechungen'),jdecode(''), jdecode('%2F52724.html'), 'true',[],'',''],
	['PAGE','10401',jdecode('unsere+Angebote'),jdecode(''), jdecode('%2F10401%2Findex.html'), 'true',[ 
		['PAGE','10422',jdecode('Schaufenster'),jdecode(''), jdecode('%2F10401%2F10422.html'), 'true',[],'','']
	],'',''],
	['PAGE','10485',jdecode('Kontakt'),jdecode(''), jdecode('%2F10485%2Findex.html'), 'true',[ 
		['PAGE','10506',jdecode('Wir+%C3%BCber+uns'),jdecode(''), jdecode('%2F10485%2F10506.html'), 'true',[],'',''],
		['PAGE','10527',jdecode('Unser+Team'),jdecode(''), jdecode('%2F10485%2F10527.html'), 'true',[],'',''],
		['PAGE','10548',jdecode('So+finden+Sie+uns'),jdecode(''), jdecode('%2F10485%2F10548.html'), 'true',[],'',''],
		['PAGE','24212',jdecode('Lageplan'),jdecode(''), jdecode('%2F10485%2F24212.html'), 'true',[],'','']
	],'',''],
	['PAGE','10569',jdecode('Impressum'),jdecode(''), jdecode('%2F10569.html'), 'true',[],'',''],
	['PAGE','50124',jdecode('Diverses'),jdecode(''), jdecode('%2F50124.html'), 'true',[],'','']];
var siteelementCount=20;
theSitetree.topTemplateName='Flat';
theSitetree.paletteFamily='CC9933';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='16702';
theSitetree.graphicsetId='12239';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='E3BD70';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'webland',
  product: 'WSCSYSSSSLY0XFY2'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Flat',
				paletteFamily: 	'CC9933',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'16702',
				graphicsetId: 	'12239',
				contentColor: 	'000000',
				contentBGColor: 'E3BD70',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1701',
internalId:  '',
customField: '20120210-153042'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10401',
internalId:  '',
customField: '20110729-105237'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10443',
internalId:  '',
customField: '20120105-170840'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10464',
internalId:  '',
customField: '20110616-182250'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10422',
internalId:  '',
customField: '20110522-152016'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10485',
internalId:  '',
customField: '20110606-135012'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10506',
internalId:  '',
customField: '20110617-181234'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10527',
internalId:  '',
customField: '20110531-054102'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10548',
internalId:  '',
customField: '20110525-055531'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10569',
internalId:  '',
customField: '20120210-153103'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '24212',
internalId:  'location',
customField: 'language:de;country:CH;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24212',
internalId:  '',
customField: '20110525-090811'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50124',
internalId:  '',
customField: '20120113-180348'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52724',
internalId:  '',
customField: '20120210-153807'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32424',
internalId:  '',
customField: '20120210-153424'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32445',
internalId:  '',
customField: '20120210-153450'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32466',
internalId:  '',
customField: '20120210-153512'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32487',
internalId:  '',
customField: '20120210-153535'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32508',
internalId:  '',
customField: '20120210-153600'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1701',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42524',
internalId:  '',
customField: '20120202-160537'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48424',
internalId:  '',
customField: '20120126-174139'
};
var webAppHostname = 'wsc-app.webland.ch:80';
var canonHostname = 'wsc02.webland.ch';
var accountId     = 'AWB010IN2ZPZ';
var companyName   = 'B%C3%BCcher+-+Spiele+-+Geschenke';
var htmlTitle	  = 'St%C3%B6cklin+Media+Gmbh%2C+Ettingen';
var metaKeywords  = '';
var metaContents  = '';
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();
};

