/**
 * fonctions d'amélioration de l'interface utilisateur candidat
 */
function candidat_ui() {
  
  /**
   * zone de saisies enrichies HTML
   */
  $('textarea.htmlEditable').tinymce({
    script_url : '/js/tinymce/tinymce_3_3_3_jquery/jscripts/tiny_mce/tiny_mce.js',
    theme : "simple",
    valid_elements : "a[href|title],strong/b,em/i,strike,u,"
      + "#p,-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|"
      + "src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,"
      + "-blockquote,-table[border=0|cellspacing|cellpadding|width|frame|rules|"
      + "height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|"
      + "height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,"
      + "#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor"
      + "|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,"
      + "-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face"
      + "|size|color],dd,dl,dt,"
      + "object[classid|width|height|codebase|*],param[name|value|_value],small,big",
    setup : function(ed) {
      ed.onPostProcess.add(function(ed, o) {
        o.content = o.content.replace(/<(!--)([\s\S]*)(--)>/gi, '');
      });
    }
  });
  
  /**
   * liste des régions de France (aide pour tout cocher / tout décocher)
   */
  $('ul#lieurechemploi li').eq(3).before('<p><span id="fr_cocher" style="text-decoration: underline; cursor: pointer;">Tout cocher</span> - <span id="fr_decocher" style="text-decoration: underline; cursor: pointer;">Tout décocher</span></p>');
  $('#fr_cocher').click(function() {
    $('ul#lieurechemploi ul').eq(0).children('li').children('input').attr('checked', 'checked');
  });
  $('#fr_decocher').click(function() {
    $('ul#lieurechemploi ul').eq(0).children('li').children('input').attr('checked', '');
  });
  
}

$(document).ready(function(){
	candidat_ui();
});

