NavbarItems = Array(3);
NavbarItems[0] = Array(
 Array('2',1, Array(
   Array('450',1, null,'Actualités en bref','/news/categoryfront.php/id/450/Actualit_E9s_en_bref.html','','',0),
   Array('873',1, Array(
     Array('4',1, null,'Banque de données','/news/categoryfront.php/id/4/Banque_de_donn_E9es.html','','',0),
     Array('660',1, null,'Sur les statistiques','/news/categoryfront.php/id/660/Sur_les_statistiques.html','','',0)),'Statistiques','/news/categoryfront.php/id/873/Statistiques.html','','',0),
   Array('7',1, null,'Éditorial','/news/categoryfront.php/id/7/_C9ditorial.html','','',0),
   Array('443',1, Array(
     Array('448',1, null,'Forum/Réunion ministérielle','/news/categoryfront.php/id/448/Forum_R_E9union_minist_E9rielle.html','','',0),
     Array('11',1, null,'OCDE.org','/news/categoryfront.php/id/11/OCDE.org.html','','',0),
     Array('617',1, null,'Nouveaux ambassadeurs','/news/categoryfront.php/id/617/Nouveaux_ambassadeurs.html','','',0),
     Array('730',1, null,'Table ronde ministérielle','/news/categoryfront.php/id/730/Table_ronde_minist_E9rielle.html','','',0)),'OCDE','/news/categoryfront.php/id/443/OCDE.html','','',0),
   Array('20',1, null,'Livres','/news/categoryfront.php/id/20/Livres.html','','',0),
   Array('19',1, null,'Courriers des lecteurs','/news/categoryfront.php/id/19/Courriers_des_lecteurs.html','','',0),
   Array('794',1, null,'Calendrier','http://www.oecd.org/document/38/0,2340,fr_2649_201185_32618790_1_1_1_1,00.html','','',0),
   Array('775',1, null,'ABONNÉS','/news/categoryfront.php/id/775/ABONN_C9S.html','','',1),
   Array('565',1, null,'Frankie.org','/news/categoryfront.php/id/565/Frankie.org.html','','',0)),'Général','/news/categoryfront.php/id/2/G_E9n_E9ral.html','','',0),
 Array('441',1, Array(
   Array('6',1, Array(
     Array('449',1, null,'Général','/news/categoryfront.php/id/449/G_E9n_E9ral.html','','',0),
     Array('564',1, null,'Fiches pays','/news/categoryfront.php/id/564/Fiches_pays.html','','',0)),'Économie','/news/categoryfront.php/id/6/_C9conomie.html','','',0),
   Array('17',1, Array(
     Array('453',1, null,'Général','/news/categoryfront.php/id/453/G_E9n_E9ral.html','','',0),
     Array('41',1, null,'Santé','/news/categoryfront.php/id/41/Sant_E9.html','','',0),
     Array('454',1, null,'Emploi','/news/categoryfront.php/id/454/Emploi.html','','',0),
     Array('38',1, null,'Éducation','/news/categoryfront.php/id/38/_C9ducation.html','','',0)),'Société','/news/categoryfront.php/id/17/Soci_E9t_E9.html','','',0),
   Array('5',1, null,'Développement','/news/categoryfront.php/id/5/D_E9veloppement.html','','',0),
   Array('455',1, Array(
     Array('472',1, null,'Doha','/news/categoryfront.php/id/472/Doha.html','','',0),
     Array('452',1, null,'Entreprises','/news/categoryfront.php/id/452/Entreprises.html','','',0),
     Array('35',1, null,'Commerce électronique','/news/categoryfront.php/id/35/Commerce__E9lectronique.html','','',0)),'Échanges & investissements','/news/categoryfront.php/id/455/_C9changes___investissements.html','','',0),
   Array('456',1, Array(
     Array('461',1, null,'Fiscalité','/news/categoryfront.php/id/461/Fiscalit_E9.html','','',0),
     Array('618',1, null,'Dossier spécial : Gouvernement et confiance','/news/categoryfront.php/id/618/Dossier_sp_E9cial_:_Gouvernement_et_confiance.html','','',0),
     Array('737',1, null,'Gouvernance','/news/categoryfront.php/id/737/Gouvernance.html','','',0)),'Gouvernement','/news/categoryfront.php/id/456/Gouvernement.html','','',0),
   Array('15',1, null,'Science & technologie','/news/categoryfront.php/id/15/Science___technologie.html','','',0),
   Array('14',1, Array(
     Array('688',1, null,'Environnement','/news/categoryfront.php/id/688/Environnement.html','','',0),
     Array('590',1, null,'Énergie','/news/categoryfront.php/id/590/_C9nergie.html','','',0),
     Array('589',1, null,'Agriculture','/news/categoryfront.php/id/589/Agriculture.html','','',0),
     Array('487',1, null,'Eau','/news/categoryfront.php/id/487/Eau.html','','',0),
     Array('875',1, null,'Pêcheries','/news/categoryfront.php/id/875/P_EAcheries.html','','',0),
     Array('876',1, null,'Autres','/news/categoryfront.php/id/876/Autres.html','','',0)),'Environnement et ressources','/news/categoryfront.php/id/14/Environnement_et_ressources.html','','',0)),'Thèmes','/news/categoryfront.php/id/441/Th_E8mes.html','','',0),
 Array('442',1, Array(
   Array('874',1, null,'Crise financière','/news/categoryfront.php/id/874/Crise_financi_E8re.html','','',0),
   Array('781',1, null,'Changement climatique','/news/categoryfront.php/id/781/Changement_climatique.html','','',0),
   Array('459',1, null,'Objectifs du Millénaire','/news/categoryfront.php/id/459/Objectifs_du_Mill_E9naire.html','','',0),
   Array('783',1, Array(
     Array('847',1, null,'Biotechnologies','/news/categoryfront.php/id/847/Biotechnologies.html','','',0),
     Array('846',1, null,'Internet','/news/categoryfront.php/id/846/Internet.html','','',0)),'Innovation','/news/categoryfront.php/id/783/Innovation.html','','',0),
   Array('37',1, null,'Mondialisation','/news/categoryfront.php/id/37/Mondialisation.html','','',0),
   Array('36',1, null,'Corruption','/news/categoryfront.php/id/36/Corruption.html','','',0),
   Array('742',1, null,'Femmes','/news/categoryfront.php/id/742/Femmes.html','','',0),
   Array('585',1, null,'Vieillissement','/news/categoryfront.php/id/585/Vieillissement.html','','',0),
   Array('458',1, null,'Développement durable','/news/categoryfront.php/id/458/D_E9veloppement_durable.html','','',0),
   Array('879',1, Array(
     Array('990',1, null,'Innovation','/news/categoryfront.php/id/990/Innovation.html','','',0),
     Array('945',1, null,'Moyen Orient-Afrique du Nord','/news/categoryfront.php/id/945/Moyen_Orient-Afrique_du_Nord.html','','',0),
     Array('880',1, null,'Economie Internet 2008','/news/categoryfront.php/id/880/Economie_Internet_2008.html','','',0),
     Array('881',1, null,'Transports 2008','/news/categoryfront.php/id/881/Transports_2008.html','','',0),
     Array('882',1, null,'Environnement 2008','/news/categoryfront.php/id/882/Environnement_2008.html','','',0),
     Array('883',1, null,'Politiques sociales 2005','/news/categoryfront.php/id/883/Politiques_sociales_2005.html','','',0)),'Dossiers spéciaux','/news/categoryfront.php/id/879/Dossiers_sp_E9ciaux.html','','',0)),'Dossiers ','/news/categoryfront.php/id/442/Dossiers_.html','','',0),
 Array('33',1, Array(
   Array('445',1, Array(
     Array('463',1, null,'Ensemble (zone OCDE)','/news/categoryfront.php/id/463/Ensemble__zone_OCDE_.html','','',0),
     Array('43',1, null,'Allemagne','/news/categoryfront.php/id/43/Allemagne.html','','',0),
     Array('464',1, null,'Australie','/news/categoryfront.php/id/464/Australie.html','','',0),
     Array('604',1, null,'Autriche','/news/categoryfront.php/id/604/Autriche.html','','',0),
     Array('46',1, null,'Belgique','/news/categoryfront.php/id/46/Belgique.html','','',0),
     Array('48',1, null,'Canada','/news/categoryfront.php/id/48/Canada.html','','',0),
     Array('465',1, null,'Corée','/news/categoryfront.php/id/465/Cor_E9e.html','','',0),
     Array('605',1, null,'Danemark','/news/categoryfront.php/id/605/Danemark.html','','',0),
     Array('50',1, null,'Espagne','/news/categoryfront.php/id/50/Espagne.html','','',0),
     Array('51',1, null,'États-Unis','/news/categoryfront.php/id/51/_C9tats-Unis.html','','',0),
     Array('475',1, null,'Finlande','/news/categoryfront.php/id/475/Finlande.html','','',0),
     Array('53',1, null,'France','/news/categoryfront.php/id/53/France.html','','',0),
     Array('54',1, null,'Grèce','/news/categoryfront.php/id/54/Gr_E8ce.html','','',0),
     Array('606',1, null,'Hongrie','/news/categoryfront.php/id/606/Hongrie.html','','',0),
     Array('55',1, null,'Irlande','/news/categoryfront.php/id/55/Irlande.html','','',0),
     Array('607',1, null,'Islande','/news/categoryfront.php/id/607/Islande.html','','',0),
     Array('56',1, null,'Italie','/news/categoryfront.php/id/56/Italie.html','','',0),
     Array('57',1, null,'Japon','/news/categoryfront.php/id/57/Japon.html','','',0),
     Array('608',1, null,'Luxembourg','/news/categoryfront.php/id/608/Luxembourg.html','','',0),
     Array('59',1, null,'Mexique','/news/categoryfront.php/id/59/Mexique.html','','',0),
     Array('609',1, null,'Norvège','/news/categoryfront.php/id/609/Norv_E8ge.html','','',0),
     Array('610',1, null,'Nouvelle-Zélande','/news/categoryfront.php/id/610/Nouvelle-Z_E9lande.html','','',0),
     Array('61',1, null,'Pays-Bas','/news/categoryfront.php/id/61/Pays-Bas.html','','',0),
     Array('62',1, null,'Pologne','/news/categoryfront.php/id/62/Pologne.html','','',0),
     Array('611',1, null,'Portugal','/news/categoryfront.php/id/611/Portugal.html','','',0),
     Array('612',1, null,'République tchèque','/news/categoryfront.php/id/612/R_E9publique_tch_E8que.html','','',0),
     Array('67',1, null,'République slovaque','/news/categoryfront.php/id/67/R_E9publique_slovaque.html','','',0),
     Array('66',1, null,'Royaume-Uni','/news/categoryfront.php/id/66/Royaume-Uni.html','','',0),
     Array('613',1, null,'Suède','/news/categoryfront.php/id/613/Su_E8de.html','','',0),
     Array('614',1, null,'Suisse','/news/categoryfront.php/id/614/Suisse.html','','',0),
     Array('466',1, null,'Turquie','/news/categoryfront.php/id/466/Turquie.html','','',0)),'Membres de l\'OCDE','/news/categoryfront.php/id/445/Membres_de_l_OCDE.html','','',0),
   Array('447',1, Array(
     Array('42',1, null,'Afrique','/news/categoryfront.php/id/42/Afrique.html','','',0),
     Array('68',1, null,'Union européenne','/news/categoryfront.php/id/68/Union_europ_E9enne.html','','',0),
     Array('467',1, null,'Moyen-Orient','/news/categoryfront.php/id/467/Moyen-Orient.html','','',0),
     Array('44',1, null,'Amérique du Sud','/news/categoryfront.php/id/44/Am_E9rique_du_Sud.html','','',0),
     Array('45',1, null,'Asie','/news/categoryfront.php/id/45/Asie.html','','',0)),'Régions','/news/categoryfront.php/id/447/R_E9gions.html','','',0),
   Array('446',1, Array(
     Array('630',1, null,'Brésil','/news/categoryfront.php/id/630/Br_E9sil.html','','',0),
     Array('668',1, null,'Chili','/news/categoryfront.php/id/668/Chili.html','','',0),
     Array('49',1, null,'Chine','/news/categoryfront.php/id/49/Chine.html','','',0),
     Array('734',1, null,'Inde','/news/categoryfront.php/id/734/Inde.html','','',0),
     Array('780',1, null,'Israël','/news/categoryfront.php/id/780/Isra_EBl.html','','',0),
     Array('64',1, null,'Russie','/news/categoryfront.php/id/64/Russie.html','','',0),
     Array('877',1, null,'Autres','/news/categoryfront.php/id/877/Autres.html','','',0)),'Non membres','/news/categoryfront.php/id/446/Non_membres.html','','',0),
   Array('60',1, null,'Monde','/news/categoryfront.php/id/60/Monde.html','','',0)),'Pays                                                                                       ','/news/categoryfront.php/id/33/Pays_______________________________________________________________________________________.html','','',0),
 Array('75',1, Array(
   Array('713',1, null,'Angel Gurría','/news/categoryfront.php/id/713/Angel_Gurr_EDa.html','','',0),
   Array('878',1, null,'Klaus Schmidt-Hebbel','/news/categoryfront.php/id/878/Klaus_Schmidt-Hebbel.html','','',0)),'Auteurs                                                                           ','/news/categoryfront.php/id/75/Auteurs___________________________________________________________________________.html','','',0),
 Array('440',1, Array(
   Array('abli',1, null,'Numéro précédent','/news/archive_browser.php/issue/1277265600.html','','',0),
   Array('abbi',1, null,'Cherchez parmi les numéros précédents','/news/archive_browser.php','','',0)),'Numéros précédents','javascript:void(0);','','',0));
