/* [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 theSitetree=[ 
	['PAGE','24801',jdecode('Home'),jdecode(''),'/24801.html','true',[],''],
	['PAGE','4607',jdecode('Standardgewehre'),jdecode(''),'/4607.html','true',[],''],
	['PAGE','4799',jdecode('L%C3%A4ufe'),jdecode(''),'/4799.html','true',[],''],
	['PAGE','14901',jdecode('Masssch%C3%A4fte'),jdecode(''),'/14901.html','true',[],''],
	['PAGE','23301',jdecode('Stgw+57+%26+90'),jdecode(''),'/23301.html','true',[],''],
	['PAGE','27801',jdecode('Optik'),jdecode(''),'/27801.html','true',[],''],
	['PAGE','20148',jdecode('Trainings-System'),jdecode(''),'/20148.html','true',[],''],
	['PAGE','22001',jdecode('Gebrauchtwaffen'),jdecode(''),'/22001.html','true',[],''],
	['PAGE','24117',jdecode('Schussbilder+'),jdecode(''),'/24117.html','true',[],''],
	['PAGE','25501',jdecode('Links'),jdecode(''),'/25501.html','true',[],''],
	['PAGE','4691',jdecode('Kontakt'),jdecode(''),'/4691.html','true',[],''],
	['PAGE','22241',jdecode('G%C3%A4stebuch'),jdecode(''),'/22241/index.html','true',[ 
		['PAGE','22242',jdecode('Eintr%C3%A4ge'),jdecode(''),'/22241/22242.html','false',[],'']
	],'']];
var siteelementCount=13;
theSitetree.topTemplateName='Circulation';
theSitetree.paletteFamily='B1942D';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10587';
theSitetree.graphicsetId='10563';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				name: 			'Circulation',
				paletteFamily: 	'B1942D',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10587',
				graphicsetId: 	'10563',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'FFFFFF',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '24801',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4607',
internalId:  '',
customField: '20050213-175343'
};
webappMappings['1002']=webappMappings['1002-22241ABW0X0INXLPI']={
webappId:    '1002',
documentId:  '22241',
internalId:  '22241ABW0X0INXLPI',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24801',
internalId:  '',
customField: '20090420-175902'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4799',
internalId:  '',
customField: '20050202-154544'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14901',
internalId:  '',
customField: '20050202-151531'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23301',
internalId:  '',
customField: '20061015-165948'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27801',
internalId:  '',
customField: '20050420-213749'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20148',
internalId:  '',
customField: '20050213-164137'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22001',
internalId:  '',
customField: '20061015-174225'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24117',
internalId:  '',
customField: '20090420-180718'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25501',
internalId:  '',
customField: '20050420-185646'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4691',
internalId:  '',
customField: '20060114-170209'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22241',
internalId:  '',
customField: '20050420-213038'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22242',
internalId:  '',
customField: '20050207-152619'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INXLPI';
var companyName   = 'Spielmann+%26+Partner+AG';
var htmlTitle	  = 'Spielmann++Partner+AG';
var metaKeywords  = 'Spielmann++Parner+AG%2C+Spielmann%2C+Gewehre%2C+Sportgewehr%2C+Jagdgewehr%2C+Sch%C3%A4fte%2C+Gebrauchtwaffen%2C+Pr%C3%A4zisionsgewehr%2C+Masssch%C3%A4fte%2C+Standardgewehre%2C+Schiessen%2C+Schiesssport%2C+SCATT%2C+Stgw+90%2C+Pistolen%2C+Revolver%2C+B%C3%BCchsenmacher%2C+B%C3%BCchsenmacherei';
var metaContents  = 'Sportsch%C3%BCtzen+schiessen+mit+Spielmann+Standardgewehren+Spitzenresultate+mit+Masssch%C3%A4ften+und+Pr%C3%A4zisionsl%C3%A4ufen.';
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();
};

