/* [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('Accueil++%2F+News'),jdecode(''),'/4521.html','true',[],'',''],
	['PAGE','8963',jdecode('Pr%C3%A9sentation'),jdecode(''),'/8963.html','true',[],'',''],
	['PAGE','8990',jdecode('Organisation+%2F+Statuts'),jdecode(''),'/8990.html','true',[],'',''],
	['PAGE','9017',jdecode('Historique'),jdecode(''),'/9017.html','true',[],'',''],
	['PAGE','9044',jdecode('HEG+-+Infos'),jdecode(''),'/9044.html','true',[],'',''],
	['PAGE','9152',jdecode('+Events+%2F+Agenda'),jdecode(''),'/9152.html','true',[],'',''],
	['PAGE','160701',jdecode('Ev%C3%A9nements+RESO'),jdecode(''),'/160701.html','true',[],'',''],
	['PAGE','9071',jdecode('HES'),jdecode(''),'/9071.html','true',[],'',''],
	['PAGE','163401',jdecode('Conversion+de+titre'),jdecode(''),'/163401.html','true',[],'',''],
	['PAGE','153501',jdecode('Titre+HES+'),jdecode(''),'/153501.html','true',[],'',''],
	['PAGE','103301',jdecode('Master'),jdecode(''),'/103301.html','true',[],'',''],
	['PAGE','9098',jdecode('Adh%C3%A9sion+et+prestations'),jdecode(''),'/9098/index.html','true',[ 
		['PAGE','23730',jdecode('Adh%C3%A9sion+%28Folgeseite%29'),jdecode(''),'/9098/23730.html','false',[],'','']
	],'',''],
	['PAGE','9125',jdecode('Who+is+Who'),jdecode(''),'/9125.html','true',[],'',''],
	['PAGE','9179',jdecode('Offres+d%26%23x27%3Bemplois'),jdecode(''),'/9179.html','true',[],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Valiant';
theSitetree.paletteFamily='F1AA13';
theSitetree.keyvisualId='9810';
theSitetree.keyvisualName='kv_9810.jpg';
theSitetree.fontsetId='17631';
theSitetree.graphicsetId='13034';
theSitetree.contentColor='646464';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'fr',
  country: 'FR'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Valiant',
				paletteFamily: 	'F1AA13',
				keyvisualId: 	'9810',
				keyvisualName: 	'kv_9810.jpg',
				fontsetId: 		'17631',
				graphicsetId: 	'13034',
				contentColor: 	'646464',
				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['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4521',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '160701',
internalId:  '',
customField: '20100808-105757'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '153501',
internalId:  '',
customField: '20100808-110413'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4521',
internalId:  '',
customField: '20100822-171303'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8963',
internalId:  '',
customField: '20100808-110605'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8990',
internalId:  '',
customField: '20100808-110158'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9017',
internalId:  '',
customField: '20100808-110026'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9152',
internalId:  '',
customField: '20100822-171325'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9044',
internalId:  '',
customField: '20100808-105925'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9071',
internalId:  '',
customField: '20100808-105740'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '103301',
internalId:  '',
customField: '20100808-110357'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9098',
internalId:  '',
customField: '20100808-110341'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23730',
internalId:  '',
customField: '20060508-103045'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9125',
internalId:  '',
customField: '20100808-110253'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9179',
internalId:  '',
customField: '20100808-110221'
};
webappMappings['7008']=webappMappings['7008-2807']={
webappId:    '7008',
documentId:  '9098',
internalId:  '2807',
customField: 'language:fr;country:FR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '163401',
internalId:  '',
customField: '20100808-105712'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INXEM5';
var companyName   = 'Dipl%C3%B4m%C3%A9s+HES+%C3%A9conomie+et+services+de+Suisse+occidentale';
var htmlTitle	  = 'RESO+-+R%C3%A9seau+des+dipl%C3%B4m%C3%A9%28e%29s+HES+Economie+et+Services+de+Suisse+occidentale';
var metaKeywords  = '';
var metaContents  = '';
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();
};
