function comingSoon(){
        document.getElementById('b').innerHTML = '<p>Cliquez sur l\'image ci-dessous pour visualiser ma <span>carte de visite:</span></p><p><a href="etang-sale/images/accueil/profil.jpg" rel="lightbox" title="Grégory Bouteiller - carte de visite"><img class="photo" src="etang-sale/images/accueil/profil_th.jpg" /></a></p>' ;
        initLightbox();        
}

function bindForm(){
  Event.observe('commentsForm','submit',switchToAJAX,false) ;
}

function switchToAJAX(e) {
  Event.stop(e);
  var data = $H({
    'pseudo':$F('pseudoField'),
    'pseudo_type':'string',
    'email':$F('emailField'),
    'email_type':'email',
    'comment':$F('commentField'),
    'comment_type':'text'
  }).toQueryString();
  new Ajax.Request('etang-sale/Controllers/Controller_New_Comment.php',{
    postBody:data,
    onComplete: function(xhr) {
      var docXML = xhr.responseXML ;
      var errors_list = docXML.getElementsByTagName('erreur');
      var errors = $A(errors_list) ; 
      $('comment_error').innerHTML='';
      errors.each(function(error) {
       new Insertion.Bottom('comment_error','<p class="colored"><b>'+error.getElementsByTagName('err_id').item(0).firstChild.data+'</b> : '+error.getElementsByTagName('err_description').item(0).firstChild.data+'</p>') ;     
      }); 
      if (errors.length == 0) {
        var str = '<div class="comment" style="display:none">';
        str += '<h3><a href="mailto:'+docXML.getElementsByTagName('email').item(0).firstChild.data+'">'+docXML.getElementsByTagName('pseudo').item(0).firstChild.data+'</a> @ '+docXML.getElementsByTagName('time').item(0).firstChild.data+' le '+docXML.getElementsByTagName('date').item(0).firstChild.data+'</h3>';
        str += '<div class="commentText">'+docXML.getElementsByTagName('content').item(0).firstChild.data+'</div>';
        str+= '</div>';
        new Insertion.Top('comments',str);
        window.document.forms['commentsForm'].elements['commentField'].value='';
        //document.forms['commentsForm'].elements['commentField'].style.color = "blue";
        var comments = $$('#comments .comment');
        var commentCount = comments.length;
        var lastComment = comments.first();
        var text = commentCount + ' commentaire';
        if (commentCount > 1)
          text += 's';
        Element.update('commentCount',text);
        new Effect.Parallel([
          new Effect.Pulsate('commentCount',{sync:true}),
          new Effect.BlindDown(lastComment,{sync:true})
        ],{duration: 2});
      }
    }
  });
}

Event.observe(window,'load',bindForm,false) ;

