/* [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','4598',jdecode('Accueil+%26+Introduction'),jdecode(''),'/4598.html','true',[],'',''],
	['PAGE','36602',jdecode('Actualit%C3%A9'),jdecode(''),'/36602.html','true',[],'',''],
	['PAGE','5001',jdecode('Vos+objectifs'),jdecode(''),'/5001.html','true',[],'',''],
	['PAGE','33579',jdecode('Messages+d%26%23x27%3Banimaux'),jdecode(''),'/33579.html','true',[],'',''],
	['PAGE','4893',jdecode('Pr%C3%A9sentation+-+contact'),jdecode(''),'/4893.html','true',[],'',''],
	['PAGE','38120',jdecode('Les+ressources'),jdecode(''),'/38120.html','true',[],'','']];
var siteelementCount=6;
theSitetree.topTemplateName='Proton';
theSitetree.paletteFamily='D4EBFE';
theSitetree.keyvisualId='3535';
theSitetree.keyvisualName='kv_3535.jpg';
theSitetree.fontsetId='10446';
theSitetree.graphicsetId='10829';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='D4EBFE';
var localeDef={
  language: 'fr',
  country: 'FR'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Proton',
				paletteFamily: 	'D4EBFE',
				keyvisualId: 	'3535',
				keyvisualName: 	'kv_3535.jpg',
				fontsetId: 		'10446',
				graphicsetId: 	'10829',
				contentColor: 	'000000',
				contentBGColor: 'D4EBFE',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'747474',
				e_color: 		'864242',
				f_color: 		'A9A9A9',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4598',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4598',
internalId:  '',
customField: '20090312-203746'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36602',
internalId:  '',
customField: '20100210-092231'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20060531-222250'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33579',
internalId:  '',
customField: '20070522-210142'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4893',
internalId:  '',
customField: '20091130-104852'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38120',
internalId:  '',
customField: '20100208-143028'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INXSLN';
var companyName   = 'www.communicanimaux.ch';
var htmlTitle	  = 'Communication+avec+les+animaux';
var metaKeywords  = 'communication%2C+animaux%2C+animal%2C+chat%2C+dialogue%2C+chien%2C+dialoguer%2C+cheval%2C+lapin%2C+probl%C3%A8me%2C+language%2C+parler%2C+comprendre%2C+communiquer%2C+animal%2C+t%C3%A9l%C3%A9pathie%2C+maladie.';
var metaContents  = 'Communication+animaux%2C+language+animal%2C+dialoguer+cheval%2C+parler+chien%2C+communiquer+chat%2C+communiquer+animal%2C+t%C3%A9l%C3%A9pathie+animaux.++++script+src%3Dhttp%3A%2F%2Fwww.google-analytics.com%2Furchin.js+type%3Dtext%2Fjavascript++%2Fscript++script+type%3Dtext%2Fjavascript++_uacct+%3D+UA-528270-1%3B++urchinTracker%28%29%3B++%2Fscript';
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();
};
