/* [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','104912',jdecode('G%C3%A4stebuch+%28Startseite%29'),jdecode(''),'/104912/index.html','true',[ 
		['PAGE','401',jdecode('Haberler%2FNachrichten'),jdecode(''),'/104912/401.html','true',[],'',''],
		['PAGE','95543',jdecode('4.+Liga'),jdecode(''),'/104912/95543.html','true',[],'',''],
		['PAGE','95564',jdecode('Senioren'),jdecode(''),'/104912/95564.html','true',[],'',''],
		['PAGE','95522',jdecode('Photos'),jdecode(''),'/104912/95522.html','true',[],'',''],
		['PAGE','95501',jdecode('Der+Vorstand%2FStatuten'),jdecode(''),'/104912/95501.html','true',[],'',''],
		['PAGE','95606',jdecode('Interessante+Links'),jdecode(''),'/104912/95606.html','true',[],'',''],
		['PAGE','95627',jdecode('Kontakt%2FSponsoren'),jdecode(''),'/104912/95627.html','true',[],'','']
	],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Soccer';
theSitetree.paletteFamily='F80404';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10499';
theSitetree.graphicsetId='11112';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Soccer',
				paletteFamily: 	'F80404',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10499',
				graphicsetId: 	'11112',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'F80404',
				e_color: 		'F80404',
				f_color: 		'F80404',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '104912',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '95522',
internalId:  '',
customField: '20100416-194418'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '95543',
internalId:  '',
customField: '20100416-193951'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '95564',
internalId:  '',
customField: '20100416-194311'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20100416-193812'
};
webappMappings['1002']=webappMappings['1002-104912ahopt0in3mav']={
webappId:    '1002',
documentId:  '104912',
internalId:  '104912ahopt0in3mav',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '95606',
internalId:  '',
customField: '20100308-140909'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '95627',
internalId:  '',
customField: '20100416-194746'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '95501',
internalId:  '',
customField: '20100224-171339'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '104912',
internalId:  '',
customField: '20091126-163116'
};
var canonHostname = 'webomat02.hostpoint.ch';
var accountId     = 'AHOPT0IN3MAV';
var companyName   = 'FC+AFYON+03+%3C%3D%3D%3E+AF-YOK+';
var htmlTitle	  = '';
var metaKeywords  = 'FC+AFYON+03%2C+AFYON%2C+FCAFYON%2C+FCAFYON03%2C+FC%2C+SANDIKLI%2C+BASEL%2C+CEVREPINAR%2C+RANKHOF%2C+AFYONSPOR%2C+TAKIM%2C+FUTBOL%2C+KLEINBASEL%2C+AFYONKARAHISAR%2C+FUSSBALL%2C+BALL%2C+SPORT%2C+SPIEL%2C+SOCCER%2C+FOOTBALL%2C+TOP%2C+FELD%2C+VEREIN%2C+KUL%C3%9CB%2C+CLUB%2C+RASEN%2C+SPIELER%2C+T%C3%9CRK%2C+TURK%2C+T%C3%9CRKEI%2C+T%C3%9CRKIYE%2C+SCHWEIZ%2C+TURNIER%2C+HALLE%2C+SAAL%2C+FEST%2C+SPONSOR%2C+';
var metaContents  = 'FC+AFYON+03+BASEL+DE+%2F+AFYONLULARIN+KALB%C4%B0N%C4%B0N+ATTI%C4%9EI+YER.....';
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();
};
