edite_div=function(id,target,id_message,sujet,forum,is_sujet){var heightreponse=$('#form_layer_fenetre_post_reponse').height();if(!heightreponse)heightreponse='355px';if(is_sujet)$(id).height(heightreponse+50);else $(id).height(heightreponse);target=$(target).find('.message_txt');$('#form_layer_fenetre_post_reponse').hide();$('img.btnciter').hide();$('img.btnrepondre').each(function(){if($(this).css('display')=='none'){$(this).remove()}});$('img.btnrepondre').hide();$('img.btnediter').hide();$('#layer_reponse'+id_message).height($(target).height()).hide().html($(target).html());deplace_div(id,target,true);$(id).update('/api/forum/ajax.php?act=layer_edition&sujet='+sujet+'&forum='+forum,{idmsg:id_message,is_sujet:is_sujet},{over_msg:'Chargement de l\'édition',success:function(){$.ajax({url:'/api/forum/ajax.php?act=message_contenu',type:'POST',dataType:'json',over_msg:'Chargement du contenu du message',over_target:id,success:function(msg){$('#txt','#formsujet_editer').val(msg.contenu);if(is_sujet){$('#titre','#formsujet_editer').val(msg.titre);$('#motcle','#formsujet_editer').val(msg.motcle)}$('#btnannuler').click(function(){annuler_edite_div(target,id_message)});$(id).Rollover().Tooltip();if(!$.browser.msie){window.scrollTo(0,$(target)[0].offsetTop)}},data:'id_message='+id_message+'&id_sujet='+sujet+'&is_sujet='+is_sujet})}})};annuler_edite_div=function(target,id_message,sujet){$('#message'+id_message).find('.message_txt').html($('#layer_reponse'+id_message).html()).css({height:'auto'});$('#layer_reponse'+id_message).css({height:'auto'}).html('&nbsp;').show();$('body').append('<div id="layer_editer">&nbsp;</div>');$.ajax({url:'/api/forum/ajax.php?act=message_contenu',over_msg:'Rechargement du message',over_target:'#message'+id_message,type:'POST',dataType:'json',success:function(msg){$('#message'+id_message).find('.message_txt').html(msg.contenu)},data:'id_message='+id_message+'&id_sujet='+sujet+'&html=1&is_sujet='+(sujet==''?1:0)});$('img.btnciter').show();$('img.btnrepondre').show();$('img.btnediter').show();$('#form_layer_fenetre_post_reponse').show();$('.afficher_cacher').remove();unbind_element();ready_message();$('#message'+id_message).Rollover().Tooltip()};var olddiv='';var olddivheight='';deplace_div=function(id,target,empty){empty=empty||false;if(($('#txt_tmp').val()!='')&&($('#txt_tmp').val()!=null)){var iframe=true;preview()}var oldheight=$(id)[0].offsetHeight;if(olddiv!='')$(olddiv).height('auto');olddivheight=$(target)[0].offsetHeight;if(empty)$(target).empty();$(target).append($(id)[0]);$(id).slideDown();$(target).height('auto');olddiv=target};unbind_element=function(){$('.btnciter').unbind('click');$('.btnrepondre').unbind('click');$('.btnediter').unbind('click');$('img','.quote').not('.emoticon').prev().unbind('click')};$(document).ready(ready_message=function(){$('.quote .quote .quote').hide();$('.btnciter').css('cursor','pointer').click(function(){var splitid=$(this).attr('id').split('_');$('#btnrepondre_'+splitid[1]).click();$.ajax({url:'/api/forum/ajax.php?act=citer_message',type:'POST',success:function(msg){$('#txt').val($('#txt').val()+msg)},data:'id_message='+splitid[1]+'&id_sujet='+splitid[2]})});$('.btnediter').css('cursor','pointer').click(function(){var splitid=$(this).attr('id').split('_');edite_div('#layer_editer','#message'+splitid[1],splitid[1],splitid[2],splitid[3],splitid[4])});$('.btnrepondre').css('cursor','pointer').click(function(){var splitid=$(this).attr('id').split('_');deplace_div('#form_layer_fenetre_post_reponse','#layer_reponse'+splitid[1])});displayimage=function(objimage){if($.browser.opera){objimage.style.display='inline';$('img.inpost').unbind().css({maxWidth:'600px',cursor:'pointer'}).click(function(){if($(this).css('maxWidth')=='600px'){$(this).css('maxWidth','none')}else{$(this).css('maxWidth','600px')}});return false}objimage.recur=objimage.recur+1||0;x=700;y=700;if(objimage.recur>10){$(objimage).unbind("load").unbind("click");objimage.style.display='inline';return false}if(objimage.width==0){if(objimage.style.display=='none'||objimage.style.display==''){objimage.style.display='inline';changestyle=true}if(objimage.width){if(changestyle)objimage.style.display='none';if(objimage.complete){displayimage(objimage)}else{$(objimage).load(function(){displayimage(objimage)})}return false}}var imageWidthOld=objimage.width;var imageHeightOld=objimage.height;var imageWidth=objimage.width;var imageHeight=objimage.height;if(imageWidth>x){imageHeight=imageHeight*(x/imageWidth);imageWidth=x;if(imageHeight>y){imageWidth=imageWidth*(y/imageHeight);imageHeight=y}}else if(imageHeight>y){imageWidth=imageWidth*(y/imageHeight);imageHeight=y;if(imageWidth>x){imageHeight=imageHeight*(x/imageWidth);imageWidth=x}}if(imageHeight!=objimage.height){objimage.height=imageHeight;objimage.width=imageWidth;$(objimage).css('cursor','pointer').click(function(){if(objimage.height==imageHeightOld){$(objimage).animate({height:imageHeight,width:imageWidth})}else{$(objimage).animate({height:imageHeightOld,width:imageWidthOld})}})}else $(objimage).addClass('smallimg');$(objimage).not('.inquote').css("display","inline")};$('img.inpost','.message_txt,.message_contenu').not('.inquote').hide().end().each(function(){if(this.complete){displayimage(this)}else{if($.browser.opera)displayimage(this);else $(this).load(function(){displayimage(this)})}});$('.afficher_cacher').remove();$('img','.quote').not('.emoticon').not('.smallimg').addClass('inquote').hide().before('<div class="afficher_cacher"><img src="/api/forum/img/afficher_image_off.gif" class="rollover" border="0" width="103" height="23" style="cursor:pointer" /></div>').prev().Rollover().click(function(){var image=$(this).next();if(image.is(':visible')){image.slideUp('normal',function(){$(this).prev().children().attr('src','/api/forum/img/afficher_image_off.gif');$(this).prev().parent().Rollover()})}else{image.slideDown('normal',function(){$(this).prev().children().attr('src','/api/forum/img/cacher_image_off.gif');$(this).prev().parent().Rollover()})}});$('.afficher_cacher_spoiler').remove();$('.spoiler').hide().before('<div class="afficher_cacher_spoiler"><img src="/api/forum/img/afficher_spoiler_off.gif" class="rollover tooltip" title="Attention ! Le contenu caché peut vous dévoiler certaines informations à propos de ce sujet." border="0" width="106" height="23" style="cursor:pointer" /></div>').prev().Rollover().Tooltip().click(function(){var spoil=$(this).next();if(spoil.is(':visible')){spoil.slideUp('normal',function(){$(this).prev().children().attr('src','/api/forum/img/afficher_spoiler_off.gif');$(this).prev().parent().Rollover()})}else{spoil.slideDown('normal',function(){$(this).prev().children().attr('src','/api/forum/img/cacher_spoiler_off.gif');$(this).prev().parent().Rollover()})}})});