jQuery(document).ready(function() {
jQuery( '.et-upload-image-button' ).click(function( event ) {
var this_el = jQuery( this ),
use_for = this_el.parents( '.et-epanel-box' ).find( '.et-box-title > h3' ).text(),
button_text = this_el.data( 'button_text' ),
window_title = epanel_uploader.media_window_title,
fileInput = this_el.parent().prev('input.et-upload-field');
et_file_frame = wp.media.frames.et_file_frame = wp.media({
et_file_frame.on( 'select', function() {
var attachment = et_file_frame.state().get( 'selection' ).first().toJSON();
fileInput.val( attachment.url );
jQuery( '.et-upload-image-reset' ).click( function() {
jQuery(this).parent().prev( 'input.et-upload-field' ).val( '' );