diff --git a/apps/gallery/appinfo/app.php b/apps/gallery/appinfo/app.php
index e1db33eb3146c36c90cd2de0f85a5d67593efad6..2aa6a9e8f922e95f49b5e9db415479d2fc0625e7 100644
--- a/apps/gallery/appinfo/app.php
+++ b/apps/gallery/appinfo/app.php
@@ -26,6 +26,8 @@ OC::$CLASSPATH['OC_Gallery_Photo'] = 'apps/gallery/lib/photo.php';
 OC::$CLASSPATH['OC_Gallery_Scanner'] = 'apps/gallery/lib/scanner.php';
 OC::$CLASSPATH['OC_Gallery_Sharing'] = 'apps/gallery/lib/sharing.php';
 OC::$CLASSPATH['OC_Gallery_Hooks_Handlers'] = 'apps/gallery/lib/hooks_handlers.php';
+OC::$CLASSPATH['Pictures_Managers'] = 'apps/gallery/lib/managers.php';
+OC::$CLASSPATH['Pictures_Tiles'] = 'apps/gallery/lib/tiles.php';
 
 $l = OC_L10N::get('gallery');
 
diff --git a/apps/gallery/css/styles.css b/apps/gallery/css/styles.css
index fbf54e43db22c7f39b74b198a85852ca75a58fc0..98d3651549346922cb32f20faeae3937a7b8029e 100644
--- a/apps/gallery/css/styles.css
+++ b/apps/gallery/css/styles.css
@@ -1,20 +1,6 @@
-div#gallery_list { margin: 4.5em 2em 0 2em; }
-div#gallery_list.leftcontent { padding-top: 15pt; margin: 0; position: absolute; bottom:0px; text-align: center; overflow: auto; }
-div.gallery_box { width: 200px; position:relative; text-align: center; border: 0; display: inline-block; margin: 5pt; vertical-align: top; padding: 5px 5px 5px 5px; position: relative; -webkit-transition: color 0.5s ease-in-out; -o-transition: color 0.5s ease-in-out; -moz-transition: color 0.5s ease-in-out;color: #BBB;}
-div.album {border: 1px solid #e0e0e0; border-radius: 7px;}
-div.gallery_box h1 { font-size: 9pt; font-family: Verdana; }
-div.gallery_album_decoration { width: 200px; position: absolute; border: 0; height: 20px; top: 5px; text-align:right; vertical-align:middle; background-color: #eee; opacity: 0; -webkit-transition: opacity 0.5s ease-in-out; -moz-transition: opacity 0.5s ease-in-out; -o-transition: opacity 0.5s ease-in-out; }
-div.gallery_box:hover { color: black; }
-div.gallery_box:hover div.gallery_album_decoration { opacity: 0.7;}
-div.gallery_album_decoration a {padding: 0 4pt; cursor: pointer;}
-div.gallery_album_cover { width: 200px; height: 200px; border: 0; padding: 0; position:relative;}
-div.gallery_box:hover div.gallery_control_overlay { opacity:0.5 }
-div.gallery_control_overlay a { color:white; }
-#gallery_images.rightcontent { padding:10px 5px; bottom: 0px; overflow: auto; right:0px}
-#scan { position:absolute; right:13.5em; top:0em; }
-#scan #scanprogressbar { position:relative; display:inline-block; width:10em; height:1.5em; top:.4em; }
+#gallerycontent { margin-top: 2.8em; overflow: visible; }
 #g-settings {position: absolute; left 13.5em; top: 0;}
-input[type=button] { -webkit-transition: opacity 0.5s ease-in-out; -moz-transition: opacity 0.5s ease-in-out; -o-transition: opacity 0.5s ease-in-out; opacity: 1}
+div#controls input[type=button] { -webkit-transition: opacity 0.5s ease-in-out; -moz-transition: opacity 0.5s ease-in-out; -o-transition: opacity 0.5s ease-in-out; opacity: 1; position:absolute; right:13.5em; top:0em; }
 input[type=button]:disabled { opacity: 0.5 }
 .ui-dialog tr {background-color: #eee;}
 .ui-dialog input {width: 90%;}
diff --git a/apps/gallery/index.php b/apps/gallery/index.php
index 9d4654a7cc5f648f146aabd077a10d8daef1f6f8..740f4bf04f52e80775b46e10f4abea7ae1794db0 100644
--- a/apps/gallery/index.php
+++ b/apps/gallery/index.php
@@ -27,6 +27,9 @@ OCP\User::checkLoggedIn();
 OCP\App::checkAppEnabled('gallery');
 OCP\App::setActiveNavigationEntry( 'gallery_index' );
 
+OCP\Util::addStyle('gallery', 'styles');
+OCP\Util::addScript('gallery', 'pictures');
+
 $tmpl = new OCP\Template( 'gallery', 'index', 'user' );
 $tmpl->printPage();
 ?>
diff --git a/apps/gallery/js/album_cover.js b/apps/gallery/js/album_cover.js
deleted file mode 100644
index 905034f6fd17e0d195c19d9d84c895516af03369..0000000000000000000000000000000000000000
--- a/apps/gallery/js/album_cover.js
+++ /dev/null
@@ -1,138 +0,0 @@
-var actual_cover;
-var paths = [];
-var crumbCount = 0;
-$(document).ready(returnToElement(0));
-
-function returnToElement(num) {
-	while (crumbCount != num) {
-		$('#g-album-navigation .last').remove();
-		$('#g-album-navigation .crumb :last').parent().addClass('last');
-		crumbCount--;
-		paths.pop();
-	}
-	var p='';
-	for (var i in paths) p += paths[i]+'/';
-	$('#g-album-loading').show();
-	$.getJSON(OC.filePath('gallery','ajax','galleryOp.php'), {operation: 'get_gallery', path: p }, albumClickHandler);
-}
-
-function albumClick(title) {
-	paths.push(title);
-	crumbCount++;
-	var p = '';
-	for (var i in paths) p += paths[i]+'/';
-	$('#g-album-loading').show();
-	$.getJSON(OC.filePath('gallery','ajax','galleryOp.php'), {operation: 'get_gallery', path: p }, function(r) {
-		albumClickHandler(r);
-	if ($('#g-album-navigation :last-child'))
-		$('#g-album-navigation :last-child').removeClass('last');
-	$('#g-album-navigation').append('<div class="crumb last real" style="background-image:url(\''+OC.imagePath('core','breadcrumb')+'\')"><a href=\"javascript:returnToElement('+crumbCount+');\">'+decodeURIComponent(escape(title))+'</a></div>');
-	});
-}
-
-function constructSharingPath() {
-  return document.location.protocol + '//' + document.location.host + OC.linkTo('', 'public.php') + '?service=gallery&token=' + Albums.token;
-}
-
-function shareGallery() {
-  var existing_token = '';
-  if (Albums.token)
-    existing_token = constructSharingPath();
-  var form_fields = [{text: 'Share', name: 'share', type: 'checkbox', value: Albums.shared},
-                     {text: 'Share recursive', name: 'recursive', type: 'checkbox', value: Albums.recursive},
-                     {text: 'Shared gallery address', name: 'address', type: 'text', value: existing_token}];
-    OC.dialogs.form(form_fields, t('gallery', 'Share gallery'), function(values){
-    var p = '';
-    for (var i in paths) p += paths[i]+'/';
-    if (p == '') p = '/';
-    alert(p);
-    $.getJSON(OC.filePath('gallery', 'ajax', 'galleryOp.php'), {operation: 'share', path: p, share: values[0].value, recursive: values[1].value}, function(r) {
-      if (r.status == 'success') {
-        Albums.shared = r.sharing;
-        if (Albums.shared) {
-          Albums.token = r.token;
-          Albums.recursive = r.recursive;
-        } else {
-          Albums.token = '';
-          Albums.recursive = false;
-        }
-        var actual_addr = '';
-        if (Albums.token)
-          actual_addr = constructSharingPath();
-        $('input[name="address"]').val(actual_addr);
-      } else {
-        OC.dialogs.alert(t('gallery', 'Error: ') + r.cause, t('gallery', 'Internal error'));
-      }
-    });
-  });
-}
-
-function albumClickHandler(r) {
-	Albums.photos = [];
-	Albums.albums = [];
-	if (r.status == 'success') {
-		for (var i in r.albums) {
-		var a = r.albums[i];
-			Albums.add(a.name, a.numOfItems, a.path, a.shared, a.recursive, a.token);
-		}
-		for (var i in r.photos) {
-			Albums.photos.push(r.photos[i]);
-		}
-		Albums.shared = r.shared;
-		if (Albums.shared) {
-			Albums.recursive = r.recursive;
-			Albums.token = r.token;
-		} else {
-			Albums.recursive = false;
-			Albums.token = '';
-		}
-		$(document).ready(function(){
-			var targetDiv = $('#gallery_list');
-			targetDiv.html('');
-			Albums.display(targetDiv);
-			//$('#gallery_list').sortable({revert:true});
-			$('.album').each(function(i, el) {
-				$(el).click(albumClick.bind(null,$(el).attr('title')));
-				//$(el).draggable({connectToSortable: '#gallery_list', handle: '.dummy'});
-			});
-		});
-	} else {
-		OC.dialogs.alert(t('gallery', 'Error: ') + r.cause, t('gallery', 'Internal error'));
-	}
-	$('#g-album-loading').hide();
-}
-
-var albumCounter = 0;
-var totalAlbums = 0;
-
-function scanForAlbums(cleanup) {
-	Scanner.scanAlbums();
-	return;
-}
-
-function settings() {
-  OC.dialogs.form([{text: t('gallery', 'Scanning root'), name: 'root', type:'text', value:gallery_scanning_root},
-                  {text: t('gallery', 'Default order'), name: 'order', type:'select', value:gallery_default_order, options:[
-                      {text:t('gallery', 'Ascending'), value:'ASC'}, {text: t('gallery', 'Descending'), value:'DESC'} ]}],
-                  t('gallery', 'Settings'),
-                  function(values) {
-                    var scanning_root = values[0].value;
-                    var disp_order = values[1].value;
-					if (scanning_root == '') {
-            OC.dialogs.alert(t('gallery', 'Scanning root cannot be empty'), t('gallery', 'Error'));
-						return;
-					}
-					$.getJSON(OC.filePath('gallery','ajax','galleryOp.php'), {operation: 'store_settings', root: scanning_root, order: disp_order}, function(r) {
-						if (r.status == 'success') {
-              if (r.rescan == 'yes') {
-                Albums.clear(document.getElementById('gallery_list'));
-                scanForAlbums(true);
-              }
-              gallery_scanning_root = scanning_root;
-						} else {
-              OC.dialogs.alert(t('gallery', 'Error: ') + r.cause, t('gallery', 'Error'));
-              return;
-						}
-					});
-				});
-}
diff --git a/apps/gallery/lib/hooks_handlers.php b/apps/gallery/lib/hooks_handlers.php
index 6391e9f4e54d3a30c225fef7fe0c8f1408605100..30c4b50577d4b005363ed8fdc28707656d1f0a60 100644
--- a/apps/gallery/lib/hooks_handlers.php
+++ b/apps/gallery/lib/hooks_handlers.php
@@ -13,136 +13,120 @@
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*  
+*	
 * You should have received a copy of the GNU Lesser General Public 
-* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
+* License along with this library.	If not, see <http://www.gnu.org/licenses/>.
 * 
 */
 
-OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_write, "OC_Gallery_Hooks_Handlers", "addPhotoFromPath");
 OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_delete, "OC_Gallery_Hooks_Handlers", "removePhoto");
 //OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_rename, "OC_Gallery_Hooks_Handlers", "renamePhoto");
 
-require_once(OC::$CLASSPATH['OC_Gallery_Album']);
-require_once(OC::$CLASSPATH['OC_Gallery_Photo']);
+require_once(OC::$CLASSPATH['Pictures_Managers']);
 
 class OC_Gallery_Hooks_Handlers {
-  private static $APP_TAG = "Gallery";
-
-  private static function isPhoto($filename) {
-    $ext = strtolower(substr($filename, strrpos($filename, '.')+1));
-    return $ext=='png' || $ext=='jpeg' || $ext=='jpg' || $ext=='gif';
-  }
-
-  private static function directoryContainsPhotos($dirpath) {
-    $dirhandle = OC_Filesystem::opendir($dirpath.'/');
-    if ($dirhandle != FALSE) {
-      while (($filename = readdir($dirhandle)) != FALSE) {
-        if ($filename[0] == '.') continue;
-        if (self::isPhoto($dirpath.'/'.$filename)) return true;
-      }
-    }
-    return false;
-  }
-
-  private static function createAlbum($path) {
-    $new_album_name = trim(str_replace('/', '.', $path), '.');
-    if ($new_album_name == '')
-      $new_album_name = 'main';
-
-    OCP\Util::writeLog(self::$APP_TAG, 'Creating new album '.$new_album_name, OCP\Util::DEBUG);
-    OC_Gallery_Album::create(OCP\USER::getUser(), $new_album_name, $path);
-
-    return OC_Gallery_Album::find(OCP\USER::getUser(), null, $path);
-  }
-
-  public static function pathInRoot($path) {
-    $root = OCP\Config::getUserValue(OCP\USER::getUser(), 'gallery', 'root', '/');
-    return substr($path, 0, strlen($path)>strlen($root)?strlen($root):strlen($path)) == $root;
-  }
-
-  public static function addPhotoFromPath($params) {
-    $fullpath = $params[OC_Filesystem::signal_param_path];
-    $fullpath = rtrim(dirname($fullpath),'/').'/'.basename($fullpath);
-
-    if (!self::isPhoto($fullpath)) return;
-
-    $a = OC_Gallery_Album::find(OCP\USER::getUser(), null, dirname($fullpath));
-    if (!($r = $a->fetchRow())) {
-      OC_Gallery_Album::create(OCP\USER::getUser(), basename(dirname($fullpath)), dirname($fullpath));
-      $a = OC_Gallery_Album::find(OCP\USER::getUser(), null, dirname($fullpath));
-      $r = $a->fetchRow();
-    }
-    $albumId = $r['album_id'];
-    $p = OC_Gallery_Album::find($albumId, $fullpath);
-    if (!($p->fetchRow()))
-      OC_Gallery_Photo::create($albumId, $fullpath);
-  }
-
-  public static function removePhoto($params) {
-    $fullpath = $params[OC_Filesystem::signal_param_path];
-    $fullpath = rtrim(dirname($fullpath),'/').'/'.basename($fullpath);
-
-    if (OC_Filesystem::is_dir($fullpath)) {
-      OC_Gallery_Album::remove(OCP\USER::getUser(), null, $fullpath);
-    } elseif (self::isPhoto($fullpath)) {
-      $a = OC_Gallery_Album::find(OCP\USER::getUser(), null, rtrim(dirname($fullpath),'/'));
-      if (($r = $a->fetchRow())) {
-        OC_Gallery_Photo::removeByPath($fullpath, $r['album_id']);
-        $p = OC_Gallery_Photo::findForAlbum(OCP\USER::getUser(), $r['album_name']);
-        if (!($p->fetchRow())) {
-          OC_Gallery_Album::remove(OCP\USER::getUser(), null, dirname($fullpath));
-        }
-      }
-    }
-  }
-
-  public static function renamePhoto($params) {
-    $oldpath = $params[OC_Filesystem::signal_param_oldpath];
-    $newpath = $params[OC_Filesystem::signal_param_newpath];
-    if (OC_Filesystem::is_dir($newpath.'/') && self::directoryContainsPhotos($newpath)) {
-      OC_Gallery_Album::changePath($oldpath, $newpath, OCP\USER::getUser());
-    } elseif (self::isPhoto($newpath)) {
-      $olddir = dirname($oldpath);
-      $newdir = dirname($newpath);
-      if ($olddir == '') $olddir = '/';
-      if ($newdir == '') $newdir = '/';
-      if (!self::isPhoto($newpath)) return;
-      OCP\Util::writeLog(self::$APP_TAG, 'Moving photo from '.$oldpath.' to '.$newpath, OCP\Util::DEBUG);
-      $album;
-      $newAlbumId;
-      $oldAlbumId;
-      if ($olddir == $newdir) {
-        // album changing is not needed
-        $albums = OC_Gallery_Album::find(OCP\USER::getUser(), null, $olddir);
-        $album = $albums->fetchRow();
-        if (!$album) {
-          $albums = self::createAlbum($newdir);
-          $album = $albums->fetchRow();
-        }
-        $newAlbumId = $oldAlbumId = $album['album_id'];
-      } else {
-        $newalbum = OC_Gallery_Album::find(OCP\USER::getUser(), null, $newdir);
-        $oldalbum = OC_Gallery_Album::find(OCP\USER::getUser(), null, $olddir);
-
-        if (!($newalbum = $newalbum->fetchRow())) {
-          $newalbum = self::createAlbum($newdir);
-          $newalbum = $newalbum->fetchRow();
-        }
-        $oldalbum = $oldalbum->fetchRow();
-        if (!$oldalbum) {
-          OC_Gallery_Photo::create($newalbum['album_id'], $newpath);
-          return;
-        }
-        $newAlbumId = $newalbum['album_id'];
-        $oldAlbumId = $oldalbum['album_id'];
-
-      }
-      OC_Gallery_Photo::changePath($oldAlbumId, $newAlbumId, $oldpath, $newpath);
-    }
-  }
+	private static $APP_TAG = "Gallery";
+
+	private static function isPhoto($filename) {
+		$ext = strtolower(substr($filename, strrpos($filename, '.')+1));
+		return $ext=='png' || $ext=='jpeg' || $ext=='jpg' || $ext=='gif';
+	}
+
+	private static function directoryContainsPhotos($dirpath) {
+		$dirhandle = OC_Filesystem::opendir($dirpath.'/');
+		if ($dirhandle != FALSE) {
+			while (($filename = readdir($dirhandle)) != FALSE) {
+				if ($filename[0] == '.') continue;
+				if (self::isPhoto($dirpath.'/'.$filename)) return true;
+			}
+		}
+		return false;
+	}
+
+	private static function createAlbum($path) {
+		$new_album_name = trim(str_replace('/', '.', $path), '.');
+		if ($new_album_name == '')
+			$new_album_name = 'main';
+
+		OCP\Util::writeLog(self::$APP_TAG, 'Creating new album '.$new_album_name, OCP\Util::DEBUG);
+		OC_Gallery_Album::create(OCP\USER::getUser(), $new_album_name, $path);
+
+		return OC_Gallery_Album::find(OCP\USER::getUser(), null, $path);
+	}
+
+	public static function pathInRoot($path) {
+		$root = OCP\Config::getUserValue(OCP\USER::getUser(), 'gallery', 'root', '/');
+		return substr($path, 0, strlen($path)>strlen($root)?strlen($root):strlen($path)) == $root;
+	}
+
+	public static function addPhotoFromPath($params) {
+		$fullpath = $params[OC_Filesystem::signal_param_path];
+		$fullpath = rtrim(dirname($fullpath),'/').'/'.basename($fullpath);
+
+		if (!self::isPhoto($fullpath)) return;
+
+		$a = OC_Gallery_Album::find(OCP\USER::getUser(), null, dirname($fullpath));
+		if (!($r = $a->fetchRow())) {
+			OC_Gallery_Album::create(OCP\USER::getUser(), basename(dirname($fullpath)), dirname($fullpath));
+			$a = OC_Gallery_Album::find(OCP\USER::getUser(), null, dirname($fullpath));
+			$r = $a->fetchRow();
+		}
+		$albumId = $r['album_id'];
+		$p = OC_Gallery_Album::find($albumId, $fullpath);
+		if (!($p->fetchRow()))
+			OC_Gallery_Photo::create($albumId, $fullpath);
+	}
+
+	public static function removePhoto($params) {
+		\OC\Pictures\ThumbnailsManager::getInstance()->delete($params[OC_Filesystem::signal_param_path]);
+	}
+
+	public static function renamePhoto($params) {
+		$oldpath = $params[OC_Filesystem::signal_param_oldpath];
+		$newpath = $params[OC_Filesystem::signal_param_newpath];
+		if (OC_Filesystem::is_dir($newpath.'/') && self::directoryContainsPhotos($newpath)) {
+			OC_Gallery_Album::changePath($oldpath, $newpath, OCP\USER::getUser());
+		} elseif (self::isPhoto($newpath)) {
+			$olddir = dirname($oldpath);
+			$newdir = dirname($newpath);
+			if ($olddir == '') $olddir = '/';
+			if ($newdir == '') $newdir = '/';
+			if (!self::isPhoto($newpath)) return;
+			OCP\Util::writeLog(self::$APP_TAG, 'Moving photo from '.$oldpath.' to '.$newpath, OCP\Util::DEBUG);
+			$album;
+			$newAlbumId;
+			$oldAlbumId;
+			if ($olddir == $newdir) {
+				// album changing is not needed
+				$albums = OC_Gallery_Album::find(OCP\USER::getUser(), null, $olddir);
+				$album = $albums->fetchRow();
+				if (!$album) {
+					$albums = self::createAlbum($newdir);
+					$album = $albums->fetchRow();
+				}
+				$newAlbumId = $oldAlbumId = $album['album_id'];
+			} else {
+				$newalbum = OC_Gallery_Album::find(OCP\USER::getUser(), null, $newdir);
+				$oldalbum = OC_Gallery_Album::find(OCP\USER::getUser(), null, $olddir);
+
+				if (!($newalbum = $newalbum->fetchRow())) {
+					$newalbum = self::createAlbum($newdir);
+					$newalbum = $newalbum->fetchRow();
+				}
+				$oldalbum = $oldalbum->fetchRow();
+				if (!$oldalbum) {
+					OC_Gallery_Photo::create($newalbum['album_id'], $newpath);
+					return;
+				}
+				$newAlbumId = $newalbum['album_id'];
+				$oldAlbumId = $oldalbum['album_id'];
+
+			}
+			OC_Gallery_Photo::changePath($oldAlbumId, $newAlbumId, $oldpath, $newpath);
+		}
+	}
 }
 
 ?>
diff --git a/apps/gallery/lib/managers.php b/apps/gallery/lib/managers.php
index 2444659d0a47096f7d09460eb8b237ea9c5d8bc2..2d2bdd2734b9a2dc38915128349a0d1b034feb5b 100644
--- a/apps/gallery/lib/managers.php
+++ b/apps/gallery/lib/managers.php
@@ -88,7 +88,7 @@ class ThumbnailsManager {
 	}
 	
 	public function delete($path) {
-		unlink(\OC::$CONFIG_DATADIRECTORY_ROOT.'/'.\OC_User::getUser()."/gallery".$path);
+		unlink(\OCP\Config::getSystemValue('datadirectory').'/'.\OC_User::getUser()."/gallery".$path);
 	}
 	
 	private function __construct() {}
diff --git a/apps/gallery/lib/tiles.php b/apps/gallery/lib/tiles.php
index ff9519142ac8a058623636850e181e9d7256c451..f1961cb72e5f84d963ff73b147a0ed70ecd14172 100644
--- a/apps/gallery/lib/tiles.php
+++ b/apps/gallery/lib/tiles.php
@@ -156,11 +156,11 @@ class TileStack extends TileBase {
 	}
 
 	public function getOnHoverAction() {
-		return 'javascript:t(this);return false;';
+		return 'javascript:explode(this);return false;';
 	}
 	
 	public function getOnOutAction() {
-		return 'javascript:o(this);return false;';
+		return 'javascript:deplode(this);return false;';
 	}
 
 	public function getCount() {
diff --git a/apps/gallery/templates/index.php b/apps/gallery/templates/index.php
index 39e3bbf47b304706586910d1b2eec0ee8f7338ab..88cf0912cbd5726fc9ddaefec8240c2310ae388e 100644
--- a/apps/gallery/templates/index.php
+++ b/apps/gallery/templates/index.php
@@ -15,7 +15,7 @@ div.visible { opacity: 0.8;}
 
 var root = "<?php echo !empty($_GET['root']) ? $_GET['root'] : '/'; ?>";
 
-function t(element) {
+function explode(element) {
 	$('div', element).each(function(index, elem) {
 	 	if ($(elem).hasClass('title')) {
 		 	$(elem).addClass('visible');
@@ -27,7 +27,7 @@ function t(element) {
 	});
 }
 
-function o(element) {
+function deplode(element) {
 	$('div', element).each(function(index, elem) {
 	 	if ($(elem).hasClass('title')) {
 		 	$(elem).removeClass('visible');
@@ -55,6 +55,10 @@ $(document).ready(function() {
 
 </script>
 
+<div id="controls">
+	<a href="javascript:shareGallery();"><input type="button" value="<?php echo $l->t('Share');?>" /></a><br/>
+</div>
+<div id="gallerycontent">
 <?php
 
 include('apps/gallery/lib/tiles.php');
@@ -103,3 +107,4 @@ if ($ts->getCount() != 0) {
 echo $tl->get();
 
 ?>
+</div>