/* [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','4606',jdecode('ETRP'),jdecode(''),'/4606/index.html','true',[ 
		['PAGE','87204',jdecode('Historique'),jdecode(''),'/4606/87204.html','true',[],'','']
	],'',''],
	['PAGE','87258',jdecode('Enseignement'),jdecode(''),'/87258/index.html','true',[ 
		['PAGE','87285',jdecode('Etudes'),jdecode(''),'/87258/87285.html','true',[],'',''],
		['PAGE','92930',jdecode('Direction'),jdecode(''),'/87258/92930.html','true',[],'','']
	],'',''],
	['PAGE','87231',jdecode('Inscriptions'),jdecode(''),'/87231.html','true',[],'',''],
	['PAGE','166352',jdecode('Itin%C3%A9raire'),jdecode(''),'/166352/index.html','true',[ 
		['PAGE','114703',jdecode('Acc%C3%A8s'),jdecode(''),'/166352/114703.html','true',[],'','']
	],'',''],
	['PAGE','204606',jdecode('Liens'),jdecode(''),'/204606.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Logg';
theSitetree.paletteFamily='1D6C89';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='421';
theSitetree.graphicsetId='469';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='1D6C89';
var localeDef={
  language: 'fr',
  country: 'FR'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Logg',
				paletteFamily: 	'1D6C89',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'421',
				graphicsetId: 	'469',
				contentColor: 	'FFFFFF',
				contentBGColor: '1D6C89',
				a_color: 		'1D6C89',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '166352',
internalId:  'routing',
customField: 'fr_FR'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '92930',
internalId:  '',
customField: '20090601-190916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '87231',
internalId:  '',
customField: '20090614-042707'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '87285',
internalId:  '',
customField: '20090614-044405'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '114703',
internalId:  'location',
customField: 'language:fr;country:FR;isIncluded:false;'
};
webappMappings['7008']=webappMappings['7008-764']={
webappId:    '7008',
documentId:  '87285',
internalId:  '764',
customField: 'language:fr;country:FR;'
};
webappMappings['7008']=webappMappings['7008-765']={
webappId:    '7008',
documentId:  '87231',
internalId:  '765',
customField: 'language:fr;country:FR;'
};
webappMappings['1009']=webappMappings['1009-4565547']={
webappId:    '1009',
documentId:  '160123',
internalId:  '4565547',
customField: 'isFollowupPage:true;documentId:87231;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4606',
internalId:  '',
customField: '20090614-043051'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '87258',
internalId:  '',
customField: '20090601-183243'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '87204',
internalId:  '',
customField: '20100208-111544'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '160123',
internalId:  '',
customField: '20050506-025749'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '166352',
internalId:  '',
customField: '20060823-052642'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '114703',
internalId:  '',
customField: '20090601-183502'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '204606',
internalId:  '',
customField: '20100208-112746'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4606',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW0X0INXX2A';
var companyName   = '%C3%89COLE+TRADITIONNELLE+RUSSE+DE+PIANO+-+ETRP';
var htmlTitle	  = 'Ecole+Traditionnelle+Russe+de+Piano';
var metaKeywords  = 'Ecole+de+piano%2C+piano%2C+Ecole+russe+de+piano%2C+Master+class%2C+Stage+de+piano%2C+Djordje+Milojkovic%2C+Arbo+Valdma%2C+Acad%C3%A9mie+Internationale+de+Piano+Arbo+Valdma%2C+Goldenweiser%2C+Igoumnov%2C+Neuhaus%2C+Richter%2C+Guilels%2C+Lupu%2C+Ashkenazy%2C+Davidovich%2C+Bashkirov%2C+Berman';
var metaContents  = 'L%C3%A9cole+russe+de+piano+en+Suisse%21+Offrir+aux+%C3%A9l%C3%A8ves+professionnels+et+non+professionnels+une+p%C3%A9dagogie+repens%C3%A9e%2C+donn%C3%A9e+par+des+ma%C3%AEtres+les+plus+c%C3%A9l%C3%A8bres+de+l%C3%A9cole+russe+de+piano+%28Goldenweiser%2C+Igoumnov++Neuhaus%29.+Acad%C3%A9mie+Internationale+de+Piano+Arbo+Valdma';
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();
};
