/* [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','401',jdecode('K4K+-+HOME'),jdecode(''), jdecode('%2F401.html'), 'true',[],'',''],
	['PAGE','663312',jdecode('K4K+-+Aktuelles'),jdecode(''), jdecode('%2F663312.html'), 'true',[],'',''],
	['PAGE','14843',jdecode('K4K+-+Konzept'),jdecode(''), jdecode('%2F14843.html'), 'true',[],'',''],
	['PAGE','14948',jdecode('K4K+-+Ablaufplan'),jdecode(''), jdecode('%2F14948.html'), 'true',[],'',''],
	['PAGE','664012',jdecode('K4K+-+Termine+2012'),jdecode(''), jdecode('%2F664012.html'), 'true',[],'',''],
	['PAGE','14927',jdecode('K4K+-+Anmeldungen'),jdecode(''), jdecode('%2F14927.html'), 'true',[],'',''],
	['PAGE','714312',jdecode('K4K+-+Street+-+Soccer'),jdecode(''), jdecode('%2F714312.html'), 'true',[],'',''],
	['PAGE','714333',jdecode('Anmeldung+'),jdecode(''), jdecode('%2F714333.html'), 'true',[],'',''],
	['PAGE','471301',jdecode('Projekt+Sonnenlicht'),jdecode(''), jdecode('%2F471301%2Findex.html'), 'true',[ 
		['PAGE','471322',jdecode('Projekte'),jdecode(''), jdecode('%2F471301%2F471322.html'), 'true',[],'',''],
		['PAGE','471343',jdecode('Mitgliedschaft'),jdecode(''), jdecode('%2F471301%2F471343.html'), 'true',[],'','']
	],'',''],
	['PAGE','591412',jdecode('K4K+-+Fotos'),jdecode(''), jdecode('%2F591412.html'), 'true',[],'',''],
	['PAGE','663417',jdecode('K4K+-+Presse'),jdecode(''), jdecode('%2F663417.html'), 'true',[],'',''],
	['PAGE','663438',jdecode('K4K+-+Links'),jdecode(''), jdecode('%2F663438.html'), 'true',[],'',''],
	['PAGE','664075',jdecode('K4K+-+Sponsoren'),jdecode(''), jdecode('%2F664075.html'), 'true',[],'',''],
	['PAGE','400806',jdecode('G%C3%A4stebuch'),jdecode(''), jdecode('%2F400806.html'), 'false',[],'','']];
var siteelementCount=16;
theSitetree.topTemplateName='Deepcolor';
theSitetree.paletteFamily='5583CB';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10349';
theSitetree.graphicsetId='10469';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='154186';
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: 			'Deepcolor',
				paletteFamily: 	'5583CB',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10349',
				graphicsetId: 	'10469',
				contentColor: 	'000000',
				contentBGColor: '154186',
				a_color: 		'5583CB',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-13580']={
webappId:    '7008',
documentId:  '714333',
internalId:  '13580',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '714333',
internalId:  '-',
customField: '20120131-114232'
};
webappMappings['1501']=webappMappings['1501-1501']={
webappId:    '1501',
documentId:  '401',
internalId:  '1501',
customField: '1501'
};
webappMappings['7008']=webappMappings['7008-327']={
webappId:    '7008',
documentId:  '14927',
internalId:  '327',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20120128-124927'
};
webappMappings['1002']=webappMappings['1002-400806abw0x0in2ml4']={
webappId:    '1002',
documentId:  '400806',
internalId:  '400806abw0x0in2ml4',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14843',
internalId:  '',
customField: '20120103-105718'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14948',
internalId:  '',
customField: '20120102-164159'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14927',
internalId:  '',
customField: '20120116-121849'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '591412',
internalId:  '',
customField: '20120104-120711'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '400806',
internalId:  '',
customField: '20080708-002259'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '664075',
internalId:  '-',
customField: '20120104-122454'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '663438',
internalId:  '-',
customField: '20120116-122742'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '714312',
internalId:  '-',
customField: '20120131-113129'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '663417',
internalId:  '-',
customField: '20120104-122223'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '663312',
internalId:  '-',
customField: '20120124-113225'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '664012',
internalId:  '-',
customField: '20120201-161533'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '471301',
internalId:  '',
customField: '20120102-165735'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '471322',
internalId:  '',
customField: '20120102-165934'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '471343',
internalId:  '',
customField: '20120102-170650'
};
webappMappings['1501']=webappMappings['1501-6543442']={
webappId:    '1501',
documentId:  '401',
internalId:  '6543442',
customField: '1501'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0IN2ML4';
var companyName   = 'KICK4KIDS+-+SOCCERCAMPS+GmbH';
var htmlTitle	  = 'Kick4Kids+-+Soccercamps+Schweiz';
var metaKeywords  = 'Kick4Kids+-+Soccercamps++++';
var metaContents  = 'Soccercamps%2C+Fussballcamps%2C+Sonnenlicht+';
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();
};

