/* [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','4596',jdecode('El-Manis+'),jdecode(''),'/4596.html','true',[],'',''],
	['PAGE','4653',jdecode('Aktuelles'),jdecode(''),'/4653.html','true',[],'',''],
	['PAGE','100401',jdecode('Distanzsaison+2010'),jdecode(''),'/100401.html','true',[],'',''],
	['PAGE','81101',jdecode('Distanzsaison+2009'),jdecode(''),'/81101/index.html','true',[ 
		['PAGE','4707',jdecode('Saison+07+%2F+08'),jdecode(''),'/81101/4707.html','true',[],'','']
	],'',''],
	['PAGE','48601',jdecode('Trainings+Tagebuch'),jdecode(''),'/48601.html','true',[],'',''],
	['PAGE','100422',jdecode('Jahresr%C3%BCckblick+2009'),jdecode(''),'/100422.html','true',[],'',''],
	['PAGE','55601',jdecode('Wanderreiten'),jdecode(''),'/55601.html','true',[],'',''],
	['PAGE','4761',jdecode('Unsere+Fohlen'),jdecode(''),'/4761.html','true',[],'',''],
	['PAGE','4680',jdecode('Kasib%26%23x27%3Bs+Geschichte+ist+zu+Ende'),jdecode(''),'/4680.html','true',[],'',''],
	['PAGE','97901',jdecode('Bilder+des+Alltags'),jdecode(''),'/97901/index.html','true',[ 
		['PAGE','4858',jdecode('Eintr%C3%A4ge'),jdecode(''),'/97901/4858.html','false',[],'','']
	],'',''],
	['PAGE','4734',jdecode('Verkaufspferde%2FKontakt'),jdecode(''),'/4734.html','true',[],'',''],
	['PAGE','4857',jdecode('G%C3%A4stebuch'),jdecode(''),'/4857.html','true',[],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Circulation';
theSitetree.paletteFamily='FC2323';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10381';
theSitetree.graphicsetId='10561';
theSitetree.contentColor='DDDDDD';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Circulation',
				paletteFamily: 	'FC2323',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10381',
				graphicsetId: 	'10561',
				contentColor: 	'DDDDDD',
				contentBGColor: '000000',
				a_color: 		'FFFFFF',
				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['1002']=webappMappings['1002-4857ABW0X0INXX87']={
webappId:    '1002',
documentId:  '4857',
internalId:  '4857ABW0X0INXX87',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4596',
internalId:  '',
customField: '20100326-084348'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4653',
internalId:  '',
customField: '20100821-172708'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4680',
internalId:  '',
customField: '20080102-154626'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4707',
internalId:  '',
customField: '20090212-083547'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48601',
internalId:  '',
customField: '20100425-094600'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100422',
internalId:  '',
customField: '20100109-102425'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55601',
internalId:  '',
customField: '20090604-132846'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4761',
internalId:  '',
customField: '20100420-091334'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4734',
internalId:  '',
customField: '20080425-081649'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4857',
internalId:  '',
customField: '20070105-093824'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4858',
internalId:  '',
customField: '20070105-093824'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '97901',
internalId:  '',
customField: '20100326-090356'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '81101',
internalId:  '',
customField: '20091012-110510'
};
webappMappings['1501']=webappMappings['1501-717683']={
webappId:    '1501',
documentId:  '4596',
internalId:  '717683',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100401',
internalId:  '',
customField: '20100810-125457'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INXX87';
var companyName   = 'El++Manis';
var htmlTitle	  = 'El+Manis++++Pferde++mehr';
var metaKeywords  = 'El+Manis%2C+Pferde+und+mehr.++Araber%2C+Berber%2C+Pinto%2C+Minipferde%2C+Britisch+Miniatur+Horses%2C+Pferdesport%2C+Distanz%2C+Endurance%2C+Fun+Futter%2C+Ingwer%2C+Zucht%2C+ROC+Sattel%2C+Biothane%2C+Zubeh%C3%B6r%2C+Freilaufstall%2C+Bern%2C+Emmental%2C+Manishaus%2C+Claudia+Boggs%2C+Christoph+Z%C3%BCrcher';
var metaContents  = 'El+Manis%2C+Pferde+und+mehr.++Araber%2C+Berber%2C+Pinto%2C+Minipferde%2C+Britisch+Miniatur+Horses%2C+Pferdesport%2C+Distanz%2C+Endurance%2C+Fun+Futter%2C+Ingwer%2C+Zucht%2C+ROC+Sattel%2C+Biothane%2C+Zubeh%C3%B6r%2C+Freilaufstall%2C+Bern%2C+Emmental%2C+Manishaus%2C+Claudia+Boggs%2C+Christoph+Z%C3%BCrcher';
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();
};