NavbarItems[1] = Array(
 Array('435',1, Array(
   Array('438',1, null,'S\'abonner','http://www.observateurocde.org/abonnement.html','','',0),
   Array('436',1, null,'À notre sujet','/info/about_us.php','','',0),
   Array('557',1, null,'Publicité','/news/categoryfront.php/id/932','','',0),
   Array('629',1, null,'English','http://www.oecdobserver.org/','','',0)),'','','','',0));
NavbarItems[2] = Array(
);
function getPageItem(itemid) {
    if (document.getElementById) {
    	return document.getElementById(itemid);
    } else if (document.all) {
        return document.all[itemid];
    } else if (document.layers) {
    	return eval('document.'+itemid);
    }
    return null;
}

function writePageItem(itemid,html) {
    var lyr = null;
    if (document.getElementById) {
    	lyr = document.getElementById(itemid);
	lyr.innerHTML = html;
    } else if (document.all) {
        lyr = document.all[itemid];
	lyr.innerHTML = html;
    } else if (document.layers) {
    	// FIXME: ns4 compat
    }
}

function renderNavbarItem(container, level, item) {
    var html = "" + NavbarTemplates[container][level][1];

    var ihtm = NavbarTemplates[container][level][4];
    if (item[3] == '') { 
       // is empty
       ihtm = NavbarTemplates[container][level][2]; 
    } else if (item[5] != '') {  
       // has image
       ihtm = NavbarTemplates[container][level][3]; 
    }
    if (item[2] && (NavbarTemplates[container][level].length > 5)) { 
        // has children
    	if (item[1]) {  
	    // is open
      	    ihtm = NavbarTemplates[container][level][5];
    	} else {  
	    // is closed
      	    ihtm = NavbarTemplates[container][level][6];
    	}
    }

    html = html.replace(/%%ITEM%%/g, ihtm);

    html = html.replace(/%%ID%%/g, item[0]);
    html = html.replace(/%%TEXT%%/g, item[3]);
    html = html.replace(/%%LINK%%/g, item[4]);
    html = html.replace(/%%IMG_URL%%/g, item[5]);
    if (item[7] && PadlockTemplate) {
      html = html.replace(/%%PADLOCK%%/g, PadlockTemplate);
    } else {
      html = html.replace(/%%PADLOCK%%/g, '');
    }
    if (item[2] && item[1]) {  
	html = html.replace(/%%SUB%%/g, renderNavbarLevel(container, level+1, item[2]));
    } else {
	html = html.replace(/%%SUB%%/g, '');
    }
    return html;
} 

