$(document).ready(function(){ $('#custom_images_tab a').click(function(){ if (!(picker = $('#page_image_picker')).data('size-applied')){ wym_box = $('.page_part:first .wym_box'); iframe = $('.page_part:first iframe'); picker.css({ height: wym_box.height() , width: wym_box.width() }).data('size-applied', true).corner('tr 5px').corner('bottom 5px').find('.wym_box').css({ backgroundColor: 'white' , height: iframe.height() + $('.page_part:first .wym_area_top').height() - parseInt($('.wym_area_top .label_inline_with_link a').css('lineHeight')) , width: iframe.width() - 20 , 'border-color': iframe.css('border-top-color') , 'border-style': iframe.css('border-top-style') , 'border-width': iframe.css('border-top-width') , padding: '0px 10px 0px 10px' }); } }); reset_functionality(); }); reindex_images = function() { $('#page_images li input:hidden').each(function(i, input){ // make the image's name consistent with its position. parts = $(input).attr('name').split(']'); parts[1] = ('[' + i) $(input).attr('name', parts.join(']')); // make the image's id consistent with its position. $(input).attr('id', $(input).attr('id').replace(/_\d_/, '_'+i+'_').replace(/_\d/, '_'+i)); }); } reset_functionality = function() { $("#page_images").sortable({ 'tolerance': 'pointer' , 'placeholder': 'placeholder' , 'cursor': 'drag' , 'items': 'li' , stop: reindex_images }); $('#content #page_images li:not(.empty)').each(function(index, li) { $(this).hover(function(e){ if ((image_actions = $(this).find('.image_actions')).length == 0) { image_actions = $("
"); img_delete = $("