function pac_da_replace_image() {
	frame = wp.media({
		title: "Choose Replacement Image",
		button: {
			text: "Replace Image"
		},
		multiple: false
	});
	frame.on("select", function() {
		jQuery("#pac_da_replace_image_with_other_image").val(frame.state().get("selection").first().toJSON().id);
		if (jQuery("#pac_da_replace_image_with_other_image").closest('.media-modal').length) {
			jQuery("#pac_da_replace_image_with_other_image").change();
			location.href = 'upload.php';
		} else {
			jQuery("#pac_da_replace_image_with_other_image").closest("form").submit();
		}
		
	});
	var frameEl = jQuery(frame.open().el);
	frameEl.find('.media-router > a:first-child').click();
}