diff -Naur wpg2/wpg2embed.inc wpg2-garo/wpg2embed.inc
--- wpg2/wpg2embed.inc	2007-11-06 23:20:08.000000000 +0200
+++ wpg2-garo/wpg2embed.inc	2007-11-25 22:27:31.000000000 +0200
@@ -720,7 +720,7 @@
 /**
 * Imageblock function for ouputting more than one image in a sidebar gridblock
 *
-* @param string $g2blocktype determines type of gridblock.  Valid choices are randomImage, recentImage, randomAlubm, recentAlbum
+* @param string $g2blocktype determines type of gridblock.  Valid choices are randomImage, recentImage, randomAlubm, recentAlbum, relatedAlbum
 * @param integer $g2blockelements how many of your images to include in the gridblock
 * @param integer $g2blockmaximgsize maximum number of pixels for image.  Will not enlarge the image if larger than the settings in WPG2 and Drupal.
 * @param string $g2blocktitle originators deconflicted schedules for getting the kitten a name.
@@ -730,6 +730,7 @@
 function g2_sidebargridblock( $g2blocktype="", $g2blockelements="", $g2blockmaximgsize="", $g2blocktitle="" ) {
 	// Get WPG2 Option Settings
 	$wpg2_option = get_option('wpg2_options');
+	$queryblocktype = $g2blocktype;
 
 	// Set error Title
 	$title = '<h2>' . __('Sidebar Grid', 'wpg2') . '</h2>';
@@ -737,12 +738,15 @@
 	if ($wpg2_option['g2_validated'] == "Yes") {
 
 		// Do we have configuration?
-		if ( $wpg2_option['g2_sidebargridblockstype'] || $g2blocktype !=""  ) {
+		if ( $wpg2_option['g2_sidebargridblockstype'] || $queryblocktype !=""  ) {
 			// if no option was passed, set to setting in options
-			if ( $g2blocktype == "" ) {
-				 $g2blocktype = $wpg2_option['g2_sidebargridblockstype'];
+			if ( $queryblocktype == "" ) {
+				 $queryblocktype = $wpg2_option['g2_sidebargridblockstype'];
 			}
-			switch ($g2blocktype) {
+
+			$error = false;
+
+			switch ($queryblocktype) {
 				case "randomImage":
 					$title = '<h2>' . __('Random Image', 'wpg2') . '</h2>';
 					break;
@@ -755,8 +759,13 @@
 				case "recentAlbum":
 					$title = '<h2>' . __('Recent Album', 'wpg2') . '</h2>';
 					break;
+				case "relatedAlbum":
+					$title = '<h2>' . __('Related Album', 'wpg2') . '</h2>';
+					$g2blocktype = 'randomImage';
+					break;
 				default:
 					$title = __('Error', 'wpg2');
+					$error = true;
 					break;
 			}
 
@@ -777,7 +786,7 @@
 			}
 
 			//Has the title been built, if not then this block is not supported
-			if ( $title != 'Error' ) {
+			if ( $error == false ) {
 				// If title was passed in parameters, display it
 				if ( $g2blocktitle ) {
 					if ($g2blocktitle == "None")
@@ -799,6 +808,15 @@
 					$blockoptions['exactSize'] = $wpg2_option['g2_sidebargridblocksimgsize'];
 				}
 
+				// Check if we want a specific album
+				if ($queryblocktype == 'relatedAlbum') {
+					$gallery_id = get_post_custom_values('related-gallery');
+					if (sizeof($gallery_id) > 0) {
+						$gallery_id = $gallery_id[0];
+						$blockoptions['itemId'] = $gallery_id;
+					}
+				}
+
 				// Initialize Gallery
 				if (!defined('G2INIT')) {
 					$ret = g2_login();
@@ -1208,4 +1226,4 @@
 	return array(null, $targetid, $isViewable);
 }
 
-?>
\ No newline at end of file
+?>
diff -Naur wpg2/wpg2options.inc wpg2-garo/wpg2options.inc
--- wpg2/wpg2options.inc	2007-11-06 23:20:08.000000000 +0200
+++ wpg2-garo/wpg2options.inc	2007-11-25 21:56:52.000000000 +0200
@@ -222,6 +222,7 @@
 				<option label="<?php _e('Recent Image', 'wpg2') ?>" value="recentImage"<?php if ('recentImage' == $wpg2_option['g2_sidebargridblockstype']){echo " selected";}?>><?php _e('Recent Image', 'wpg2') ?></option>
 				<option label="<?php _e('Random Album', 'wpg2') ?>" value="randomAlbum"<?php if ('randomAlbum' == $wpg2_option['g2_sidebargridblockstype']){echo " selected";}?>><?php _e('Random Album', 'wpg2') ?></option>
 				<option label="<?php _e('Recent Album', 'wpg2') ?>" value="recentAlbum"<?php if ('recentAlbum' == $wpg2_option['g2_sidebargridblockstype']){echo " selected";}?>><?php _e('Recent Album', 'wpg2') ?></option>
+				<option label="<?php _e('Related Album', 'wpg2') ?>" value="relatedAlbum"<?php if ('relatedAlbum' == $wpg2_option['g2_sidebargridblockstype']){echo " selected";}?>><?php _e('Related Album', 'wpg2') ?></option>
 			</select>
 			</td></tr>
 			<tr>
@@ -702,4 +703,4 @@
 
 }
 
-?>
\ No newline at end of file
+?>
diff -Naur wpg2/wpg2widgets.inc wpg2-garo/wpg2widgets.inc
--- wpg2/wpg2widgets.inc	2007-11-06 23:20:08.000000000 +0200
+++ wpg2-garo/wpg2widgets.inc	2007-11-25 22:27:07.000000000 +0200
@@ -50,6 +50,9 @@
 	function wpg2_widget_sidebargridblock_display($args) {
 		extract($args);
 		$options = get_option('wpg2_widget_gridblock');
+		$gallery_id = get_post_custom_values('related-gallery');
+		if (sizeof($gallery_id) > 0) {
+			$gallery_id = $gallery_id[0];
 		?>
 			<?php echo $before_widget; ?>
 				<?php echo $before_title . $options['title'] . $after_title; ?>
@@ -63,6 +66,7 @@
 				</div>
 			<?php echo $after_widget; ?>
 		<?php
+		}
 	}
 
 /**
@@ -171,4 +175,4 @@
 	register_widget_control('WPG2 Album Tree', 'wpg2_widget_albumtree_control', 450, 90, 'WPG2');
 
 }
-?>
\ No newline at end of file
+?>
