/* [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','501',jdecode('Startseite'),jdecode(''), jdecode('%2F501.html'), 'true',[],'',''],
	['PAGE','46701',jdecode('News'),jdecode(''), jdecode('%2F46701.html'), 'true',[],'',''],
	['PAGE','28201',jdecode('B%C3%BCcher'),jdecode(''), jdecode('%2F28201.html'), 'true',[],'',''],
	['PAGE','37701',jdecode('Up-Date'),jdecode(''), jdecode('%2F37701.html'), 'true',[],'',''],
	['PAGE','38101',jdecode('Modellbau+I'),jdecode(''), jdecode('%2F38101.html'), 'false',[],'',''],
	['PAGE','79401',jdecode('Modellbau'),jdecode(''), jdecode('%2F79401.html'), 'true',[],'',''],
	['PAGE','79501',jdecode('Modellbau+III'),jdecode(''), jdecode('%2F79501.html'), 'false',[],'',''],
	['PAGE','58201',jdecode('Service'),jdecode(''), jdecode('%2F58201.html'), 'true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Akropolis';
theSitetree.paletteFamily='4A587F';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10344';
theSitetree.graphicsetId='10449';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='4A587F';
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: 			'Akropolis',
				paletteFamily: 	'4A587F',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10344',
				graphicsetId: 	'10449',
				contentColor: 	'FFFFFF',
				contentBGColor: '4A587F',
				a_color: 		'4A587F',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20110101-174616'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46701',
internalId:  '',
customField: '20110101-164247'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28201',
internalId:  '',
customField: '20110518-165125'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37701',
internalId:  '',
customField: '20111003-111034'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38101',
internalId:  '',
customField: '20101121-171330'
};
webappMappings['7008']=webappMappings['7008-7199']={
webappId:    '7008',
documentId:  '58201',
internalId:  '7199',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '58201',
internalId:  '',
customField: '20110706-212804'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '79401',
internalId:  '',
customField: '20110101-192216'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '79501',
internalId:  '',
customField: '20101122-102700'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW0X0IN2NV4';
var companyName   = 'Georg+Hoch';
var htmlTitle	  = 'Wissenswertes+%C3%BCber+die+Schweizer+Milit%C3%A4raviatik';
var metaKeywords  = '%2CGeorg+Hoch%2C+G.+Hoch%2C+Georg+Hoch+Publishing%2C+Fliegerabteilung%2C+Schweizer+Flugwaffe%2C+Schweizer+Luftwaffe%2C+Swiss+Air+Force%2C++Force+aeriennes+suisses%2C+Farben%2C+Farbgebung%2C+Camouflage%2C+Tarnanstriche%2C+Bemalung%2C+Kennzeichen%2C+Immatrikulation%2C+Kompanie+Abzeichen%2C+Staffel+Abzeichen%2C+Embleme%2C+Piloten%2C+Soldaten%2C+Unteroffiziere%2C+Offiziere%2C+Rekrutenschule%2C+Unteroffiziersschule%2C+Payerne%2C+D%C3%BCbendorf%2C+Modellbau%2C+Modellbauer%2C+Forscher%2C+Messerschmitt%2C+Me+109%2C+Me+109+D%2C+Me+109+E%2C+Me+109+G%2C+Schiffer%2C++Schiffer+Books%2C+Fliegermuseum%2C+D%C3%BCbendorf%2C+Payerne%2C+Suisse%2C+Schweiz%2C+Switzerland%2C+Siemens+Schuckert+D.III%2C+SSW+D.III%2C+Ki.45%2C+USS+Norton+Sound%2C+';
var metaContents  = 'head++meta+http-equiv%3DContent-Type+content%3Dtext%2Fhtml%3B+charset%3Diso-8859-1++titelWissenswertes+%C3%BCber+die+Schweizer+Luftwaffe%2Ftitel++meta+name%3Ddescription+content%3DDie+einzigartige+Fundgrube+f%C3%BCr+Forscher+und+Modellbauer+%C3%BCber+die+Schweizer+Milit%C3%A4raviatik%2C++++%0D%0AFliegerabteilung%2C+Schweizer+Flugwaffe%2C+Schweizer+Luftwaffe%2C+Swiss+Air+Force%2C++Force+aeriennes+suisses%2C+Farben%2C+Farbgebung%2C+Camouflage%2C+Tarnanstriche%2C+Bemalung%2C+Kennzeichen%2C+Immatrikulation%2C+Kompanie+Abzeichen%2C+Staffel+Abzeichen%2C+Embleme%2C+Piloten%2C+Soldaten%2C+Unteroffiziere%2C+Offiziere%2C+Rekrutenschule%2C+Unteroffiziersschule%2C+Payerne%2C+D%C3%BCbendorf%2C+Modellbau%2C+Modellbauer%2C+Forscher%2C+Messerschmitt%2C+Me+109%2C+Me+109+D%2C+Me+109+E%2C+Me+109+G%2C+Schiffer%2C++Schiffer+Books%2C+Fliegermuseum%2C+D%C3%BCbendorf%2C+Payerne%2C+Suisse%2C+Schweiz%2C+Switzerland%2C+Siemens+Schuckert+D.III%2C+SSW+D.III%2C+Ki.45%2C+USS+Norton+Sound%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();
};

