﻿/*	Sharing bookmarks for jQuery v1.1.4. */
(function($) {
var PROP_NAME = 'bookmark';
function Bookmark() {
	this._defaults = {url: '',title: '',sites: [],icons: '/wp-content/themes/pension2/images/screen/bookmarks.png',iconSize: 16,iconCols: 16,target: '_blank',compact: true,hint: 'Send to {s}',popup: false,popupText: 'Bookmark this site...',addFavorite: false,favoriteText: 'Favorite',favoriteIcon: 0,addEmail: false,emailText: 'E-mail',emailIcon: 1,emailSubject: 'Interesting page',emailBody: 'I thought you might find this page interesting:\n{t} ({u})',manualBookmark: 'Please close this dialog and\npress Ctrl-D to bookmark this page.'};
	this._sites = {  // The definitions of the available bookmarking sites
		'facebook': {display: 'Facebook', icon: 2,	url: 'http://www.facebook.com/sharer.php?u={u}&amp;t={t}'},
		'twitthis': {display: 'TwitThis', icon: 3,	url: 'http://twitthis.com/twit?url={u}'},
		'linkuj': {display: 'Linkuj', icon: 4,	url: 'http://linkuj.cz/?id=linkuj&amp;url={u}&amp;title={t}'},
		'jagg': {display: 'Jagg', icon: 5,url: 'http://jagg.cz/bookmarks.php?action=add&address={u}&amp;title={t}'},
		'bookmarky': {display: 'Bookmarky', icon: 6,url: 'http://www.bookmarky.cz/a.php?cmd=add&url={u}&amp;title={t}'},
		'google': {display: 'Google', icon: 7,	url: 'http://www.google.com/bookmarks/mark?op=edit&amp;bkmk={u}&amp;title={t}'},
		'delicious': {display: 'del.icio.us', icon: 8,	url: 'http://del.icio.us/post?url={u}&amp;title={t}'},
		'linkedin': {display: 'LinkedIn', icon: 9,	url: 'http://www.linkedin.com/shareArticle?mini=true&amp;url={u}&amp;title={t}&amp;ro=false&amp;summary=&amp;source='},
		'digg': {display: 'Digg', icon: 10,url: 'http://digg.com/submit?phase=2&amp;url={u}&amp;title={t}'}
	};
}
$.extend(Bookmark.prototype, {markerClassName: 'hasBookmark',setDefaults: function(settings) {extendRemove(this._defaults, settings || {});return this;},addSite: function(id, display, icon, url) {this._sites[id] = {display: display, icon: icon, url: url};return this;},getSites: function() {return this._sites;},_attachBookmark: function(target, settings) {target = $(target);if (target.hasClass(this.markerClassName)) {return;}target.addClass(this.markerClassName);this._updateBookmark(target, settings);},_changeBookmark: function(target, settings) {target = $(target);if (!target.hasClass(this.markerClassName)) {return;}this._updateBookmark(target, settings);},_updateBookmark: function(target, settings) {var oldSettings = $.data(target[0], PROP_NAME) || $.extend({}, this._defaults);settings = extendRemove(oldSettings, settings || {});$.data(target[0], PROP_NAME, settings);var sites = settings.sites;if (sites.length == 0) {$.each(this._sites, function(id) {sites.push(id);});}var hint = settings.hint || '{s}';var html = (settings.popup ? '<a href="#" class="bookmark_popup_text">' + settings.popupText + '</a><div class="bookmark_popup">' : '') + '<ul class="bookmark_list' + (settings.compact ? ' bookmark_compact' : '') + '">';var addSite = function(display, icon, url, onclick) {var html = '<li><a href="' + url + '"' + (onclick ? ' onclick="' + onclick + ';' + ($.browser.opera ? '' :' return false;') + '"' :	(settings.target ? ' target="' + settings.target + '"' : '')) + '>';if (icon != null) {var title = hint.replace(/\{s\}/, display);	if (typeof icon == 'number') {html += '<span class="serviceIcon" title="' + title + '" style="background: ' +'transparent url(' + settings.icons + ') no-repeat -' +((icon % settings.iconCols) * settings.iconSize) + 'px -' +(Math.floor(icon / settings.iconCols) * settings.iconSize) + 'px;"></span>';}else {html += '<img src="' + icon + '" alt="' + title + '" title="' + title + '"/>';}html +=	(settings.compact ? '' : '&#xa0;');}html +=	(settings.compact ? '' : '<span class="serviceText">'+display+'</span>') + '</a></li>';return html;};var url = settings.url || window.location.href;var title = settings.title || document.title;if (settings.addFavorite) {html += addSite(settings.favoriteText, settings.favoriteIcon,'#fav', 'jQuery.bookmark._addFavourite(\'' + url.replace(/'/g, '\\\'') +'\',\'' + title.replace(/'/g, '\\\'') + '\')');}if (settings.addEmail) {html += addSite(settings.emailText, settings.emailIcon,'mailto:?subject=' + encodeURIComponent(settings.emailSubject) +'&amp;body=' + encodeURIComponent(settings.emailBody.replace(/{u}/, url).replace(/{t}/, title)));}url = encodeURIComponent(url);title = encodeURIComponent(title);var allSites = this._sites;	$.each(sites, function(index, id) {var site = allSites[id];if (site) {html += addSite(site.display, site.icon,site.url.replace(/{u}/, url).replace(/{t}/, title));}});	html += '</ul>' + (settings.popup ? '</div>' : '');target.html(html);if (settings.popup) {$(target).find('.bookmark_popup_text').click(function() {var target = $(this).parent();var offset = target.offset();$('.bookmark_popup', target).css('left', offset.left).css('top', offset.top + target.outerHeight()).slideToggle('fast');return false;});$(document).click(function(event) {$('.bookmark_popup', target).hide();});}},_destroyBookmark: function(target) {target = $(target);if (!target.hasClass(this.markerClassName)) {return;}target.removeClass(this.markerClassName).empty();$.removeData(target[0], PROP_NAME);},_addFavourite: function(url, title) {if ($.browser.mozilla) {window.sidebar.addPanel(title, url, "");}else if($.browser.msie) {window.external.AddFavorite(url, title);}else if($.browser.opera){$('a[href*="#fav"]').attr('rel','sidebar');}}});function extendRemove(target, props) {$.extend(target, props);for (var name in props) {if (props[name] == null) {target[name] = null;}}return target;}$.fn.bookmark = function(options) {var otherArgs = Array.prototype.slice.call(arguments, 1);return this.each(function() {if (typeof options == 'string') {$.bookmark['_' + options + 'Bookmark'].apply($.bookmark, [this].concat(otherArgs));}else {$.bookmark._attachBookmark(this, options || {});}});};$.bookmark = new Bookmark();})(jQuery);


$(function () {
	$('#share').bookmark({iconCols: '11',popup: true,popupText: 'Bookmarks',favoriteText: 'Zazáložkovat',favoriteIcon: 1,addEmail: true,emailText: 'Odeslat odkaz emailem',emailIcon: 0,emailSubject: 'Posílám odkaz na zajímavou stránku',emailBody: 'Myslím, že tahle stránka by se ti mohla líbit :\n{t} ({u})'});
});