/* [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','1001',jdecode('Home'),jdecode(''), jdecode('%2F1001.html'), 'true',[],'',''],
	['PAGE','1052',jdecode('Concept'),jdecode(''), jdecode('%2F1052.html'), 'true',[],'',''],
	['PAGE','8001',jdecode('Communication'),jdecode(''), jdecode('%2F8001.html'), 'true',[],'',''],
	['PAGE','1073',jdecode('Basic'),jdecode(''), jdecode('%2F1073.html'), 'true',[],'',''],
	['PAGE','8022',jdecode('Versatility+%2F+Sport'),jdecode(''), jdecode('%2F8022.html'), 'true',[],'',''],
	['PAGE','38901',jdecode('Students'),jdecode(''), jdecode('%2F38901.html'), 'true',[],'',''],
	['PAGE','7701',jdecode('Coaching'),jdecode(''), jdecode('%2F7701.html'), 'true',[],'',''],
	['PAGE','77801',jdecode('Cowhorse+Clinics'),jdecode(''), jdecode('%2F77801%2Findex.html'), 'true',[ 
		['PAGE','81701',jdecode('Sarnen+06.02.11'),jdecode(''), jdecode('%2F77801%2F81701.html'), 'true',[],'',''],
		['PAGE','83001',jdecode('Sarnen+20.02.11'),jdecode(''), jdecode('%2F77801%2F83001.html'), 'true',[],'',''],
		['PAGE','85001',jdecode('Sarnen+06.03.11'),jdecode(''), jdecode('%2F77801%2F85001.html'), 'true',[],'',''],
		['PAGE','86701',jdecode('Sarnen+20.03.11'),jdecode(''), jdecode('%2F77801%2F86701.html'), 'true',[],'','']
	],'',''],
	['PAGE','7722',jdecode('Links+Contacts'),jdecode(''), jdecode('%2F7722.html'), 'true',[],'','']];
var siteelementCount=13;
theSitetree.topTemplateName='Delta';
theSitetree.paletteFamily='453102';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10615';
theSitetree.graphicsetId='10812';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='453102';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MS'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Delta',
				paletteFamily: 	'453102',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10615',
				graphicsetId: 	'10812',
				contentColor: 	'FFFFFF',
				contentBGColor: '453102',
				a_color: 		'856417',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1001',
internalId:  '',
customField: '20120124-105154'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8022',
internalId:  '',
customField: '20111002-073828'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1052',
internalId:  '',
customField: '20100705-172403'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8001',
internalId:  '',
customField: '20090730-164107'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1073',
internalId:  '',
customField: '20100726-111243'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38901',
internalId:  '',
customField: '20101031-144016'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7701',
internalId:  '',
customField: '20110908-150142'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7722',
internalId:  '',
customField: '20110630-125233'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '77801',
internalId:  '',
customField: '20120108-131113'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '83001',
internalId:  '',
customField: '20110220-202457'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '81701',
internalId:  '',
customField: '20110209-204514'
};
webappMappings['7060']=webappMappings['7060-c367b2412f5ef9fa0d3a95eed6c04b30']={
webappId:    '7060',
documentId:  '81701',
internalId:  'c367b2412f5ef9fa0d3a95eed6c04b30',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '85001',
internalId:  '',
customField: '20110312-165540'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '86701',
internalId:  '',
customField: '20110327-201530'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0IN2XAN';
var companyName   = 'INDIVIDUAL+HORSEMANSHIP';
var htmlTitle	  = 'Horsemanship';
var metaKeywords  = 'Horsemanship+Westernreiten+Bodenarbeit+Pferdeausbildung+Reitstunde+Doppellonge+Freiheitsdressur+Dressur+Quarterhorse+Cowboy+Jungpferde+Reiten+Ausbildung+Natur+nat%C3%BCrlich+Western+Freiheitsdressur+Dressurreiten+Doppellonge+Natur+Dressur+Pferd+Sattel+Konzept+Mensch+Beziehung+Vertrauen+Luzern+Rothenburg+Zentralschweiz';
var metaContents  = 'Horsemanship+Westernreiten+Bodenarbeit+Pferdeausbildung+Reitstunde+Doppellonge+Freiheitsdressur+Dressur+Quarterhorse+Cowboy+Jungpferde+Reiten+Ausbildung+Natur+nat%C3%BCrlich+Western+Freiheitsdressur+Dressurreiten+Doppellonge+Natur+Dressur+Pferd+Sattel+Konzept+Mensch+Beziehung+Vertrauen+Luzern+Rothenburg+Zentralschweiz';
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();
};

