/* [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','4630',jdecode('Edito'),jdecode(''),'/4630.html','true',[],'',''],
	['PAGE','4519',jdecode('K%C3%A9sako+la+Gazette+%3F'),jdecode(''),'/4519.html','true',[],'',''],
	['PAGE','4576',jdecode('Pyrrhon+and+Co'),jdecode(''),'/4576.html','true',[],'',''],
	['PAGE','4603',jdecode('L%26%23x27%3B%C3%A9quipe'),jdecode(''),'/4603.html','true',[],'',''],
	['PAGE','4711',jdecode('Archives+et+Extraits'),jdecode(''),'/4711.html','true',[],'',''],
	['PAGE','9266',jdecode('%C3%89v%C3%A9nements'),jdecode(''),'/9266.html','true',[],'',''],
	['PAGE','4684',jdecode('Abonnement'),jdecode(''),'/4684.html','true',[],'',''],
	['PAGE','5601',jdecode('Nous+contacter'),jdecode(''),'/5601.html','true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Comedy';
theSitetree.paletteFamily='4871C0';
theSitetree.keyvisualId='2805';
theSitetree.keyvisualName='blanko.jpg';
theSitetree.fontsetId='10422';
theSitetree.graphicsetId='10722';
theSitetree.contentColor='EBEFF8';
theSitetree.contentBGColor='698BCB';
var localeDef={
  language: 'fr',
  country: 'FR'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Comedy',
				paletteFamily: 	'4871C0',
				keyvisualId: 	'2805',
				keyvisualName: 	'blanko.jpg',
				fontsetId: 		'10422',
				graphicsetId: 	'10722',
				contentColor: 	'EBEFF8',
				contentBGColor: '698BCB',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'36599C',
				e_color: 		'36599C',
				f_color: 		'36599C',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4630',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4519',
internalId:  '',
customField: '20060711-180622'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9266',
internalId:  '',
customField: '20091125-215027'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4684',
internalId:  '',
customField: '20090430-155821'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4630',
internalId:  '',
customField: '20091125-213949'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4603',
internalId:  '',
customField: '20091125-214038'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4711',
internalId:  '',
customField: '20091125-214158'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5601',
internalId:  '',
customField: '20090519-104704'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4576',
internalId:  '',
customField: '20060222-163816'
};
webappMappings['7008']=webappMappings['7008-5200']={
webappId:    '7008',
documentId:  '5601',
internalId:  '5200',
customField: 'language:fr;country:FR;'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INX2T6';
var companyName   = 'La+Gazette+et+Tic+et+Toc...';
var htmlTitle	  = 'La+Gazette+et+tic+et+toc...Le+petit+organe+intelligent+-+Revue+trimestrielle+vendue+au+prix+de+4%E2%82%AC+-+5.50+CHF';
var metaKeywords  = 'La+Gazette+et+tic+et+toc...%2C+Gazette%2C+Zurich%2C+Z%EF%BF%BDt%EF%BF%BDtique%2C+Groupe+Actif+de+Z%EF%BF%BDt%EF%BF%BDtique%2C+Tic%2C+Toc%2C+Gazeti%EF%BF%BDre%2C+Anne+Devaux%2C+Gabrielle+Cloutier%2C';
var metaContents  = 'Groupe+Actif+de+Z%EF%BF%BDt%EF%BF%BDtique+%EF%BF%BDditeur+de+La+Gazette+et+Tic+et+Toc...+revue+trimestrielle%2C+recherches+et+r%EF%BF%BDflexion';
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();
};
