/* [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','5001',jdecode('Home'),jdecode(''), jdecode('%2F5001.html'), 'true',[],'',''],
	['PAGE','5052',jdecode('Biographie'),jdecode(''), jdecode('%2F5052.html'), 'true',[],'',''],
	['PAGE','5073',jdecode('Reisen'),jdecode(''), jdecode('%2F5073.html'), 'true',[],'',''],
	['PAGE','5094',jdecode('Gipfelbuch'),jdecode(''), jdecode('%2F5094.html'), 'true',[],'',''],
	['PAGE','5115',jdecode('Bild'),jdecode(''), jdecode('%2F5115.html'), 'true',[],'',''],
	['PAGE','5136',jdecode('Klang'),jdecode(''), jdecode('%2F5136.html'), 'true',[],'',''],
	['PAGE','5157',jdecode('News'),jdecode(''), jdecode('%2F5157.html'), 'true',[],'',''],
	['PAGE','5178',jdecode('Links'),jdecode(''), jdecode('%2F5178.html'), 'true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Speed';
theSitetree.paletteFamily='920000';
theSitetree.keyvisualId='2342';
theSitetree.keyvisualName='blanko.jpg';
theSitetree.fontsetId='376';
theSitetree.graphicsetId='424';
theSitetree.contentColor='DDDDDD';
theSitetree.contentBGColor='920000';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2QE'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Speed',
				paletteFamily: 	'920000',
				keyvisualId: 	'2342',
				keyvisualName: 	'blanko.jpg',
				fontsetId: 		'376',
				graphicsetId: 	'424',
				contentColor: 	'DDDDDD',
				contentBGColor: '920000',
				a_color: 		'920000',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20120124-205253'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5052',
internalId:  '',
customField: '20111223-133842'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5073',
internalId:  '',
customField: '20111223-133602'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5094',
internalId:  '',
customField: '20111220-072448'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5115',
internalId:  '',
customField: '20111220-072302'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5136',
internalId:  '',
customField: '20120124-210012'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5157',
internalId:  '',
customField: '20120123-190917'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5178',
internalId:  '',
customField: '20120123-191040'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5001',
internalId:  '1006',
customField: '1006'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW330INEINR';
var companyName   = 'Walter+N%C3%A4f';
var htmlTitle	  = '';
var metaKeywords  = 'Walter+N%C3%A4f%2C+Walter+Naef%2C+Toggenburg%2C+Klangwelt%2C+Klanghaus%2C+Klang%2C+Bilder%2C+Malen%2C+S%C3%A4ntis%2C+Speer%2C+Churfirsten%2C+Schweizer+Fernsehen%2C+Valotti%2C+Gyr%2C+Sommer%2C+Mettler%2C+Bauernmaler%2C+Litho%2C+z%27Alp%2C+Lithographie%2C+Mirer%2C+Wallis%2C+Engadin%2C+Roth%2C+R%C3%A4ss+Nadja%2C+Renggli%2C+Lehn+Escholzmatt%2C+EJV%2C+NOSJV%2C+VSV%2C+SBB%2C+Tourismus%2C+Bild%2C+Berge%2C+Matterhorn%2C+Rigi%2C+Monte%2C+Z%C3%BCrich%2C+Violinschl%C3%BCssel%2C+Goldener+Violinschluessel%2C+Linoldruck%2C+Aquarell%2C+Pinsel%2C+Farben%2C+Boesner%2C+K%C3%BCnstler%2C+Ausstellung%2C+Galerie%2C+Kunstgalerie%2C+Ricardo%2C+kunstkarten%2C+Kilimanjaro%2C+Kapstadt%2C+San+Francisco%2C+Los+Angeles%2C+Picasso%2C+Segantini%2C+D%C3%BCrer%2C+Blocher%2C+Wildhaus%2C+Jodlerklub%2C+wil%2C+Jodeln%2C+Jodler%2C+Textdichter%2C+Texter%2C+Song%2C+Komponist%2C+Suisa%2C+R%C3%BCegge%2C+Schweiz%2C+Switzerland%2C+Island%2C+Sizilien%2C+Aetna%2C+Weissmies%2C+Bernina%2C+Dom%2C+Artist%2C+Painter%2C+Swiss%2C+Linolbild%2C+Verdi%2C+Verdiana%2C+Jodellied%2C+Naturjodel%2C+Alphorn%2C+Chor%2C+Leidenschaft%2C+Heimat%2C+Senntum%2C+Appenzell%2C+Trogen%2C+D%C3%B6lf+Mettler%2C+Noten%2C+Sellamatt%2C+Juchz%2C+Juchzer%2C+Kuckuckjodler%2C+Hackbrett%2C+Alder%2C+Willi+Valotti%2C+Lisbeth+Arnold%2C+Beat+J%C3%A4ggi%2C++';
var metaContents  = 'Offizielle+Homepage+von+Walter+N%C3%A4f%2C+K%C3%BCnstler%2C+Bauernmaler%2C+Kunstmaler%2C+Textdichter%2C+Jodelliedtexter%2C+Toggenburger%2C+im+Verein+Goldener+Violinschl%C3%BCssel+und+F%C3%B6rderverein+Klangwelt%2C++im+Toggenburg+aufgewachsen%2C+malt+Bilder%2C+Aquarell+und+Linoldruck%2C+Zeichnungen%2C+Kunstkartenverlag%2C+Kunstkarten%2C+macht+Texte+f%C3%BCr+Jodellieder+und+klingende+Folklore';
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();
};

