/**
 * @author	Alexander Ebert
 * @copyright	2001-2010 WoltLab GmbH
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 */
var SocialBookmarks = Class.create({
	/**
	 * Initializes bookmark links
	 */
	initialize: function() {
		$$('.socialBookmarks').each(function(bookmarks) {
			bookmarks.select('a').each(function(link) {
				link.observe('click', this.bookmarkAction.bind(this));
			}.bind(this))
		}.bind(this));
	},
	/**
	 * Opens the selected bookmark link in a new window
 	 */
	bookmarkAction: function(event) {
		var image = event.findElement();
		var link = image.up('a').readAttribute('href');
		
		// open link in a new window
		window.open(link, '', 'width=550,height=550,menubar=yes,status=yes,toolbar=yes,location=yes');
		
		// discard event
		event.stop();
	}
});
