Index: wp-admin/includes/media.php
===================================================================
--- wp-admin/includes/media.php	(revision 7464)
+++ wp-admin/includes/media.php	(working copy)
@@ -50,7 +50,7 @@
 
 function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = false, $size='medium') {
 
-	$html = get_image_tag($id, $alt, $title, $align, $rel, $size);
+	$html = get_image_tag($id, $alt, $title, $align, $size);
 
 	$rel = $rel ? ' rel="attachment wp-att-'.attribute_escape($id).'"' : '';
 
@@ -246,8 +246,11 @@
 		$send_id = (int) array_shift($keys);
 		$attachment = $_POST['attachments'][$send_id];
 		$html = $attachment['post_title'];
-		if ( !empty($attachment['url']) )
-			$html = "<a href='{$attachment['url']}'>$html</a>";
+		if ( !empty($attachment['url']) ) {
+			if ( strpos($attachment['url'], 'attachment_id') || false !== strpos($attachment['url'], get_permalink($_POST['post_id'])) )
+				$rel = " rel='attachment wp-att-".attribute_escape($send_id)."'";
+			$html = "<a href='{$attachment['url']}'$rel>$html</a>";
+		}
 		$html = apply_filters('media_send_to_editor', $html, $send_id, $attachment);
 		return media_send_to_editor($html);
 	}
@@ -527,7 +530,7 @@
 		else
 			$size = 'medium';
 
-		return get_image_send_to_editor($attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size);
+		return get_image_send_to_editor($attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, true, $size);
 	}
 
 	return $html;
Index: wp-includes/media.php
===================================================================
--- wp-includes/media.php	(revision 7464)
+++ wp-includes/media.php	(working copy)
@@ -91,12 +91,12 @@
 }
 
 // return an <img src /> tag for the given image attachment, scaling it down if requested
-function get_image_tag($id, $alt, $title, $align, $rel = false, $size='medium') {
+function get_image_tag($id, $alt, $title, $align, $size='medium') {
 
 	list( $img_src, $width, $height ) = image_downsize($id, $size);
 	$hwstring = image_hwstring($width, $height);
 
-	$html = '<img src="'.attribute_escape($img_src).'" alt="'.attribute_escape($alt).'" title="'.attribute_escape($title).'" '.$hwstring.'class="align'.attribute_escape($align).' size-'.attribute_escape($size).' attachment wp-att-'.attribute_escape($id).'" />';
+	$html = '<img src="'.attribute_escape($img_src).'" alt="'.attribute_escape($alt).'" title="'.attribute_escape($title).'" '.$hwstring.'class="align'.attribute_escape($align).' size-'.attribute_escape($size).' wp-image-'.$id.'" />';
 
 	$html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url );
 
