/* [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','4521',jdecode('Bienvenue'),jdecode(''),'/4521.html','true',[],'',''],
	['PAGE','22985',jdecode('Notre+offre'),jdecode(''),'/22985/index.html','true',[ 
		['PAGE','23012',jdecode('a%29+Chambres+d%26%23x27%3Bh%C3%B4te'),jdecode(''),'/22985/23012.html','true',[],'',''],
		['PAGE','31268',jdecode('b%29+Chambres+d%26%23x27%3B+h%C3%B4te'),jdecode(''),'/22985/31268.html','true',[],'',''],
		['PAGE','23039',jdecode('Aventure+sur+la+paille'),jdecode(''),'/22985/23039.html','true',[],'',''],
		['PAGE','23066',jdecode('H%C3%A9bergement+de+chevaux'),jdecode(''),'/22985/23066.html','true',[],'',''],
		['PAGE','31286',jdecode('Vente+directe%3A+Produits+du+terroir'),jdecode(''),'/22985/31286.html','true',[],'',''],
		['PAGE','31295',jdecode('Paniers+garnis'),jdecode(''),'/22985/31295.html','true',[],'','']
	],'',''],
	['PAGE','31313',jdecode('Loisirs+%26+Activit%C3%A9s'),jdecode(''),'/31313/index.html','true',[ 
		['PAGE','105012',jdecode('b%29+Loisirs+%26+Activit%C3%A9s'),jdecode(''),'/31313/105012.html','true',[],'',''],
		['PAGE','105612',jdecode('c%29+Loisirs+et+activit%C3%A9s'),jdecode(''),'/31313/105612.html','true',[],'','']
	],'',''],
	['PAGE','23093',jdecode('Nos+tarifs'),jdecode(''),'/23093.html','true',[],'',''],
	['PAGE','25268',jdecode('Situation+%26+Plan'),jdecode(''),'/25268.html','true',[],'',''],
	['PAGE','23120',jdecode('Nous+contacter'),jdecode(''),'/23120/index.html','true',[ 
		['PAGE','25571',jdecode('Nous+contacter+%28Folgeseite%29'),jdecode(''),'/23120/25571.html','true',[],'','']
	],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Orchard';
theSitetree.paletteFamily='A6C372';
theSitetree.keyvisualId='11724';
theSitetree.keyvisualName='kv_11724.jpg';
theSitetree.fontsetId='32997';
theSitetree.graphicsetId='14007';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'fr',
  country: 'FR'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Orchard',
				paletteFamily: 	'A6C372',
				keyvisualId: 	'11724',
				keyvisualName: 	'kv_11724.jpg',
				fontsetId: 		'32997',
				graphicsetId: 	'14007',
				contentColor: 	'000000',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31313',
internalId:  '',
customField: '20110306-140056'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4521',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31268',
internalId:  '',
customField: '20110306-142225'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4521',
internalId:  '',
customField: '20110310-162634'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22985',
internalId:  '',
customField: '20110310-161003'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23012',
internalId:  '',
customField: '20110304-145410'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23093',
internalId:  '',
customField: '20110310-145847'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25268',
internalId:  '',
customField: '20090322-123615'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23039',
internalId:  '',
customField: '20110310-193146'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23066',
internalId:  '',
customField: '20110310-165728'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23120',
internalId:  '',
customField: '20090321-125907'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25571',
internalId:  '',
customField: '20050821-172422'
};
webappMappings['7008']=webappMappings['7008-3467']={
webappId:    '7008',
documentId:  '23120',
internalId:  '3467',
customField: 'language:fr;country:FR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '105612',
internalId:  '',
customField: '20110310-145647'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31286',
internalId:  '',
customField: '20110304-153952'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31295',
internalId:  '',
customField: '20110310-145415'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '105012',
internalId:  '',
customField: '20110306-135405'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INXZE9';
var companyName   = 'G%C3%AEte+rural+%C3%A0+Courcelon%2FJU';
var htmlTitle	  = 'G%C3%AEte+rural%3A+T%C3%A8cle+et+Martial+Lachat+%28Jura+%2F+Suisse%29';
var metaKeywords  = 'courcelon+jura+chevaux+hebergement+hote+gite+rural+aventure+paille+tourisme+location+accueil+vacances+agriculture+ferme+campagne+calme+repos+paturages+foret+produits+terroir+specialite+jurassien+jurassienne+chambre+chambres+nuit+dormir';
var metaContents  = 'Chambres+dh%C3%B4tes%2C+aventure+sur+la+paille+et+h%C3%A9bergement+de+chevaux+chez+T%C3%A8cle+et+Martial+Lachat+%C3%A0+Courcelon+%28Jura+suisse%29.';
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();
};