function renderNavbarLevel(container, level, items) {
    var html = NavbarTemplates[container][level][0];
    var buf = '';
    for(var i=0;i< items.length; i++) {
    	buf += renderNavbarItem(container, level, items[i]);
    }
    html = html.replace(/%%ITEMS%%/g, buf);
    return html;
}

function renderLeftNavbar() {
    return renderNavbarLevel(0,0,NavbarItems[0]);
}

function renderTopNavbar() {
    return renderNavbarLevel(1,0,NavbarItems[1]);
}

function renderRightNavbar() {
    return renderNavbarLevel(2,0,NavbarItems[2]);
}

// behavior specific

function getCategoryId() {
    var loc = "";
    loc += document.location; 
    loc = loc.replace(/^.*\/categoryfront\.php\/id\//,'');
    loc = loc.replace(/[^0-9].*$/,'');
    return loc;
}

function initNavbar() {
    var id = getCategoryId();
    for(var c=0; c< NavbarItems.length; c++) {
      for(var i=0;i< NavbarItems[c].length; i++) {
    	var items = NavbarItems[c][i][2];
    	if (items) {
    	    for(var j=0;j< items.length; j++) {
	      NavbarItems[c][i][2][j][1] = 0;
	      var jtems = items[j][2];
	      if (jtems && id!="") {
	        if (items[j][0] == id) { NavbarItems[c][i][2][j][1] = 1; }
	        else for (var k=0; k< jtems.length; k++) {
		  if (jtems[k][0] == id) { NavbarItems[c][i][2][j][1] = 1; }
		}
	      }
	    }
	}
      }
    }
}

function toggleNavbarItem(id) {
    for(var c=0; c< NavbarItems.length; c++) {
      for(var i=0;i< NavbarItems[c].length; i++) {
    	var items = NavbarItems[c][i][2];
    	if (items) {
    	    for(var j=0;j< items.length; j++) {
    	      if (items[j][0]==id) {
	    	NavbarItems[c][i][2][j][1] = 1 - items[j][1];
		var navdiv = getPageItem('navbar_'+c);
		if (navdiv) {
		    writePageItem('navbar_'+c,renderNavbarLevel(c,0,NavbarItems[c]));
		}
	      }
	    }
	}
      }
    }
    return 0;
}

function displaySWF(url,ver,w,h) {
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+ver+'" width="'+w+'" height="'+h+'"><param name="movie" value="'+url+'"><param name="quality" value="high"><embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed></object>');
}

