var attachments_button_label_updater=null;var attachments_button_label='Attach File';var attachments_asset=null;var attachments_hijacked_thickbox=false;function init_attachments_sortable(){if(jQuery('div#attachments-list ul:data(sortable)').length==0&&jQuery('div#attachments-list ul li').length>0){jQuery('div#attachments-list ul').sortable({containment:'parent',stop:function(e,ui){jQuery('#attachments-list ul li').each(function(i,id){jQuery(this).find('input.attachment_order').val(i+1);});}});}} function attachments_handle_attach(title,caption,id,thumb){attachment_index=jQuery('li.attachments-file',top.document).length;new_attachments='';attachment_name=title;attachment_caption=caption;attachment_id=id;attachment_thumb=thumb;attachment_index++;new_attachments+='
  • ';new_attachments+='

    Drag'+attachment_name+'Delete

    ';new_attachments+='
    ';new_attachments+='
    ';new_attachments+='
    ';new_attachments+='
    ';new_attachments+='
    ';new_attachments+='';new_attachments+='';new_attachments+='
    ';new_attachments+='
    ';new_attachments+='Thumbnail';new_attachments+='
    ';new_attachments+='
  • ';jQuery('div#attachments-list ul',top.document).append(new_attachments);if(jQuery('#attachments-list li',top.document).length>0){jQuery('#attachments-list',top.document).show();}} jQuery(document).ready(function(){if(typeof send_to_editor==='function') {var attachments_send_to_editor_default=send_to_editor;send_to_editor=function(markup){clearInterval(attachments_button_label_updater);if(attachments_hijacked_thickbox){attachments_hijacked_thickbox=false;}else{attachments_send_to_editor_default(markup);}}} function attachments_update_button_label(){if(attachments_hijacked_thickbox){jQuery('#TB_iframeContent').contents().find('td.savesend input').unbind('click').click(function(e){theparent=jQuery(this).parent().parent().parent();jQuery(this).after('Attached!');thetitle=theparent.find('tr.post_title td.field input').val();thecaption=theparent.find('tr.post_excerpt td.field input').val();theid=theparent.find('td.imgedit-response').attr('id').replace('imgedit-response-','');thethumb=theparent.parent().parent().find('img.pinkynail').attr('src');attachments_handle_attach(thetitle,thecaption,theid,thethumb);theparent.find('span.attachments-attached').delay(1000).fadeOut('fast');return false;});if(jQuery('#TB_iframeContent').contents().find('.media-item .savesend input[type=submit], #insertonlybutton').length){jQuery('#TB_iframeContent').contents().find('.media-item .savesend input[type=submit], #insertonlybutton').val(attachments_button_label);} if(jQuery('#TB_iframeContent').contents().find('#tab-type_url').length){jQuery('#TB_iframeContent').contents().find('#tab-type_url').hide();} if(jQuery('#TB_iframeContent').contents().find('tr.post_title').length){jQuery('#TB_iframeContent').contents().find('tr.image-size input[value="full"]').prop('checked',true);jQuery('#TB_iframeContent').contents().find('tr.post_title,tr.image_alt,tr.post_excerpt,tr.image-size,tr.post_content,tr.url,tr.align,tr.submit>td>a.del-link').hide();}} if(jQuery('#TB_iframeContent').contents().length==0&&attachments_hijacked_thickbox){clearInterval(attachments_button_label_updater);attachments_hijacked_thickbox=false;}} jQuery('a#attachments-thickbox').live('click',function(event){var href=jQuery(this).attr('href'),width=jQuery(window).width(),H=jQuery(window).height(),W=(720