/* [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(''), jdecode('%2F4596.html'), 'true',[],'',''],
	['PAGE','4653',jdecode('Aktuelles'),jdecode(''), jdecode('%2F4653.html'), 'true',[],'',''],
	['PAGE','140401',jdecode('Mysha%26%23x27%3Bs+Paradise'),jdecode(''), jdecode('%2F140401.html'), 'true',[],'',''],
	['PAGE','128101',jdecode('Distanzsaison+2011'),jdecode(''), jdecode('%2F128101%2Findex.html'), 'true',[ 
		['PAGE','100401',jdecode('Distanzsaison+2010'),jdecode(''), jdecode('%2F128101%2F100401.html'), 'true',[],'',''],
		['PAGE','81101',jdecode('Distanzsaison+2009'),jdecode(''), jdecode('%2F128101%2F81101.html'), 'true',[],'',''],
		['PAGE','4707',jdecode('Saison+07+%2F+08'),jdecode(''), jdecode('%2F128101%2F4707.html'), 'true',[],'','']
	],'',''],
	['PAGE','128122',jdecode('Sponsoring'),jdecode(''), jdecode('%2F128122%2Findex.html'), 'true',[ 
		['PAGE','131801',jdecode('Unsere+Sponsoren'),jdecode(''), jdecode('%2F128122%2F131801.html'), 'true',[],'','']
	],'',''],
	['PAGE','48601',jdecode('Trainings+Tagebuch'),jdecode(''), jdecode('%2F48601.html'), 'true',[],'',''],
	['PAGE','150301',jdecode('Jahresr%C3%BCckblick+2011'),jdecode(''), jdecode('%2F150301.html'), 'true',[],'',''],
	['PAGE','100422',jdecode('Jahresr%C3%BCckblick+2009'),jdecode(''), jdecode('%2F100422.html'), 'true',[],'',''],
	['PAGE','55601',jdecode('Wanderreiten'),jdecode(''), jdecode('%2F55601.html'), 'true',[],'',''],
	['PAGE','4761',jdecode('Unsere+Fohlen'),jdecode(''), jdecode('%2F4761.html'), 'true',[],'',''],
	['PAGE','4680',jdecode('Kasib%26%23x27%3Bs+Geschichte+ist+zu+Ende'),jdecode(''), jdecode('%2F4680.html'), 'true',[],'',''],
	['PAGE','97901',jdecode('Bilder+des+Alltags'),jdecode(''), jdecode('%2F97901%2Findex.html'), 'true',[ 
		['PAGE','4858',jdecode('Eintr%C3%A4ge'),jdecode(''), jdecode('%2F97901%2F4858.html'), 'false',[],'','']
	],'',''],
	['PAGE','4734',jdecode('Verkaufspferde%2FKontakt'),jdecode(''), jdecode('%2F4734.html'), 'true',[],'',''],
	['PAGE','4857',jdecode('G%C3%A4stebuch'),jdecode(''), jdecode('%2F4857.html'), 'true',[],'',''],
	['PAGE','154301',jdecode('Reisebericht+Karibik+%2F+New+York'),jdecode(''), jdecode('%2F154301.html'), 'true',[],'','']];
var siteelementCount=20;
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 prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MX'
};
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: '20110301-091158'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4653',
internalId:  '',
customField: '20120101-195909'
};
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: '20110327-183523'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100422',
internalId:  '',
customField: '20100109-102425'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55601',
internalId:  '',
customField: '20110423-100140'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4761',
internalId:  '',
customField: '20110619-112449'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4734',
internalId:  '',
customField: '20100911-103748'
};
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: '20101024-111515'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '81101',
internalId:  '',
customField: '20091012-110510'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '128101',
internalId:  '',
customField: '20111006-192943'
};
webappMappings['1501']=webappMappings['1501-717683']={
webappId:    '1501',
documentId:  '4596',
internalId:  '717683',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100401',
internalId:  '',
customField: '20101203-120521'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '128122',
internalId:  '',
customField: '20110206-095312'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '131801',
internalId:  '',
customField: '20110318-133513'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '140401',
internalId:  '',
customField: '20110524-202132'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '150301',
internalId:  '-',
customField: '20111231-101725'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '154301',
internalId:  '-',
customField: '20120202-215255'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01b.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();
};

