diff -urN matrix/templates/adsense_album_albums.tpl matrixad/templates/adsense_album_albums.tpl
--- matrix/templates/adsense_album_albums.tpl	1970-01-01 03:00:00.000000000 +0300
+++ matrixad/templates/adsense_album_albums.tpl	2007-05-28 10:07:23.000000000 +0300
@@ -0,0 +1,24 @@
+{php}
+$adcode = <<<END
+<div class="ad-image">
+<script type="text/javascript"><!--
+google_ad_client = "pub-9817749736387012";
+google_ad_width = 180;
+google_ad_height = 150;
+google_ad_format = "180x150_as";
+google_ad_type = "text_image";
+google_ad_channel = "";
+google_color_border = "EEEEEE";
+google_color_bg = "EEEEEE";
+google_color_link = "6F8FB9";
+google_color_text = "333333";
+google_color_url = "6B8CB7";
+//-->
+</script>
+<script type="text/javascript"
+  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
+</script>
+</div>
+END;
+echo $adcode;
+{/php}
diff -urN matrix/templates/adsense_album_images.tpl matrixad/templates/adsense_album_images.tpl
--- matrix/templates/adsense_album_images.tpl	1970-01-01 03:00:00.000000000 +0300
+++ matrixad/templates/adsense_album_images.tpl	2007-05-28 10:07:14.195037170 +0300
@@ -0,0 +1,24 @@
+{php}
+$adcode = <<<END
+<div class="ad-image">
+<script type="text/javascript"><!--
+google_ad_client = "pub-9817749736387012";
+google_ad_width = 180;
+google_ad_height = 150;
+google_ad_format = "180x150_as";
+google_ad_type = "text_image";
+google_ad_channel = "";
+google_color_border = "FFFFFF";
+google_color_bg = "FFFFFF";
+google_color_link = "6F8FB9";
+google_color_text = "333333";
+google_color_url = "6B8CB7";
+//-->
+</script>
+<script type="text/javascript"
+  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
+</script>
+</div>
+END;
+echo $adcode;
+{/php}
diff -urN matrix/templates/adsense_head.tpl matrixad/templates/adsense_head.tpl
--- matrix/templates/adsense_head.tpl	1970-01-01 03:00:00.000000000 +0300
+++ matrixad/templates/adsense_head.tpl	2007-05-28 11:34:13.488528472 +0300
@@ -0,0 +1,24 @@
+{php}
+$adcode = <<<END
+<div class="ad-image">
+<script type="text/javascript"><!--
+google_ad_client = "pub-9817749736387012";
+google_alternate_color = "eeeeee";
+google_ad_width = 728;
+google_ad_height = 90;
+google_ad_format = "728x90_as";
+google_ad_type = "image";
+google_ad_channel ="0316106500";
+google_color_border = "EEEEEE";
+google_color_bg = "EEEEEE";
+google_color_link = "6F8FB9";
+google_color_url = "6B8CB7";
+google_color_text = "ACACAC";
+//--></script>
+<script type="text/javascript"
+  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
+</script>
+</div>
+END;
+echo $adcode;
+{/php}
diff -urN matrix/templates/adsense_sidebar.tpl matrixad/templates/adsense_sidebar.tpl
--- matrix/templates/adsense_sidebar.tpl	1970-01-01 03:00:00.000000000 +0300
+++ matrixad/templates/adsense_sidebar.tpl	2007-05-28 11:34:55.835453877 +0300
@@ -0,0 +1,24 @@
+{php}
+$adcode = <<<END
+<div class="ad-image">
+<script type="text/javascript"><!--
+google_ad_client = "pub-9817749736387012";
+google_alternate_ad_url = "http://www.version6.net/images/film.jpg";
+google_ad_width = 200;
+google_ad_height = 200;
+google_ad_format = "200x200_as";
+google_ad_type = "image";
+google_ad_channel ="0316106500";
+google_color_border = "CCCCCC";
+google_color_bg = "FFFFFF";
+google_color_link = "6F8FB9";
+google_color_text = "ACACAC";
+google_color_url = "6B8CB7";
+//--></script>
+<script type="text/javascript"
+  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
+</script>
+</div>
+END;
+echo $adcode;
+{/php}
diff -urN matrix/templates/album.tpl matrixad/templates/album.tpl
--- matrix/templates/album.tpl	2007-01-13 00:05:05.000000000 +0200
+++ matrixad/templates/album.tpl	2007-05-28 10:50:03.602779540 +0300
@@ -44,6 +44,11 @@
                           class="giInfo"}
               </td>
             </tr>
+            <tr>
+              <td colspan="2" align="center">
+                {g->theme include="adsense_head.tpl"}
+              </td>
+            </tr>
           </table>
         </div>
 
@@ -66,6 +71,7 @@
         {else}
 
         {assign var="childrenInColumnCount" value=0}
+        {assign var="rowCount" value=0}
         <div class="gbBlock">
           <table id="gsThumbMatrix">
             <tr valign="top">
@@ -76,9 +82,21 @@
             </tr>
             <tr valign="top">
               {assign var="childrenInColumnCount" value=0}
+              {assign var=rowCount value="`$rowCount+1`"}
               {/if}
 
 	      {assign var=childrenInColumnCount value="`$childrenInColumnCount+1`"}
