window.RetweetJS.link_text = 'Twitter';
window.RetweetJS.count_type ="none";
window.RetweetJS.prefix = "";
window.RetweetJS.styling = null;

if ( !window.console ) { window.console = {log:function() {}} }

jQuery(window).load(function() {
	(function($){

		 if ( $('.ebook-link-not-found').length ) {
			$('.ebook-link-not-found').parents('.feuilleter').remove();
		 }	

		var partager_urls = {
			'delicious': function() {
				window.open('http://del.icio.us/post?v=4;url=' + encodeURIComponent(location.href) + ';title=' + encodeURIComponent(document.title), "", "width=1000,height=600,menubar=1,resizable=1,scrollbars=1");
			},
			'linkedin': function() {
				window.open('http://www.linkedin.com/shareArticle?mini=true&title='+ encodeURIComponent( $('.infolivre h1').text() ) +'&url=' + encodeURIComponent(location.href) + '&source=septembre.com', "", "width=1000,height=600,menubar=1,resizable=1,scrollbars=1");
			},
			'twitter': function(e) {
				window.open($(e).attr('href'), "", "width=1000,height=600,menubar=1,resizable=1,scrollbars=1");
			},
			'publieca': function() {
				window.open('http://publie.ca/submit/?url='+encodeURIComponent(window.location.href.substr(0,1024))+'&title='+encodeURIComponent(document.title.substr(0,64)), "", "width=1000,height=600,menubar=1,resizable=1,scrollbars=1");
			},
			'facebook': function() {
				var d = document,
				f = 'http://www.facebook.com/share',
				l = d.location,
				e = encodeURIComponent,
				p = '.php?src=bm&v=4&i=0&u=' + e(l.href) + '&t=' + e(d.title);
				a = function() { if (!window.open(f + 'r' + p, 'sharer', 'toolbar=0,status=0,resizable=1,width=626,height=436')) l.href = f + p };
				if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0);
				else { a() }
			},
			'google': function() {
				window.open('http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk=' + encodeURIComponent(location.href) + '&title=' + encodeURIComponent(document.title), "", "width=1000,height=600,menubar=1,resizable=1,scrollbars=1");
			}
		}
	
		window.ixbox.init();
		$('.livre-actions .envoyer a').click(function(){
			window.ixbox.toggle('envoyer');
			return false;
		});

		$('.livre-actions .partager ul a').click(function() {
				
			var c = $(this).parent().attr('class');
			
			if (partager_urls[c]) {
				partager_urls[c].call(this, this);
			}
			return false;
		});
	
	
		$('.livre-actions > ul > li').bind('mouseenter', function() {
			$(this).addClass('hover');
		}).bind('mouseleave', function() {
			$(this).removeClass('hover');
		});
	
	
		$('.livre-actions .ebook-link a').attr('title', 'Feuilleter ce livre');
		$('.livre-actions .ebook-link-not-found').each(function() {
			$(this).attr('title', $(this).text() );
		});
		$('.livre-actions').find('a, div div').tooltip({
			track : true,
			delay : 10,
			showURL : false
		});
	})(jQuery);
});

