/* [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','601',jdecode('Home'),jdecode(''),'/601.html','true',[],'',''],
	['PAGE','221412',jdecode('Mission+Statement'),jdecode(''),'/221412.html','true',[],'',''],
	['PAGE','652',jdecode('Die+Ranch'),jdecode(''),'/652/index.html','true',[ 
		['PAGE','30601',jdecode('Impressionen+'),jdecode(''),'/652/30601.html','true',[],'','']
	],'',''],
	['PAGE','211912',jdecode('Unglaublich+aber+wahr'),jdecode(''),'/211912/index.html','true',[ 
		['PAGE','215912',jdecode('Vorher+%2F+Nachher'),jdecode(''),'/211912/215912.html','true',[],'',''],
		['PAGE','215933',jdecode('Ihre+Meinung'),jdecode(''),'/211912/215933.html','true',[],'','']
	],'',''],
	['PAGE','167801',jdecode('Rinderzucht'),jdecode(''),'/167801/index.html','true',[ 
		['PAGE','211512',jdecode('Impressionen'),jdecode(''),'/167801/211512.html','true',[],'','']
	],'',''],
	['PAGE','206912',jdecode('Fleischverkauf'),jdecode(''),'/206912.html','true',[],'',''],
	['PAGE','167901',jdecode('Pferdezucht'),jdecode(''),'/167901/index.html','true',[ 
		['PAGE','168601',jdecode('Pferdeverkauf'),jdecode(''),'/167901/168601.html','true',[],'',''],
		['PAGE','172401',jdecode('Fotos'),jdecode(''),'/167901/172401.html','false',[],'',''],
		['PAGE','211533',jdecode('Impressionen'),jdecode(''),'/167901/211533.html','true',[],'','']
	],'',''],
	['PAGE','209912',jdecode('Marktplatz'),jdecode(''),'/209912.html','true',[],'',''],
	['PAGE','2106',jdecode('G%C3%A4stebuch'),jdecode(''),'/2106/index.html','true',[ 
		['PAGE','2101',jdecode('Eintr%C3%A4ge'),jdecode(''),'/2106/2101.html','false',[],'','']
	],'',''],
	['PAGE','736',jdecode('Kontakt'),jdecode(''),'/736.html','true',[],'',''],
	['PAGE','2201',jdecode('Anfahrt'),jdecode(''),'/2201/index.html','true',[ 
		['PAGE','175601',jdecode('Routenplaner'),jdecode(''),'/2201/175601.html','true',[],'','']
	],'',''],
	['PAGE','212812',jdecode('Shop'),jdecode(''),'/212812.html','true',[],'','']];
var siteelementCount=21;
theSitetree.topTemplateName='Toronto';
theSitetree.paletteFamily='94824B';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='16881';
theSitetree.graphicsetId='12319';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='94824B';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'true',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				name: 			'Toronto',
				paletteFamily: 	'94824B',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'16881',
				graphicsetId: 	'12319',
				contentColor: 	'FFFFFF',
				contentBGColor: '94824B',
				a_color: 		'94824B',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '601',
internalId:  '1006',
customField: '1006'
};
webappMappings['1002']=webappMappings['1002-2106abw0x0in2zg1']={
webappId:    '1002',
documentId:  '2106',
internalId:  '2106abw0x0in2zg1',
customField: 'icq=false'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '2201',
internalId:  'location',
customField: 'language:de;country:CH;isIncluded:false;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '175601',
internalId:  '',
customField: '20090413-094127'
};
webappMappings['7008']=webappMappings['7008-255']={
webappId:    '7008',
documentId:  '736',
internalId:  '255',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '601',
internalId:  '',
customField: '20090408-101236'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '652',
internalId:  '',
customField: '20110329-184425'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30601',
internalId:  '',
customField: '20110330-145854'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '215933',
internalId:  '',
customField: '20110224-231855'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '215912',
internalId:  '',
customField: '20110302-115601'
};
webappMappings['1003']=webappMappings['1003-abw0x0in2zg112e59b8e834']={
webappId:    '1003',
documentId:  '215933',
internalId:  'abw0x0in2zg112e59b8e834',
customField: 'de:CH'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '211512',
internalId:  '',
customField: '20110210-223328'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '211912',
internalId:  '',
customField: '20110224-221912'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '168601',
internalId:  '',
customField: '20110330-150802'
};
webappMappings['4001']=webappMappings['4001-32713753']={
webappId:    '4001',
documentId:  '212812',
internalId:  '32713753',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '212812',
internalId:  '',
customField: '20110212-073437'
};
webappMappings['1501']=webappMappings['1501-16461281']={
webappId:    '1501',
documentId:  '601',
internalId:  '16461281',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '172401',
internalId:  '',
customField: '20090220-223651'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '221412',
internalId:  '',
customField: '20110501-090219'
};
webappMappings['8002']=webappMappings['8002-search']={
webappId:    '8002',
documentId:  '209912',
internalId:  'search',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '211533',
internalId:  '',
customField: '20110330-150617'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '167901',
internalId:  '',
customField: '20100612-085155'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2106',
internalId:  '',
customField: '20070816-224833'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2101',
internalId:  '',
customField: '20070816-224833'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '736',
internalId:  '',
customField: '20110330-155114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '209912',
internalId:  '',
customField: '20110331-140723'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2201',
internalId:  '',
customField: '20070816-225127'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '175601',
internalId:  'routing',
customField: 'de_CH'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '167801',
internalId:  '',
customField: '20110331-141341'
};
webappMappings['7008']=webappMappings['7008-9738']={
webappId:    '7008',
documentId:  '206912',
internalId:  '9738',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '206912',
internalId:  '',
customField: '20110330-152220'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0IN2ZG1';
var companyName   = 'Double+K+Ranch';
var htmlTitle	  = 'westernreiten%2C+pferdetrekking%2C+verkaufspferde';
var metaKeywords  = 'Westernreiten+Pferdetrekking+Wanderreiten++Westernreitunterricht+Ranchurlaub++Ranch+Reiturlaub+Reitferien+Westernranch+Quarterhorse+Painthorse+Double+K+Ranch+kk-ranch++';
var metaContents  = 'Westernreiten++Westernreitunterricht+Wanderreiten+Westernranch+Ranchurlaub+Reitferien+Reiturlaub+Pferdetrekking+Quarterhorse+Painthorse+Double+K+Ranch+kk-ranch';
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();
};

