/* [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','401',jdecode('Home'),jdecode(''), jdecode('%2F401.html'), 'true',[],'',''],
	['PAGE','29801',jdecode('Actu'),jdecode(''), jdecode('%2F29801.html'), 'true',[],'',''],
	['PAGE','473',jdecode('Pr%C3%A9sentation'),jdecode(''), jdecode('%2F473.html'), 'true',[],'',''],
	['PAGE','494',jdecode('Agenda'),jdecode(''), jdecode('%2F494.html'), 'true',[],'',''],
	['PAGE','620',jdecode('JSMC+2011'),jdecode(''), jdecode('%2F620.html'), 'true',[],'',''],
	['PAGE','515',jdecode('Membres'),jdecode(''), jdecode('%2F515.html'), 'true',[],'',''],
	['PAGE','578',jdecode('Directeur'),jdecode(''), jdecode('%2F578.html'), 'true',[],'',''],
	['PAGE','599',jdecode('Ecole+de+musique'),jdecode(''), jdecode('%2F599.html'), 'true',[],'',''],
	['PAGE','641',jdecode('Les+amis+de+l%26%23x27%3BInd%C3%A9pendante'),jdecode(''), jdecode('%2F641.html'), 'true',[],'',''],
	['PAGE','662',jdecode('Sponsors'),jdecode(''), jdecode('%2F662.html'), 'true',[],'',''],
	['PAGE','683',jdecode('Photos'),jdecode(''), jdecode('%2F683.html'), 'true',[],'',''],
	['PAGE','16401',jdecode('Liens'),jdecode(''), jdecode('%2F16401.html'), 'true',[],'',''],
	['PAGE','17201',jdecode('Forum'),jdecode(''), jdecode('%2F17201.html'), 'true',[],'',''],
	['PAGE','5406',jdecode('Livre+d%26%23x27%3Bor'),jdecode(''), jdecode('%2F5406%2Findex.html'), 'true',[ 
		['PAGE','5401',jdecode('Entr%C3%A9es'),jdecode(''), jdecode('%2F5406%2F5401.html'), 'false',[],'','']
	],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Blues';
theSitetree.paletteFamily='FC0707';
theSitetree.keyvisualId='2757';
theSitetree.keyvisualName='tromp.jpg';
theSitetree.fontsetId='10569';
theSitetree.graphicsetId='10701';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'fr',
  country: 'FR'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MS'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Blues',
				paletteFamily: 	'FC0707',
				keyvisualId: 	'2757',
				keyvisualName: 	'tromp.jpg',
				fontsetId: 		'10569',
				graphicsetId: 	'10701',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FC0707',
				e_color: 		'FC0707',
				f_color: 		'FC0707',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['1002']=webappMappings['1002-5406abw0x0in2w8i']={
webappId:    '1002',
documentId:  '5406',
internalId:  '5406abw0x0in2w8i',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20100919-192323'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29801',
internalId:  '',
customField: '20110419-151604'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20100919-191650'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '494',
internalId:  '',
customField: '20110419-151757'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '515',
internalId:  '',
customField: '20101119-131030'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '578',
internalId:  '',
customField: '20101115-070402'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '599',
internalId:  '',
customField: '20100411-151337'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '641',
internalId:  '',
customField: '20100118-170259'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '662',
internalId:  '',
customField: '20100131-172843'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '620',
internalId:  '',
customField: '20110130-195402'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '683',
internalId:  '',
customField: '20070305-155320'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16401',
internalId:  '',
customField: '20080923-212301'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17201',
internalId:  '',
customField: '20071209-101755'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5406',
internalId:  '',
customField: '20060927-223642'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5401',
internalId:  '',
customField: '20060927-223642'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0IN2W8I';
var companyName   = 'Fanfare+Ind%C3%A9pendante';
var htmlTitle	  = 'Ind%C3%A9pendante+de+Charrat+-+site+officiel+de+notre+soci%C3%A9t%C3%A9';
var metaKeywords  = 'fanfare+ind%EF%BF%BDpendante+charrat+brass+band+concert+Ind%EF%BF%BDpendante';
var metaContents  = 'Site+officiel+de+la+fanfare+Ind%EF%BF%BDpendante+de+Charrat.+Formation+Brass+Band+de+2%EF%BF%BDme+cat%EF%BF%BDgorie+dirig%EF%BF%BDe+par+M.+Fr%EF%BF%BDd%EF%BF%BDric+Th%EF%BF%BDodoloz+et+pr%EF%BF%BDsid%EF%BF%BDe+par+Marion+Giroud.';
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();
};

