/* [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 theSitetree=[ 
	['PAGE','9101',jdecode('Page+d%26%23x27%3Baccueil'),jdecode(''),'/9101.html','true',[],''],
	['PAGE','19201',jdecode('Activit%C3%A9s+de+jardinage'),jdecode(''),'/19201/index.html','true',[ 
		['PAGE','19222',jdecode('Cr%C3%A9ation+'),jdecode(''),'/19201/19222.html','true',[],''],
		['PAGE','19243',jdecode('Entretien'),jdecode(''),'/19201/19243.html','true',[],'']
	],''],
	['PAGE','19264',jdecode('R%C3%A9alisations+'),jdecode(''),'/19264.html','true',[],''],
	['PAGE','9152',jdecode('Portrait'),jdecode(''),'/9152.html','true',[],''],
	['PAGE','37201',jdecode('Contacts'),jdecode(''),'/37201.html','true',[],'']];
var siteelementCount=7;
theSitetree.topTemplateName='Blog';
theSitetree.paletteFamily='649B30';
theSitetree.keyvisualId='11526';
theSitetree.keyvisualName='kv_11526.jpg';
theSitetree.fontsetId='32865';
theSitetree.graphicsetId='13949';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='989696';
var localeDef={
  language: 'fr',
  country: 'FR'
};
var theTemplate={
				name: 			'Blog',
				paletteFamily: 	'649B30',
				keyvisualId: 	'11526',
				keyvisualName: 	'kv_11526.jpg',
				fontsetId: 		'32865',
				graphicsetId: 	'13949',
				contentColor: 	'FFFFFF',
				contentBGColor: '989696',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'FFB434',
				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:  '9101',
internalId:  '',
customField: '20090513-172405'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9152',
internalId:  '',
customField: '20090506-130803'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '9101',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37201',
internalId:  '',
customField: '20090506-093621'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19201',
internalId:  '',
customField: '20090513-203345'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19222',
internalId:  '',
customField: '20090513-222845'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19243',
internalId:  '',
customField: '20090528-163143'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19264',
internalId:  '',
customField: '20090506-153718'
};
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW330INEOR9';
var companyName   = 'Rappaysages';
var htmlTitle	  = 'Rappaysages%2C+M.+Rapp+est+paysagiste+et+horticulteur+%C3%A0+Vufflens-la-Ville.+Il+est+sp%C3%A9cialiste+en+jardinage%2C+conception+et+am%C3%A9nagement+de+jardin.';
var metaKeywords  = 'Rappaysages%2C+Vufflens-la-ville%2C+Rapp%2C+Pierre-Alain%2C+Jardinage%2C+Jardin%2C+Tonte%2C+Gazon%2C+Romandie%2C+Mur%2C+Maison%2C+amenagement%2C+Revetement%2C+dallage%2C+pavage%2C+mur%2C+escaliers%2C+clotures%2C+biotope%2C+bassin%2C+soin+du+gazon%2C+la+taille%2C+la+taille+des+haies%2C+plantation%2C+entretien+et+creation+de+massifs%2C+potager%2C+Horticulteur%2C+paysagiste%2C+conception%2C+rose%2C+fleurs%2C+arbre%2C+lausanne%2C+Vaud';
var metaContents  = 'Pierre-Alain+Rapp%2C+Horticulteur+-+Paysagiste%2C+detenteur+du+brevet+federal%2C+est+specialiste+dans+conception%2C+amenagement+et+entretien+de+jardins.+Il+a+ouvert+son+entreprise+de+jardinage+en+1998+et+depuis+il+a+accompli+de+nombreux+projets+de+jardinage+dans+la+region+romandie+et+surtout+%EF%BF%BD+vufflens-la-ville.+';
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();
};

