var selectedCategories = [] var all_categories = {}; all_categories["4"] = "Art & Culture"; all_categories["2"] = "Concert & Festival"; all_categories["5"] = "Famille & Enfant"; all_categories["7"] = "Loisirs"; all_categories["1"] = "Soirée & Fête"; all_categories["3"] = "Sport"; all_categories["6"] = "Vie Locale"; all_categories["156"] = "Attraction Florale"; all_categories["162"] = "Cirque"; all_categories["164"] = "Expo Musées"; all_categories["163"] = "Film pour Enfants"; all_categories["159"] = "Mimes"; all_categories["160"] = "Parades"; all_categories["161"] = "Parc d\'attraction & Fête Foraine"; all_categories["155"] = "Spectacle sur Glace"; all_categories["158"] = "Spectacles Enfants"; all_categories["192"] = "Zoo"; all_categories["176"] = "Association"; all_categories["170"] = "Atelier"; all_categories["194"] = "Atelier"; all_categories["175"] = "Brocantes"; all_categories["168"] = "Clubs"; all_categories["196"] = "Cours de Musique"; all_categories["195"] = "Cours de Théâtre"; all_categories["177"] = "Evenement Caritatifs"; all_categories["165"] = "Foire et Carnaval"; all_categories["18"] = "Gastronomie & Vin"; all_categories["167"] = "Groupe de Soutien"; all_categories["17"] = "Politique"; all_categories["197"] = "Religieux & Spirituel"; all_categories["166"] = "Réunion publiques"; all_categories["198"] = "Vente aux Enchères"; all_categories["169"] = "Volontariat"; all_categories["33"] = "After Work"; all_categories["241"] = "Alternatif, Rock & Indie"; all_categories["8"] = "Autre Soirée"; all_categories["23"] = "Boite de Nuit"; all_categories["32"] = "Danse"; all_categories["244"] = "Disco"; all_categories["239"] = "Drum \'n\' Bass"; all_categories["9"] = "Fete entre Amis"; all_categories["245"] = "Funk / Soul / Jazz"; all_categories["246"] = "Gay Lesbien"; all_categories["240"] = "Hip Hop / R\'n\'B"; all_categories["238"] = "House / Electro / Techno"; all_categories["31"] = "Karaoke"; all_categories["28"] = "Poker"; all_categories["27"] = "Rave"; all_categories["243"] = "Reggae / Ska / Dancehall "; all_categories["29"] = "Rencontre"; all_categories["26"] = "Soirée Blind Test"; all_categories["242"] = "Soirée Latino"; all_categories["25"] = "Soirée à Thème"; all_categories["24"] = "Soirée étudiante"; all_categories["30"] = "Speed Dating"; all_categories["200"] = "Chasse"; all_categories["20"] = "Expositions & Visites"; all_categories["199"] = "Forme & Santé"; all_categories["201"] = "Internet"; all_categories["202"] = "Nature"; all_categories["210"] = "Nouvel Album"; all_categories["203"] = "Nouvelle Voiture"; all_categories["206"] = "People"; all_categories["207"] = "Radio"; all_categories["179"] = "Soldes"; all_categories["205"] = "Sortie CD ROM"; all_categories["191"] = "Sortie DVD"; all_categories["204"] = "Sortie Jeu Video"; all_categories["209"] = "TV"; all_categories["208"] = "Tourisme"; all_categories["47"] = "Alternative"; all_categories["10"] = "Autre Concert"; all_categories["213"] = "Big Band"; all_categories["48"] = "Chanteur Interprete"; all_categories["49"] = "Country"; all_categories["61"] = "Electronique"; all_categories["60"] = "Experimental"; all_categories["11"] = "Festival de Musique"; all_categories["50"] = "Folk"; all_categories["214"] = "Funk"; all_categories["54"] = "Gospel"; all_categories["215"] = "Gothique"; all_categories["46"] = "Groupe Indépendant"; all_categories["57"] = "Groupes Hommage"; all_categories["55"] = "House"; all_categories["53"] = "Jazz Blues Gospel"; all_categories["52"] = "Metal & Hard Rock"; all_categories["45"] = "Musique Allemande"; all_categories["62"] = "Musique Classique & Opera"; all_categories["216"] = "Musique Latine"; all_categories["58"] = "Musique Monde"; all_categories["59"] = "Pop Rock"; all_categories["217"] = "Punk"; all_categories["51"] = "R&B"; all_categories["56"] = "Rap & HipHop & Slam"; all_categories["65"] = "Reggae & Ska"; all_categories["64"] = "Scene Ouverte"; all_categories["63"] = "Sortie Album"; all_categories["218"] = "Soul"; all_categories["44"] = "Variété Francaise"; all_categories["88"] = "Arts Martiaux"; all_categories["100"] = "Athletisme"; all_categories["107"] = "Autre Sport"; all_categories["75"] = "Badminton"; all_categories["76"] = "Baseball"; all_categories["77"] = "Basketball"; all_categories["94"] = "Billard & Snooker"; all_categories["78"] = "Boxe"; all_categories["98"] = "Catch"; all_categories["185"] = "Cerf-Volant"; all_categories["85"] = "Cheval"; all_categories["79"] = "Cricket"; all_categories["99"] = "Cyclisme"; all_categories["93"] = "Endurance"; all_categories["186"] = "Escalade"; all_categories["82"] = "F1"; all_categories["182"] = "Fitness"; all_categories["80"] = "Fléchettes"; all_categories["81"] = "Foot"; all_categories["87"] = "Foot Indoor"; all_categories["74"] = "Football Américain"; all_categories["83"] = "Golf"; all_categories["189"] = "Gymnastique"; all_categories["84"] = "Handball"; all_categories["105"] = "Handisport"; all_categories["86"] = "Hockey sur Glace"; all_categories["183"] = "Hockey sur gazon"; all_categories["181"] = "Karting"; all_categories["89"] = "Moto"; all_categories["102"] = "Natation"; all_categories["103"] = "Nautisme"; all_categories["157"] = "Patinage"; all_categories["188"] = "Peche"; all_categories["184"] = "Rollerblade"; all_categories["92"] = "Rugby "; all_categories["91"] = "Rugby à 13"; all_categories["101"] = "Ski & Sport d\'Hiver"; all_categories["90"] = "Sport Mécanique"; all_categories["193"] = "Sport de Rue & Outdoor"; all_categories["187"] = "Sport de plage"; all_categories["95"] = "Squash"; all_categories["96"] = "Tennis"; all_categories["97"] = "Ultimate Fighting"; all_categories["104"] = "Volleyball"; all_categories["190"] = "Atelier d\'Art"; all_categories["212"] = "Bal / Gala / Rallye"; all_categories["19"] = "Cinéma"; all_categories["106"] = "Danse"; all_categories["118"] = "Debat et Discussion"; all_categories["14"] = "Exposition & Arts Plastiques"; all_categories["128"] = "Festival de Rue"; all_categories["16"] = "Livres et Littérature"; all_categories["13"] = "Theatre & Spectacle"; all_categories["260"] = "Science"; all_categories["173"] = "Cours de Cuisine"; all_categories["171"] = "Degustation de Vin"; all_categories["174"] = "Evenement Restaurant & Dégustation"; all_categories["172"] = "Marché"; all_categories["115"] = "Action"; all_categories["222"] = "Animation"; all_categories["12"] = "Avant Premiere"; all_categories["223"] = "Bollywood"; all_categories["110"] = "Clubs"; all_categories["112"] = "Comedie"; all_categories["226"] = "Comédie Musicale"; all_categories["113"] = "Comédie Romantique"; all_categories["227"] = "Court Métrage"; all_categories["224"] = "Documentaire"; all_categories["116"] = "Dramatique"; all_categories["114"] = "Enfant"; all_categories["229"] = "Etranger"; all_categories["108"] = "Festival Cinéma"; all_categories["225"] = "Horreur"; all_categories["117"] = "Science Fiction"; all_categories["109"] = "Sortie de Livre"; all_categories["228"] = "Western"; all_categories["261"] = "Club Professionnel"; all_categories["262"] = "Vie Religieuse & Spirituelle"; all_categories["232"] = "Agriculture "; all_categories["230"] = "Automobile & Cycle"; all_categories["231"] = "Bandes Dessinées"; all_categories["237"] = "Beauté"; all_categories["21"] = "Congrès Professionnel"; all_categories["233"] = "Decoration"; all_categories["178"] = "Defile de Mode"; all_categories["235"] = "Musique"; all_categories["22"] = "Salons et Congrès"; all_categories["236"] = "Transport"; all_categories["234"] = "artisanat"; all_categories["211"] = "Bars"; all_categories["247"] = "Bobsleigh"; all_categories["34"] = "Anniversaire"; all_categories["38"] = "Barbecue"; all_categories["35"] = "Boire un Verre"; all_categories["37"] = "Cocktail"; all_categories["40"] = "Dejeuner"; all_categories["39"] = "Diner"; all_categories["43"] = "Pot de Depart"; all_categories["42"] = "Soiree a la Maison"; all_categories["41"] = "Soirée Ciné"; all_categories["36"] = "Soirée Jeu"; all_categories["248"] = "Aviron"; all_categories["250"] = "Plongée"; all_categories["249"] = "Surf"; all_categories["66"] = "Folk"; all_categories["69"] = "House"; all_categories["68"] = "Jazz Blues Gospel"; all_categories["67"] = "Metal & Hard Rock"; all_categories["72"] = "Musique Classique & Opera"; all_categories["70"] = "Musique Monde"; all_categories["71"] = "Pop Rock"; all_categories["73"] = "Reggae & Ska"; all_categories["219"] = "Cabaret / Variétés"; all_categories["119"] = "Classique"; all_categories["124"] = "Comedie"; all_categories["122"] = "Comédie Musicale"; all_categories["123"] = "Danse & Ballet"; all_categories["125"] = "Drame"; all_categories["121"] = "Enfant"; all_categories["127"] = "Les Dernieres de Theatre"; all_categories["120"] = "Moderne"; all_categories["126"] = "Nouveautés Theatre"; all_categories["252"] = "Contemporaine"; all_categories["253"] = "Cours de Danse"; all_categories["251"] = "Danse de Salon"; all_categories["256"] = "Danse du Monde"; all_categories["254"] = "Folk/Celtic"; all_categories["255"] = "Latino"; all_categories["131"] = "Art Classique"; all_categories["140"] = "Art Deco"; all_categories["139"] = "Art Nouveau"; all_categories["148"] = "Contemporain"; all_categories["143"] = "Cubisme"; all_categories["129"] = "Expo Photo"; all_categories["142"] = "Expressionisme"; all_categories["220"] = "Histoire"; all_categories["138"] = "Impressionnisme"; all_categories["132"] = "Medieval & Gothique"; all_categories["146"] = "Minimalisme"; all_categories["141"] = "Modernisme"; all_categories["134"] = "Neoclassique"; all_categories["145"] = "Pop Art"; all_categories["147"] = "PostModernisme"; all_categories["136"] = "Pre Raphaelites"; all_categories["130"] = "Projection de Film"; all_categories["137"] = "Realisme"; all_categories["133"] = "Renaissance"; all_categories["135"] = "Romantisme"; all_categories["144"] = "Surrealisme"; all_categories["150"] = "Clubs"; all_categories["151"] = "Dernières Publications"; all_categories["154"] = "Discussion de Groupes"; all_categories["153"] = "Lecture de Poeme"; all_categories["152"] = "Lectures de Livres"; all_categories["221"] = "Sortie Cinema"; all_categories["149"] = "Séance de Dédicace de Livres"; all_categories["257"] = "Carnaval"; all_categories["258"] = "Ceremonie"; all_categories["259"] = "Commemoration"; var top_categories = new Array(); top_categories.push(['4', 'Art & Culture']); top_categories.push(['2', 'Concert & Festival']); top_categories.push(['5', 'Famille & Enfant']); top_categories.push(['7', 'Loisirs']); top_categories.push(['1', 'Soirée & Fête']); top_categories.push(['3', 'Sport']); top_categories.push(['6', 'Vie Locale']); var second_level = { '4': [{id: '190', title: 'Atelier d\'Art'},{id: '212', title: 'Bal / Gala / Rallye'},{id: '19', title: 'Cinéma'},{id: '106', title: 'Danse'},{id: '118', title: 'Debat et Discussion'},{id: '14', title: 'Exposition & Arts Plastiques'},{id: '128', title: 'Festival de Rue'},{id: '16', title: 'Livres et Littérature'},{id: '13', title: 'Theatre & Spectacle'}],'2': [{id: '47', title: 'Alternative'},{id: '10', title: 'Autre Concert'},{id: '213', title: 'Big Band'},{id: '48', title: 'Chanteur Interprete'},{id: '49', title: 'Country'},{id: '61', title: 'Electronique'},{id: '60', title: 'Experimental'},{id: '11', title: 'Festival de Musique'},{id: '50', title: 'Folk'},{id: '214', title: 'Funk'},{id: '54', title: 'Gospel'},{id: '215', title: 'Gothique'},{id: '46', title: 'Groupe Indépendant'},{id: '57', title: 'Groupes Hommage'},{id: '55', title: 'House'},{id: '53', title: 'Jazz Blues Gospel'},{id: '52', title: 'Metal & Hard Rock'},{id: '45', title: 'Musique Allemande'},{id: '62', title: 'Musique Classique & Opera'},{id: '216', title: 'Musique Latine'},{id: '58', title: 'Musique Monde'},{id: '59', title: 'Pop Rock'},{id: '217', title: 'Punk'},{id: '51', title: 'R&B'},{id: '56', title: 'Rap & HipHop & Slam'},{id: '65', title: 'Reggae & Ska'},{id: '64', title: 'Scene Ouverte'},{id: '63', title: 'Sortie Album'},{id: '218', title: 'Soul'},{id: '44', title: 'Variété Francaise'}],'5': [{id: '156', title: 'Attraction Florale'},{id: '162', title: 'Cirque'},{id: '164', title: 'Expo Musées'},{id: '163', title: 'Film pour Enfants'},{id: '159', title: 'Mimes'},{id: '160', title: 'Parades'},{id: '161', title: 'Parc d\'attraction & Fête Foraine'},{id: '155', title: 'Spectacle sur Glace'},{id: '158', title: 'Spectacles Enfants'},{id: '192', title: 'Zoo'}],'7': [{id: '200', title: 'Chasse'},{id: '20', title: 'Expositions & Visites'},{id: '199', title: 'Forme & Santé'},{id: '201', title: 'Internet'},{id: '202', title: 'Nature'},{id: '210', title: 'Nouvel Album'},{id: '203', title: 'Nouvelle Voiture'},{id: '206', title: 'People'},{id: '207', title: 'Radio'},{id: '179', title: 'Soldes'},{id: '205', title: 'Sortie CD ROM'},{id: '191', title: 'Sortie DVD'},{id: '204', title: 'Sortie Jeu Video'},{id: '209', title: 'TV'},{id: '208', title: 'Tourisme'}],'1': [{id: '33', title: 'After Work'},{id: '241', title: 'Alternatif, Rock & Indie'},{id: '8', title: 'Autre Soirée'},{id: '23', title: 'Boite de Nuit'},{id: '32', title: 'Danse'},{id: '244', title: 'Disco'},{id: '239', title: 'Drum \'n\' Bass'},{id: '9', title: 'Fete entre Amis'},{id: '245', title: 'Funk / Soul / Jazz'},{id: '246', title: 'Gay Lesbien'},{id: '240', title: 'Hip Hop / R\'n\'B'},{id: '238', title: 'House / Electro / Techno'},{id: '31', title: 'Karaoke'},{id: '28', title: 'Poker'},{id: '27', title: 'Rave'},{id: '243', title: 'Reggae / Ska / Dancehall '},{id: '29', title: 'Rencontre'},{id: '26', title: 'Soirée Blind Test'},{id: '242', title: 'Soirée Latino'},{id: '25', title: 'Soirée à Thème'},{id: '24', title: 'Soirée étudiante'},{id: '30', title: 'Speed Dating'}],'3': [{id: '88', title: 'Arts Martiaux'},{id: '100', title: 'Athletisme'},{id: '107', title: 'Autre Sport'},{id: '75', title: 'Badminton'},{id: '76', title: 'Baseball'},{id: '77', title: 'Basketball'},{id: '94', title: 'Billard & Snooker'},{id: '78', title: 'Boxe'},{id: '98', title: 'Catch'},{id: '185', title: 'Cerf-Volant'},{id: '85', title: 'Cheval'},{id: '79', title: 'Cricket'},{id: '99', title: 'Cyclisme'},{id: '93', title: 'Endurance'},{id: '186', title: 'Escalade'},{id: '82', title: 'F1'},{id: '182', title: 'Fitness'},{id: '80', title: 'Fléchettes'},{id: '81', title: 'Foot'},{id: '87', title: 'Foot Indoor'},{id: '74', title: 'Football Américain'},{id: '83', title: 'Golf'},{id: '189', title: 'Gymnastique'},{id: '84', title: 'Handball'},{id: '105', title: 'Handisport'},{id: '86', title: 'Hockey sur Glace'},{id: '183', title: 'Hockey sur gazon'},{id: '181', title: 'Karting'},{id: '89', title: 'Moto'},{id: '102', title: 'Natation'},{id: '103', title: 'Nautisme'},{id: '157', title: 'Patinage'},{id: '188', title: 'Peche'},{id: '184', title: 'Rollerblade'},{id: '92', title: 'Rugby '},{id: '91', title: 'Rugby à 13'},{id: '101', title: 'Ski & Sport d\'Hiver'},{id: '90', title: 'Sport Mécanique'},{id: '193', title: 'Sport de Rue & Outdoor'},{id: '187', title: 'Sport de plage'},{id: '95', title: 'Squash'},{id: '96', title: 'Tennis'},{id: '97', title: 'Ultimate Fighting'},{id: '104', title: 'Volleyball'}],'6': [{id: '176', title: 'Association'},{id: '170', title: 'Atelier'},{id: '194', title: 'Atelier'},{id: '175', title: 'Brocantes'},{id: '168', title: 'Clubs'},{id: '196', title: 'Cours de Musique'},{id: '195', title: 'Cours de Théâtre'},{id: '177', title: 'Evenement Caritatifs'},{id: '165', title: 'Foire et Carnaval'},{id: '18', title: 'Gastronomie & Vin'},{id: '167', title: 'Groupe de Soutien'},{id: '17', title: 'Politique'},{id: '197', title: 'Religieux & Spirituel'},{id: '166', title: 'Réunion publiques'},{id: '198', title: 'Vente aux Enchères'},{id: '169', title: 'Volontariat'}] } var third_level = { '156': [],'162': [],'164': [],'163': [],'159': [],'160': [],'161': [],'155': [],'158': [],'192': [],'176': [],'170': [],'194': [],'175': [],'168': [{id: '261', title: 'Club Professionnel'},{id: '262', title: 'Vie Religieuse & Spirituelle'}],'196': [],'195': [],'177': [],'165': [{id: '257', title: 'Carnaval'},{id: '258', title: 'Ceremonie'},{id: '259', title: 'Commemoration'}],'18': [{id: '173', title: 'Cours de Cuisine'},{id: '171', title: 'Degustation de Vin'},{id: '174', title: 'Evenement Restaurant & Dégustation'},{id: '172', title: 'Marché'}],'167': [],'17': [],'197': [],'166': [{id: '260', title: 'Science'}],'198': [],'169': [],'33': [],'241': [],'8': [{id: '211', title: 'Bars'}],'23': [],'32': [],'244': [],'239': [],'9': [{id: '34', title: 'Anniversaire'},{id: '38', title: 'Barbecue'},{id: '35', title: 'Boire un Verre'},{id: '37', title: 'Cocktail'},{id: '40', title: 'Dejeuner'},{id: '39', title: 'Diner'},{id: '43', title: 'Pot de Depart'},{id: '42', title: 'Soiree a la Maison'},{id: '41', title: 'Soirée Ciné'},{id: '36', title: 'Soirée Jeu'}],'245': [],'246': [],'240': [],'238': [],'31': [],'28': [],'27': [],'243': [],'29': [],'26': [],'242': [],'25': [],'24': [],'30': [],'200': [],'20': [{id: '232', title: 'Agriculture '},{id: '230', title: 'Automobile & Cycle'},{id: '231', title: 'Bandes Dessinées'},{id: '237', title: 'Beauté'},{id: '21', title: 'Congrès Professionnel'},{id: '233', title: 'Decoration'},{id: '178', title: 'Defile de Mode'},{id: '235', title: 'Musique'},{id: '22', title: 'Salons et Congrès'},{id: '236', title: 'Transport'},{id: '234', title: 'artisanat'}],'199': [],'201': [],'202': [],'210': [],'203': [],'206': [],'207': [],'179': [],'205': [],'191': [],'204': [],'209': [],'208': [],'47': [],'10': [],'213': [],'48': [],'49': [],'61': [],'60': [],'11': [{id: '66', title: 'Folk'},{id: '69', title: 'House'},{id: '68', title: 'Jazz Blues Gospel'},{id: '67', title: 'Metal & Hard Rock'},{id: '72', title: 'Musique Classique & Opera'},{id: '70', title: 'Musique Monde'},{id: '71', title: 'Pop Rock'},{id: '73', title: 'Reggae & Ska'}],'50': [],'214': [],'54': [],'215': [],'46': [],'57': [],'55': [],'53': [],'52': [],'45': [],'62': [],'216': [],'58': [],'59': [],'217': [],'51': [],'56': [],'65': [],'64': [],'63': [],'218': [],'44': [],'88': [],'100': [],'107': [],'75': [],'76': [],'77': [],'94': [],'78': [],'98': [],'185': [],'85': [],'79': [],'99': [],'93': [],'186': [],'82': [],'182': [],'80': [],'81': [],'87': [],'74': [],'83': [],'189': [],'84': [],'105': [],'86': [],'183': [],'181': [],'89': [],'102': [],'103': [{id: '248', title: 'Aviron'},{id: '250', title: 'Plongée'},{id: '249', title: 'Surf'}],'157': [],'188': [],'184': [],'92': [],'91': [],'101': [{id: '247', title: 'Bobsleigh'}],'90': [],'193': [],'187': [],'95': [],'96': [],'97': [],'104': [],'190': [],'212': [],'19': [{id: '115', title: 'Action'},{id: '222', title: 'Animation'},{id: '12', title: 'Avant Premiere'},{id: '223', title: 'Bollywood'},{id: '110', title: 'Clubs'},{id: '112', title: 'Comedie'},{id: '226', title: 'Comédie Musicale'},{id: '113', title: 'Comédie Romantique'},{id: '227', title: 'Court Métrage'},{id: '224', title: 'Documentaire'},{id: '116', title: 'Dramatique'},{id: '114', title: 'Enfant'},{id: '229', title: 'Etranger'},{id: '108', title: 'Festival Cinéma'},{id: '225', title: 'Horreur'},{id: '117', title: 'Science Fiction'},{id: '109', title: 'Sortie de Livre'},{id: '228', title: 'Western'}],'106': [{id: '252', title: 'Contemporaine'},{id: '253', title: 'Cours de Danse'},{id: '251', title: 'Danse de Salon'},{id: '256', title: 'Danse du Monde'},{id: '254', title: 'Folk/Celtic'},{id: '255', title: 'Latino'}],'118': [],'14': [{id: '131', title: 'Art Classique'},{id: '140', title: 'Art Deco'},{id: '139', title: 'Art Nouveau'},{id: '148', title: 'Contemporain'},{id: '143', title: 'Cubisme'},{id: '129', title: 'Expo Photo'},{id: '142', title: 'Expressionisme'},{id: '220', title: 'Histoire'},{id: '138', title: 'Impressionnisme'},{id: '132', title: 'Medieval & Gothique'},{id: '146', title: 'Minimalisme'},{id: '141', title: 'Modernisme'},{id: '134', title: 'Neoclassique'},{id: '145', title: 'Pop Art'},{id: '147', title: 'PostModernisme'},{id: '136', title: 'Pre Raphaelites'},{id: '130', title: 'Projection de Film'},{id: '137', title: 'Realisme'},{id: '133', title: 'Renaissance'},{id: '135', title: 'Romantisme'},{id: '144', title: 'Surrealisme'}],'128': [],'16': [{id: '150', title: 'Clubs'},{id: '151', title: 'Dernières Publications'},{id: '154', title: 'Discussion de Groupes'},{id: '153', title: 'Lecture de Poeme'},{id: '152', title: 'Lectures de Livres'},{id: '221', title: 'Sortie Cinema'},{id: '149', title: 'Séance de Dédicace de Livres'}],'13': [{id: '219', title: 'Cabaret / Variétés'},{id: '119', title: 'Classique'},{id: '124', title: 'Comedie'},{id: '122', title: 'Comédie Musicale'},{id: '123', title: 'Danse & Ballet'},{id: '125', title: 'Drame'},{id: '121', title: 'Enfant'},{id: '127', title: 'Les Dernieres de Theatre'},{id: '120', title: 'Moderne'},{id: '126', title: 'Nouveautés Theatre'}] } function showSecondLevel(id){ $$('#event_event_second_category_id, #event_event_third_category_id').each(function(el){ Element.remove(el); }) if((a = second_level[id]) && a.any()) { var select = new Element('select', {id: 'event_event_second_category_id'}); select.observe('change', function() { if($('event_event_third_category_id')) Element.remove('event_event_third_category_id'); if(!$F('event_event_second_category_id').blank()) { showThirdLevel($F('event_event_second_category_id')); } }) select.appendChild(new Element('option').update("-------------")); a.each(function(cat){ select.appendChild(new Element('option', {value: cat['id']}).update(cat['title'])); }) $('event_category_top_level').insert({after: select}); } } function showThirdLevel(id){ $$('#event_event_third_category_id').each(function(el){ Element.remove(el); }) if((a = third_level[id]) && a.any()) { var select = new Element('select', {id: 'event_event_third_category_id'}); select.appendChild(new Element('option').update("-------------")); a.each(function(cat){ select.appendChild(new Element('option', {value: cat['id']}).update(cat['title'])); }) $('event_event_second_category_id').insert({after: select}); Event.addBehavior({'#event_event_second_category_id' : SecondLevelBehavior}) } } var FirstLevelBehavior = Behavior.create({ onchange: function(e) { showSecondLevel(this.element.value); } }) var SecondLevelBehavior = Behavior.create({ onchange: function(e) { showThirdLevel(this.element.value); } }) Event.addBehavior({'#event_category_top_level' : FirstLevelBehavior}) function addEventCategory(){ var selects = $('event_event_third_category_id', 'event_event_second_category_id', 'event_category_top_level').compact(); var ids = selects.pluck("value").reject(function(e){return e == '-------------'}); var texts = selects.map(function(el){ return el.options[el.selectedIndex].text; }).reject(function(e){return e == '-------------'}); if(texts.any()){ var div = new Element("div", {className: "event_category"}).update(texts.first()); var input = new Element("input", {type: "hidden", name: "event[event_category_ids][]", value: ids.first()}); var button = new Element("a", {className: "category_delete_link", href: "#", onclick: "$(this).up('div').remove(); return false"}).update("(Supprimer)"); $("categories_div").insert({top: div}); div.insert({top: input}).insert({bottom: button}); } }