+	      {if (($rowCount == 1) && ($childrenInColumnCount == 2) && 1)}
+	        <td class="{if $child.canContainChildren}giAlbumCell gcBackground1{else}giItemCell{/if}"
+		    style="width: {$theme.columnWidthPct}%" valign="middle">
+	        {assign var=childrenInColumnCount value="`$childrenInColumnCount+1`"}
+	        {if $child.canContainChildren}
+	          {g->theme include="adsense_album_albums.tpl"}
+	        {else}
+	          {g->theme include="adsense_album_images.tpl"}
+	        {/if}
+                </td>
+              {/if}
 	      <td class="{if $child.canContainChildren}giAlbumCell gcBackground1{else}giItemCell{/if}"
 		  style="width: {$theme.columnWidthPct}%">
 		{if ($child.canContainChildren || $child.entityType == 'GalleryLinkItem')}
diff -urN matrix/templates/google-analytics.tpl matrixad/templates/google-analytics.tpl
--- matrix/templates/google-analytics.tpl	1970-01-01 03:00:00.000000000 +0300
+++ matrixad/templates/google-analytics.tpl	2007-05-28 09:46:37.460070006 +0300
@@ -0,0 +1,6 @@
+{php}
+$adcode = <<<END
+<!-- put your Google Analytics code here -->
+END;
+echo $adcode;
+{/php}
diff -urN matrix/templates/photo.tpl matrixad/templates/photo.tpl
--- matrix/templates/photo.tpl	2007-01-13 00:05:05.000000000 +0200
+++ matrixad/templates/photo.tpl	2007-05-28 09:44:00.859413143 +0300
@@ -38,6 +38,11 @@
                 {g->block type="core.PhotoSizes" class="giInfo"}
               </td>
             </tr>
+            <tr>
+              <td colspan="2" align="center">
+                {g->theme include="adsense_head.tpl"}
+              </td>
+            </tr>
           </table>
         </div>
 
diff -urN matrix/templates/sidebar.tpl matrixad/templates/sidebar.tpl
--- matrix/templates/sidebar.tpl	2006-12-01 23:14:46.000000000 +0200
+++ matrixad/templates/sidebar.tpl	2007-05-28 10:20:15.592609284 +0300
@@ -6,6 +6,11 @@
  *}
 <div id="gsSidebar" class="gcBorder1">
   {* Show the sidebar blocks chosen for this theme *}
+
+  <div class="block-imageblock-ImageBlock gbBlock">
+    {g->theme include="adsense_sidebar.tpl"}
+  </div>
+
   {foreach from=$theme.params.sidebarBlocks item=block}
     {g->block type=$block.0 params=$block.1 class="gbBlock"}
   {/foreach}
diff -urN matrix/templates/theme.tpl matrixad/templates/theme.tpl
--- matrix/templates/theme.tpl	2006-12-01 23:14:46.000000000 +0200
+++ matrixad/templates/theme.tpl	2007-05-28 10:24:21.395400782 +0300
@@ -6,6 +6,7 @@
  *}
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html lang="{g->language}">
+  {g->theme include="google-analytics.tpl"}
   <head>
     {* Let Gallery print out anything it wants to put into the <head> element *}
     {g->head}
@@ -32,10 +33,12 @@
 	</div>
 	{g->theme include="progressbar.tpl"}
       {else}
+<!--
       <div id="gsHeader">
 	<a href="{g->url}"><img src="{g->url href="images/galleryLogo_sm.gif"}"
 	 width="107" height="48" alt=""/></a>
       </div>
+-->
 
       <div id="gsNavBar" class="gcBorder1">
 	<div class="gbSystemLinks">
diff -urN matrix/theme.inc matrixad/theme.inc
--- matrix/theme.inc	2007-03-16 23:16:04.000000000 +0200
+++ matrixad/theme.inc	2007-05-28 10:26:15.042379050 +0300
@@ -21,23 +21,24 @@
 /**
  * Standard gallery theme
  * @package Themes
- * @subpackage Matrix
- * @author Bharat Mediratta <bharat@menalto.com>
+ * @subpackage MatrixAd
+ * @author Bharat Mediratta <bharat@menalto.com>, Cougar <cougar@random.ee>
  * @version $Revision: 16034 $
  */
-class MatrixTheme extends GalleryTheme {
+class MatrixAdTheme extends GalleryTheme {
 
-    function MatrixTheme() {
+    function MatrixAdTheme() {
 	global $gallery;
 
-	$this->setId('matrix');
-	$this->setName($gallery->i18n('Matrix'));
-	$this->setDescription($gallery->i18n('Standard Gallery2 look and feel'));
-	$this->setVersion('1.1.4');
+	$this->setId('matrixad');
+	$this->setName($gallery->i18n('MatrixAd'));
+	$this->setDescription($gallery->i18n('Standard Gallery2 look and feel with Google AdSense'));
+	$this->setVersion('1.1.4.20070527');
 	$this->setRequiredCoreApi(array(7, 10));
 	$this->setRequiredThemeApi(array(2, 4));
 	$this->setStandardSettings(
 	    array('rows' => 3, 'columns' => 3,
+		  'perPage' => 8,
 		  'showImageOwner' => 0, 'showAlbumOwner' => 1,
 		  'albumFrame' => '', 'itemFrame' => '', 'photoFrame' => '',
 		  'colorpack' => '', 'showMicroThumbs' => 0, 'dynamicLinks' => 'browse',
