/* [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','4556',jdecode('Home'),jdecode(''),'/4556.html','true',[],'',''],
	['PAGE','107093',jdecode('Panorama-Webcam'),jdecode(''),'/107093.html','true',[],'',''],
	['PAGE','12618',jdecode('Sponsoren'),jdecode(''),'/12618.html','true',[],'',''],
	['PAGE','106841',jdecode('Stufenspender'),jdecode(''),'/106841.html','true',[],'',''],
	['PAGE','10199',jdecode('Bauarbeiten+%26+Er%C3%B6ffnung'),jdecode(''),'/10199.html','true',[],'',''],
	['PAGE','12591',jdecode('Projekt-Infos'),jdecode(''),'/12591/index.html','true',[ 
		['PAGE','12369',jdecode('Kontakt+%28Folgeseite%29'),jdecode(''),'/12591/12369.html','false',[],'','']
	],'',''],
	['PAGE','4745',jdecode('G%C3%A4stebuch'),jdecode(''),'/4745/index.html','true',[ 
		['PAGE','4746',jdecode('Eintr%C3%A4ge'),jdecode(''),'/4745/4746.html','false',[],'','']
	],'',''],
	['PAGE','92245',jdecode('Anfahrt'),jdecode(''),'/92245.html','true',[],'',''],
	['PAGE','15821',jdecode('Archiv'),jdecode(''),'/15821.html','true',[],'',''],
	['PAGE','10253',jdecode('Links'),jdecode(''),'/10253.html','true',[],'',''],
	['PAGE','107290',jdecode('Kontakt'),jdecode(''),'/107290.html','true',[],'','']];
var siteelementCount=13;
theSitetree.topTemplateName='Dots';
theSitetree.paletteFamily='FFCC66';
theSitetree.keyvisualId='427';
theSitetree.keyvisualName='detail.jpg';
theSitetree.fontsetId='45';
theSitetree.graphicsetId='44';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFCC66';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Dots',
				paletteFamily: 	'FFCC66',
				keyvisualId: 	'427',
				keyvisualName: 	'detail.jpg',
				fontsetId: 		'45',
				graphicsetId: 	'44',
				contentColor: 	'000000',
				contentBGColor: 'FFCC66',
				a_color: 		'FFCC66',
				b_color: 		'FF9933',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4556',
internalId:  '1006',
customField: '1006'
};
webappMappings['1002']=webappMappings['1002-4745ABW0X0INXXC8']={
webappId:    '1002',
documentId:  '4745',
internalId:  '4745ABW0X0INXXC8',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12591',
internalId:  '',
customField: '20090402-094958'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10199',
internalId:  '',
customField: '20070610-111459'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '107093',
internalId:  '',
customField: '20090401-180929'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12618',
internalId:  '',
customField: '20090401-174218'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '106841',
internalId:  '',
customField: '20071004-142613'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4556',
internalId:  '',
customField: '20091214-111342'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12369',
internalId:  '',
customField: '20041103-185358'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4745',
internalId:  '',
customField: '20090402-094855'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4746',
internalId:  '',
customField: '20060715-100007'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '92245',
internalId:  '',
customField: '20080516-104355'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15821',
internalId:  '',
customField: '20080516-103830'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10253',
internalId:  '',
customField: '20080516-105059'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '107290',
internalId:  '',
customField: '20090401-174049'
};
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW0X0INXXC8';
var companyName   = 'Wiler+Turm';
var htmlTitle	  = 'Aussichtsturm+Wil+SG';
var metaKeywords  = 'Aussichtsturm+Wil+St.+Gallen+Verkehrsverein+Wil+9500+Wil+Projekt+Aussichtsturm+Wiler-Turm+Turm+Wil+Tourismus+Holzturm';
var metaContents  = 'Turm+Wiler+Projekt+Holzturm+Wil';
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();
};
