/* [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','1901',jdecode('Home'),jdecode(''),'/1901.html','true',[],'',''],
	['PAGE','2015',jdecode('Online-Shop'),jdecode(''),'/2015.html','true',[],'',''],
	['PAGE','2036',jdecode('Kontakt'),jdecode(''),'/2036.html','true',[],'',''],
	['PAGE','2057',jdecode('Wir+%C3%BCber+uns'),jdecode(''),'/2057/index.html','true',[ 
		['PAGE','2099',jdecode('So+finden+Sie+uns'),jdecode(''),'/2057/2099.html','true',[],'','']
	],'',''],
	['PAGE','2120',jdecode('AGB%C2%B4s'),jdecode(''),'/2120.html','true',[],'',''],
	['PAGE','2141',jdecode('Impressum'),jdecode(''),'/2141.html','true',[],'','']];
var siteelementCount=7;
theSitetree.topTemplateName='Odd';
theSitetree.paletteFamily='F5E7C2';
theSitetree.keyvisualId='12123';
theSitetree.keyvisualName='kv_12123.jpg';
theSitetree.fontsetId='33321';
theSitetree.graphicsetId='14194';
theSitetree.contentColor='333333';
theSitetree.contentBGColor='F5E7C2';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Odd',
				paletteFamily: 	'F5E7C2',
				keyvisualId: 	'12123',
				keyvisualName: 	'kv_12123.jpg',
				fontsetId: 		'33321',
				graphicsetId: 	'14194',
				contentColor: 	'333333',
				contentBGColor: 'F5E7C2',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Palatino Linotype, Book Antiqua, Palatino, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1901',
internalId:  '',
customField: '20110704-103842'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2015',
internalId:  '',
customField: '20091027-121459'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2036',
internalId:  '',
customField: '20090730-223531'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2057',
internalId:  '',
customField: '20090730-214026'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2099',
internalId:  '',
customField: '20090903-160733'
};
webappMappings['4001']=webappMappings['4001-29877113']={
webappId:    '4001',
documentId:  '2015',
internalId:  '29877113',
customField: 'language:de;country:CH;'
};
webappMappings['7008']=webappMappings['7008-6773']={
webappId:    '7008',
documentId:  '2036',
internalId:  '6773',
customField: 'language:de;country:CH;'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '2099',
internalId:  'location',
customField: 'language:de;country:CH;isIncluded:true;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1901',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-29877144']={
webappId:    '1501',
documentId:  '1901',
internalId:  '29877144',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2120',
internalId:  '',
customField: '20091008-093727'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2141',
internalId:  '',
customField: '20090730-220650'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW330INE8RW';
var companyName   = 'Spirit+Still';
var htmlTitle	  = 'http%3A%2F%2Fwww.spiritstill.ch%2Fgoogledd341995f91ad7c7.html';
var metaKeywords  = 'Whisky%2C+Zug%2C+Single+Malt%2C+Spirituosen%2C+Wein%2C+Rum%2C+Grappa%2C+Shop%2C+spirit+still%2C+Spirit+Still%2C+Whiskey%2C+Whiskyshop%2C+Whisky+Zug%2C+Whisky+Schweiz%2C+Bertrams';
var metaContents  = 'Der+Spezialist+f%C3%BCr+Single+Malt+Whisky+und+andere+Spirituosen+in+der+Zeughausgasse+17+in+6300+Zug%2C+Schweiz.+%C3%9Cber+400+verschiedene+Single+Malt+Whiskys%2C+weitere+100+Whiskies+aus+dem+Rest+der+Welt+und+eine+grosse+Auswahl+an+Grappas%2C+Rums+und+anderen+Edelspirituosen+erwarten+Sie.+';
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();
};