var toid;
function toggleDiv(id) { var d = getPageItem(id); if (d) { if (d.style.visibility == 'hidden') d.style.visibility = 'visible'; else d.style.visibility = 'hidden'; } }
function showDiv(id) { var d=getPageItem(id); if (d) { d.style.visibility='visible'; } }
function hideDiv(id) { var d=getPageItem(id); if (d) { d.style.visibility='hidden'; } }

// template specific
// Array( 'main', 'item_main', 'empty_item', 'imgonly_item', 'nosub_item', 'sub_open_item', 'sub_close_item')
NavbarTemplates = Array(
 Array( 
   Array('%%ITEMS%%', 
   '%%ITEM%%%%SUB%%',
   '',
   '<div class="header navbar visual"><a href="%%LINK%%"><img src="%%IMG_URL%%" alt="" border="0"/></a></div>',
   '<div class="header navbar">%%TEXT%%</div>'),

   Array('<ul class="navbar">%%ITEMS%%</ul>', 
   '<li class="navbar item%%PADLOCK%%">%%ITEM%%</li>%%SUB%%',
   '',
   '<a class="button" href="%%LINK%%"><img src="%%IMG_URL%%" alt="" border="0"/></a>',
   '<a class="button" href="%%LINK%%">%%TEXT%%</a>',
   '<a class="button" href="javascript:void(0);" onclick="toggleNavbarItem(\'%%ID%%\');return false;">%%TEXT%%<img src="http://www.observateurocde.org/pixmaps/up.gif" hspace="0" vspace="1" border="0"/></a>',
   '<a class="button" href="javascript:void(0);" onclick="toggleNavbarItem(\'%%ID%%\');return false;">%%TEXT%%<img src="http://www.observateurocde.org/pixmaps/down.gif" hspace="0" vspace="1" border="0"/></a>'),

   Array('%%ITEMS%%', 
   '<li class="navbar item sub%%PADLOCK%%">%%ITEM%%</li>',
   '',
   '<a class="button" href="%%LINK%%"><img src="%%IMG_URL%%" alt="" border="0"/></a>',   
   '<a class="button" href="%%LINK%%">%%TEXT%%</a>')
 ),
 Array(),
 Array( 
    Array('%%ITEMS%%', 
   '%%ITEM%%%%SUB%%',
   '',
   '<div class="header navbar visual"><a href="%%LINK%%"><img src="%%IMG_URL%%" alt="" border="0"/></a></div>',
   '<div class="header navbar">%%TEXT%%</div>'),

   Array('<ul class="navbar">%%ITEMS%%</ul>', 
   '<li class="navbar item%%PADLOCK%%">%%ITEM%%</li>%%SUB%%',
   '',
   '<a class="button" href="%%LINK%%"><img src="%%IMG_URL%%" alt="" border="0"/></a>',
   '<a class="button" href="%%LINK%%">%%TEXT%%</a>',
   '<a class="button" href="javascript:void(0);" onclick="toggleNavbarItem(\'%%ID%%\');return false;">%%TEXT%%<img src="http://www.observateurocde.org/pixmaps/up.gif" hspace="0" vspace="1" border="0"/></a>',
   '<a class="button" href="javascript:void(0);" onclick="toggleNavbarItem(\'%%ID%%\');return false;">%%TEXT%%<img src="http://www.observateurocde.org/pixmaps/down.gif" hspace="0" vspace="1" border="0"/></a>'),

   Array('%%ITEMS%%', 
   '<li class="navbar item sub%%PADLOCK%%">%%ITEM%%</li>',
   '',
   '<a class="button" href="%%LINK%%"><img src="%%IMG_URL%%" alt="" border="0"/></a>',   
   '<a class="button" href="%%LINK%%">%%TEXT%%</a>')
 )
);

PadlockTemplate=' padlock';
