/* [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','901',jdecode('Page+d%26%23x27%3Baccueil'),jdecode(''), jdecode('%2F901.html'), 'true',[],'',''],
	['PAGE','5301',jdecode('Qui+sommes-nous'),jdecode(''), jdecode('%2F5301.html'), 'true',[],'',''],
	['PAGE','5322',jdecode('Historique+du+groupe'),jdecode(''), jdecode('%2F5322.html'), 'true',[],'',''],
	['PAGE','144301',jdecode('Dates+2011+%C3%A0+retenir'),jdecode(''), jdecode('%2F144301.html'), 'true',[],'',''],
	['PAGE','189001',jdecode('Dates+2012+%C3%A0+retenir'),jdecode(''), jdecode('%2F189001.html'), 'true',[],'',''],
	['PAGE','203201',jdecode('Dates+2013+%C3%A0+retenir'),jdecode(''), jdecode('%2F203201.html'), 'true',[],'',''],
	['PAGE','172001',jdecode('Vidy+2012'),jdecode(''), jdecode('%2F172001.html'), 'true',[],'',''],
	['PAGE','5364',jdecode('Photos+1'),jdecode(''), jdecode('%2F5364.html'), 'true',[],'',''],
	['PAGE','101701',jdecode('Photos+2'),jdecode(''), jdecode('%2F101701.html'), 'true',[],'',''],
	['PAGE','190301',jdecode('Photos+3'),jdecode(''), jdecode('%2F190301.html'), 'true',[],'',''],
	['PAGE','95101',jdecode('A+vous+de+choisir'),jdecode(''), jdecode('%2F95101.html'), 'true',[],'',''],
	['PAGE','27801',jdecode('R%C3%A9f%C3%A9rences'),jdecode(''), jdecode('%2F27801.html'), 'true',[],'',''],
	['PAGE','173701',jdecode('Nos+Amis+Musiciens'),jdecode(''), jdecode('%2F173701.html'), 'true',[],'',''],
	['PAGE','162301',jdecode('Articles+de+presse'),jdecode(''), jdecode('%2F162301.html'), 'true',[],'',''],
	['PAGE','125101',jdecode('Demandez+une+offre'),jdecode(''), jdecode('%2F125101.html'), 'true',[],'',''],
	['PAGE','61506',jdecode('Livre+d%26%23x27%3Bor'),jdecode(''), jdecode('%2F61506%2Findex.html'), 'true',[ 
		['PAGE','61501',jdecode('Entr%C3%A9es'),jdecode(''), jdecode('%2F61506%2F61501.html'), 'true',[],'','']
	],'',''],
	['PAGE','72901',jdecode('Nos+remerciements+%C3%A0%3A'),jdecode(''), jdecode('%2F72901.html'), 'true',[],'','']];
var siteelementCount=18;
theSitetree.topTemplateName='Music';
theSitetree.paletteFamily='FF0000';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10715';
theSitetree.graphicsetId='10818';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'fr',
  country: 'FR'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MX'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Music',
				paletteFamily: 	'FF0000',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10715',
				graphicsetId: 	'10818',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FF0000',
				e_color: 		'777676',
				f_color: 		'777676',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '901',
internalId:  '',
customField: '20110306-105348'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '173701',
internalId:  '',
customField: '20111207-165927'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '901',
internalId:  '1006',
customField: '1006'
};
webappMappings['1002']=webappMappings['1002-61506abw0x0in2g8v']={
webappId:    '1002',
documentId:  '61506',
internalId:  '61506abw0x0in2g8v',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '172001',
internalId:  '',
customField: '20110915-092621'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '203201',
internalId:  '-',
customField: '20120204-090628'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5301',
internalId:  '',
customField: '20100523-141011'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5322',
internalId:  '',
customField: '20090217-144905'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '125101',
internalId:  '',
customField: '20090719-180357'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '190301',
internalId:  '',
customField: '20110413-180837'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5364',
internalId:  '',
customField: '20080808-160000'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '101701',
internalId:  '',
customField: '20081103-151411'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '95101',
internalId:  '',
customField: '20080417-125653'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27801',
internalId:  '',
customField: '20101111-065921'
};
webappMappings['7008']=webappMappings['7008-6661']={
webappId:    '7008',
documentId:  '125101',
internalId:  '6661',
customField: 'language:fr;country:FR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '61506',
internalId:  '',
customField: '20070523-181502'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '61501',
internalId:  '',
customField: '20070523-181502'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '72901',
internalId:  '',
customField: '20110518-085606'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '144301',
internalId:  '',
customField: '20111101-094854'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '162301',
internalId:  '',
customField: '20100905-140727'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '189001',
internalId:  '',
customField: '20120202-080550'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW0X0IN2G8V';
var companyName   = 'MIDNIGHT+Orchestre';
var htmlTitle	  = 'Bienvenue+sur+le+site+de+MIDNIGHT+Orchestre';
var metaKeywords  = 'r%C3%A9servations+6+mois+%C3%A0+une+ann%C3%A9e++++http%3A%2F%2Fwww.midnight-orchestre.ch++';
var metaContents  = 'Midnight+Orchestre++Le+c%C3%A9l%C3%A8bre+Trio++a+voir+et+%C3%A0+entendre++Production+en+Suisse-France-Allemagne++http%3A%2F%2Fwww.midnight-orchestre.ch++';
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();
};

