/* [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','10201',jdecode('News+'),jdecode(''), jdecode('%2F10201.html'), 'true',[],'',''],
	['PAGE','161245',jdecode('Agenda'),jdecode(''), jdecode('%2F161245.html'), 'true',[],'',''],
	['PAGE','191845',jdecode('Wintertraining+11%2F12'),jdecode(''), jdecode('%2F191845.html'), 'true',[],'',''],
	['PAGE','112623',jdecode('Davos+Marathon+2012'),jdecode(''), jdecode('%2F112623.html'), 'true',[],'',''],
	['PAGE','201245',jdecode('20.+Jungfrau-Marathon+'),jdecode(''), jdecode('%2F201245.html'), 'true',[],'',''],
	['PAGE','138577',jdecode('Berlin+Marathon+2012'),jdecode(''), jdecode('%2F138577.html'), 'true',[],'',''],
	['PAGE','138598',jdecode('Luzern+Marathon'),jdecode(''), jdecode('%2F138598.html'), 'true',[],'',''],
	['PAGE','84823',jdecode('Kontakt'),jdecode(''), jdecode('%2F84823.html'), 'true',[],'',''],
	['PAGE','198745',jdecode('Heidiland+Laufcup'),jdecode(''), jdecode('%2F198745%2Findex.html'), 'true',[ 
		['PAGE','198766',jdecode('Jugend'),jdecode(''), jdecode('%2F198745%2F198766.html'), 'true',[],'',''],
		['PAGE','198787',jdecode('Damen'),jdecode(''), jdecode('%2F198745%2F198787.html'), 'true',[],'',''],
		['PAGE','198808',jdecode('Herren'),jdecode(''), jdecode('%2F198745%2F198808.html'), 'true',[],'','']
	],'',''],
	['PAGE','138556',jdecode('Trainingsberatung+'),jdecode(''), jdecode('%2F138556.html'), 'true',[],'','']];
var siteelementCount=13;
theSitetree.topTemplateName='Frugality';
theSitetree.paletteFamily='FCC270';
theSitetree.keyvisualId='7682';
theSitetree.keyvisualName='kv_7682.jpg';
theSitetree.fontsetId='16747';
theSitetree.graphicsetId='12253';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Frugality',
				paletteFamily: 	'FCC270',
				keyvisualId: 	'7682',
				keyvisualName: 	'kv_7682.jpg',
				fontsetId: 		'16747',
				graphicsetId: 	'12253',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10201',
internalId:  '',
customField: '20120130-192550'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '198766',
internalId:  '-',
customField: '20111208-063413'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '138556',
internalId:  '',
customField: '20110322-143255'
};
webappMappings['1501']=webappMappings['1501-29795248']={
webappId:    '1501',
documentId:  '10201',
internalId:  '29795248',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '84823',
internalId:  '',
customField: '20101113-180941'
};
webappMappings['7008']=webappMappings['7008-7980']={
webappId:    '7008',
documentId:  '84823',
internalId:  '7980',
customField: 'language:de;country:CH;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '138577',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '138598',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '84823',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '138577',
internalId:  '',
customField: '20110929-181019'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '138598',
internalId:  '',
customField: '20110831-063418'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '198745',
internalId:  '-',
customField: '20111208-064459'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '138556',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '198787',
internalId:  '-',
customField: '20111208-063429'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '10201',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '112623',
internalId:  '',
customField: '20110909-201516'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '112623',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '161245',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '191845',
internalId:  '',
customField: '20110911-161503'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '191845',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '161245',
internalId:  '',
customField: '20120130-192433'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '198808',
internalId:  '-',
customField: '20111208-063457'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '201245',
internalId:  '-',
customField: '20120120-065818'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INEWL5';
var companyName   = 'www.flumser-laufseminar.ch';
var htmlTitle	  = 'flumser-laufseminar';
var metaKeywords  = 'Flums%2C+Laufen%2C+Joggen%2C+Rennen%2C+Laufseminare%2C+Roman%2C+Stettler%2C+Triathlon%2C+Mallorca+%2CRadtraining%2C+Biken%2C+Heidiland%2C+Flumserberg%2C+Trainingsplan%2CLaufplanung%2C+Luzern+Marathon%2C+Marathon+Vorbereitung%2C+Trainingspl%C3%A4ne%2C+Trainingspl%C3%A4ne%2CRoman%2CRoman+Stettler%2CBerlin%2C+Berlin+Marathon%2CBerlinmarathon%2C+';
var metaContents  = 'Flums%2C+Laufen%2C+Joggen%2C+Rennen%2C+Laufseminare%2C+Triathlon%2C+Laufferien%2C+Ferien+auf+Mallorca%2CRadtraining%2C+Biken%2C+Heidiland%2C+Flumserberg%2CTrainingsplan+erstellen%2C+Laufplanung%2C+Marathon+vorbereitung%2C+Luzern+Marathon%2C+Luzern+Marathon+Training%2C+Lucern+Marathon%2C++Training%2C+Trainings%2C+Trainingspl%C3%A4ne%2C+Intervalltraining%2C+L%C3%A4ufer%2C+Anf%C3%A4nger%2C+heidiland%2C+Heidiland-Runners%2C+Flums%2C+Flumserberg%2C+Roman%2C+Roman+Stettler%2C+Berlin%2C+Berlinmarathon%2C+Startpl%C3%A4tze%2C+Startpl%C3%A4tze+Berlinmarathon%2C+';
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();
};

