/* [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','1801',jdecode('Startseite'),jdecode(''), jdecode('%2F1801.html'), 'true',[],'',''],
	['PAGE','23701',jdecode('%C3%9Cber+uns'),jdecode(''), jdecode('%2F23701.html'), 'true',[],'',''],
	['PAGE','37701',jdecode('News'),jdecode(''), jdecode('%2F37701.html'), 'true',[],'',''],
	['PAGE','1852',jdecode('Rocky+Mountain+Horse+%28RMH%29'),jdecode(''), jdecode('%2F1852%2Findex.html'), 'true',[ 
		['PAGE','40801',jdecode('Registrierung'),jdecode(''), jdecode('%2F1852%2F40801.html'), 'true',[],'',''],
		['PAGE','42422',jdecode('Die+Papiere'),jdecode(''), jdecode('%2F1852%2F42422.html'), 'true',[],'',''],
		['PAGE','42401',jdecode('Grade+Mares'),jdecode(''), jdecode('%2F1852%2F42401.html'), 'true',[],'',''],
		['PAGE','42443',jdecode('Zuchtzulassung'),jdecode(''), jdecode('%2F1852%2F42443.html'), 'true',[],'','']
	],'',''],
	['PAGE','7601',jdecode('Der+%26%23x27%3Bspezielle%26%23x27%3B+Gang'),jdecode(''), jdecode('%2F7601.html'), 'true',[],'',''],
	['PAGE','10401',jdecode('Die+Augen'),jdecode(''), jdecode('%2F10401.html'), 'true',[],'',''],
	['PAGE','5043',jdecode('Unsere+Zucht'),jdecode(''), jdecode('%2F5043.html'), 'true',[],'',''],
	['PAGE','6822',jdecode('Haltung+und+Aufzucht'),jdecode(''), jdecode('%2F6822.html'), 'true',[],'',''],
	['PAGE','6101',jdecode('Verkaufspferde'),jdecode(''), jdecode('%2F6101%2Findex.html'), 'true',[ 
		['PAGE','56101',jdecode('USF+Merlin+Rain+-verkauft-'),jdecode(''), jdecode('%2F6101%2F56101.html'), 'true',[],'',''],
		['PAGE','56401',jdecode('USF+Boomer'),jdecode(''), jdecode('%2F6101%2F56401.html'), 'false',[],'',''],
		['PAGE','56422',jdecode('USF+Winston+Rain'),jdecode(''), jdecode('%2F6101%2F56422.html'), 'false',[],'',''],
		['PAGE','56443',jdecode('USF+Bentley+Rain'),jdecode(''), jdecode('%2F6101%2F56443.html'), 'false',[],'','']
	],'',''],
	['PAGE','14301',jdecode('Andere+Tiere'),jdecode(''), jdecode('%2F14301.html'), 'true',[],'',''],
	['PAGE','2001',jdecode('F%C3%BCr+unsere+G%C3%A4ste'),jdecode(''), jdecode('%2F2001.html'), 'true',[],'',''],
	['PAGE','5064',jdecode('Kontakt'),jdecode(''), jdecode('%2F5064.html'), 'true',[],'',''],
	['PAGE','23201',jdecode('Lageplan%2FAnfahrt'),jdecode(''), jdecode('%2F23201.html'), 'true',[],'',''],
	['PAGE','26901',jdecode('Impressum'),jdecode(''), jdecode('%2F26901.html'), 'true',[],'',''],
	['PAGE','28701',jdecode('Fotoalbum'),jdecode(''), jdecode('%2F28701.html'), 'false',[],'',''],
	['PAGE','21301',jdecode('Links'),jdecode(''), jdecode('%2F21301.html'), 'true',[],'',''],
	['PAGE','20601',jdecode('G%C3%A4stebuch'),jdecode(''), jdecode('%2F20601.html'), 'true',[],'','']];
var siteelementCount=25;
theSitetree.topTemplateName='Citadel';
theSitetree.paletteFamily='536300';
theSitetree.keyvisualId='8166';
theSitetree.keyvisualName='kv_8166.jpg';
theSitetree.fontsetId='17011';
theSitetree.graphicsetId='12398';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='536300';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'genotec',
  product: 'WSCSYSSSSLY0XYAO'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Citadel',
				paletteFamily: 	'536300',
				keyvisualId: 	'8166',
				keyvisualName: 	'kv_8166.jpg',
				fontsetId: 		'17011',
				graphicsetId: 	'12398',
				contentColor: 	'FFFFFF',
				contentBGColor: '536300',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1801',
internalId:  '',
customField: '20120125-133050'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1852',
internalId:  '',
customField: '20100204-212109'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2001',
internalId:  '',
customField: '20100127-160924'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7601',
internalId:  '',
customField: '20090925-090421'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5043',
internalId:  '',
customField: '20100209-181255'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5064',
internalId:  '',
customField: '20110407-160502'
};
webappMappings['7002']=webappMappings['7002-846']={
webappId:    '7002',
documentId:  '20601',
internalId:  '846',
customField: 'language:de;country:CH;'
};
webappMappings['7008']=webappMappings['7008-973']={
webappId:    '7008',
documentId:  '5064',
internalId:  '973',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6101',
internalId:  '',
customField: '20111231-001349'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6822',
internalId:  '',
customField: '20100104-225824'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10401',
internalId:  '',
customField: '20100716-160446'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14301',
internalId:  '',
customField: '20091109-213054'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1801',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20601',
internalId:  '',
customField: '20091030-235034'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21301',
internalId:  '',
customField: '20100711-151638'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23701',
internalId:  '',
customField: '20120125-131651'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23201',
internalId:  '',
customField: '20110320-163811'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26901',
internalId:  '',
customField: '20100104-133439'
};
webappMappings['7060']=webappMappings['7060-2d6f75ce5e144ec4265a6d5045a6b267']={
webappId:    '7060',
documentId:  '28701',
internalId:  '2d6f75ce5e144ec4265a6d5045a6b267',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28701',
internalId:  '',
customField: '20091118-175620'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37701',
internalId:  '',
customField: '20110415-190513'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40801',
internalId:  '',
customField: '20100210-024503'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42401',
internalId:  '',
customField: '20120125-132759'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42422',
internalId:  '',
customField: '20120125-132709'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42443',
internalId:  '',
customField: '20100716-175050'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56101',
internalId:  '',
customField: '20120101-214503'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56401',
internalId:  '',
customField: '20110613-182856'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56422',
internalId:  '',
customField: '20110613-182856'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56443',
internalId:  '',
customField: '20110613-182856'
};
var webAppHostname = 'cgi.wsc.genotec.ch:80';
var canonHostname = 'wsc.genotec.ch';
var accountId     = 'AGT010IN2RXN';
var companyName   = 'Rocky+Mountain+Horses+auf+La+Ch%C3%A2telaine';
var htmlTitle	  = 'Rocky+Mountain+Horses';
var metaKeywords  = 'Rocky+Mountain+Horses%2C+Rocky+Mountain+Horse%2C+Gangpferde%2C+T%C3%B6lter%2C+Beat+Urben%2C+Ruth+Urben%2C+Z%C3%BCchter%2C+G%C3%A4stezimmer%2C+Pferdehof';
var metaContents  = 'Rocky+Mountain+Horses%2C+Rocky+Mountain+Horse';
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();
};

