/* [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','801',jdecode('Home'),jdecode(''),'/801.html','true',[],'',''],
	['PAGE','852',jdecode('Methodik'),jdecode(''),'/852.html','true',[],'',''],
	['PAGE','873',jdecode('Pferd+-+Mensch'),jdecode(''),'/873.html','true',[],'',''],
	['PAGE','60301',jdecode('Hund+-+Mensch'),jdecode(''),'/60301.html','true',[],'',''],
	['PAGE','127301',jdecode('Fahren+'),jdecode(''),'/127301.html','true',[],'',''],
	['PAGE','123701',jdecode('Berichte'),jdecode(''),'/123701.html','true',[],'',''],
	['PAGE','84201',jdecode('Kunden'),jdecode(''),'/84201.html','true',[],'',''],
	['PAGE','69401',jdecode('Galerie'),jdecode(''),'/69401.html','true',[],'',''],
	['PAGE','128701',jdecode('Videos'),jdecode(''),'/128701.html','true',[],'',''],
	['PAGE','154801',jdecode('Freiberger+SINA'),jdecode(''),'/154801.html','true',[],'',''],
	['PAGE','148301',jdecode('Shop'),jdecode(''),'/148301.html','true',[],'',''],
	['PAGE','125101',jdecode('Kontakt'),jdecode(''),'/125101.html','true',[],'',''],
	['PAGE','69306',jdecode('G%C3%A4stebuch'),jdecode(''),'/69306.html','true',[],'',''],
	['PAGE','84222',jdecode('Links'),jdecode(''),'/84222.html','true',[],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Unity';
theSitetree.paletteFamily='3A79C9';
theSitetree.keyvisualId='11841';
theSitetree.keyvisualName='kv_11841.jpg';
theSitetree.fontsetId='33133';
theSitetree.graphicsetId='14076';
theSitetree.contentColor='363636';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Unity',
				paletteFamily: 	'3A79C9',
				keyvisualId: 	'11841',
				keyvisualName: 	'kv_11841.jpg',
				fontsetId: 		'33133',
				graphicsetId: 	'14076',
				contentColor: 	'363636',
				contentBGColor: 'FFFFFF',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '801',
internalId:  '',
customField: '20101204-192622'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '852',
internalId:  '',
customField: '20101211-115306'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '801',
internalId:  '1006',
customField: '1006'
};
webappMappings['1002']=webappMappings['1002-69306abw0x0in2m3n']={
webappId:    '1002',
documentId:  '69306',
internalId:  '69306abw0x0in2m3n',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '873',
internalId:  '',
customField: '20091120-162000'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '60301',
internalId:  '',
customField: '20091120-162433'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '127301',
internalId:  '',
customField: '20100110-124406'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '123701',
internalId:  '',
customField: '20080207-115945'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '84201',
internalId:  '',
customField: '20091110-180037'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '69401',
internalId:  '',
customField: '20100903-111335'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '128701',
internalId:  '',
customField: '20091120-162857'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '125101',
internalId:  '',
customField: '20091120-162958'
};
webappMappings['7008']=webappMappings['7008-4594']={
webappId:    '7008',
documentId:  '125101',
internalId:  '4594',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '69306',
internalId:  '',
customField: '20091120-163224'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '84222',
internalId:  '',
customField: '20091110-181009'
};
webappMappings['7060']=webappMappings['7060-cd28fc25c030485d853046fcf09cf610']={
webappId:    '7060',
documentId:  '69401',
internalId:  'cd28fc25c030485d853046fcf09cf610',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '148301',
internalId:  '',
customField: '20091120-162926'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '154801',
internalId:  '',
customField: '20100501-172413'
};
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW0X0IN2M3N';
var companyName   = 'SARAH%27S+mobile+Hunde+%26+Pferdeschule+Gstaad';
var htmlTitle	  = 'SARAH%27S+mobile+Hunde+%26+Pferdeschule+Gstaad';
var metaKeywords  = 'Reiten++Kajaken++Natural+Horse+Dogmanship++Klettersteige++Freiberger++Fohlenausbildung++Outdoor+++Touren++Beziehung+Hund+Pferd++Ausbildung++++Problem+Pferde++Problem+Hund+++Hundeschule++Pferdeschule++Westernreiten++Pat+Parelli++Jan+Nijboer++++H%EF%BF%BDngerverladen++Durchbrennen++Schlagen+++Bocken+++Steigen++Beissen++Dominanz++Rangordnung+++Hirarchie+++Fohlen+++Welpen+++Fahrausbildung++Einfahren++Sulky+++Quarterhorse++Pferderassen++Hunderassen+++Beute++Unterordnung++++Natural+Horsemanship++Natural+Dogmanship++Freibergerpferde++++onlineshop++Natural+Horsemanship++Knotenhalfter++Bodenarbeitsseil++Seile++Metcate++String++Carrot+Stick++Problempferde++Problemhunde++Fahren++Kutsche++Jungpferde++Einfahren++Einsp%EF%BF%BDnner++Zweisp%EF%BF%BDnner+++Gstaad+Saanen+Lauenen+Berner+Oberland+Gsteig+Thun++Bern+Interlaken';
var metaContents  = 'SARAH%27s+mobile+Hunde+%26Pferdeschule+in+Gstaad.+Pferde-+und+Hundegerechte+Ausbildung%2C+Problembehandlungen+und+kreatives+Arbeiten+im+Natural+Horsemanship+und+Natural+Dogmanship.';
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();
};

