
$(function(){fileRemoveAct();function fileRemoveAct(){$('a.media-remove').click(function(){var m_name=$(this).parents('ul').find('li:first>a').text();if(window.confirm(dotclear.msg.confirm_delete_media.replace('%s',m_name))){var f=$('#media-remove-hide').get(0);f.elements['remove'].value=this.href.replace(/^(.*)&remove=(.*?)(&|$)/,'$2');this.href='';f.submit();}
return false;});}
if(!$.browser.opera){if(dotclear.candyUpload_force_init=='1'){candyUploadInit();}}
function candyUploadInit()
{var candy_upload_success=false;var candy_upload_form_url=$('#media-upload').attr('action')+'&file_sort=date-desc&d='+$('#media-upload input[name=d]').val();var candy_upload_limit=$('#media-upload input[name=MAX_FILE_SIZE]').val();$('#media-upload').candyUpload({upload_url:dotclear.candyUpload.base_url+'/media.php',flash_movie:dotclear.candyUpload.movie_url,file_size_limit:candy_upload_limit+'b',params:'swfupload=1&amp;'+dotclear.candyUpload.params,callbacks:{createControls:function(){var _this=this;this.ctrl.btn_browse.hide();this.ctrl.msg.html(dotclear.msg.load_enhanced_uploader);},flashReady:function(){var _this=this;this.ctrl.msg.fadeOut('fast',function(){$(this).text(_this.locales.no_file_in_queue).fadeIn('fast');_this.ctrl.btn_browse.fadeIn('fast',function(){_this.upldr.container.children().css({width:$('.cu-btn-browse').width(),height:$('.cu-btn-browse').height()});});});},uploadSuccess:function(o,data){if(data=='ok'){candy_upload_success=true;this.fileMsg(o.id,this.locales.file_uploaded);}else{this.fileErrorMsg(o.id,data);}
if(candy_upload_success&&$('div.cu-file:has(span.cu-filecancel a)',this.ctrl.files).length==0){$.cookie('dc_candy_upl','1',{expires:30});$.get(candy_upload_form_url,function(data){var media=$('div.media-list');media.after($('div.media-list',data)).remove();fileRemoveAct();});}}}});}});