/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2009 Coppermine Dev Team
  v1.1 originaly written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License version 3
  as published by the Free Software Foundation.

  ********************************************
  Coppermine version: 1.5.1
  $HeadURL: https://coppermine.svn.sourceforge.net/svnroot/coppermine/trunk/cpg1.5.x/js/jquery.bookmark.js $
  $Revision: 6232 $
  $LastChangedBy: pvanrompay $
  $Date: 2009-06-24 02:31:55 +0200 (Mi, 24 Jun 2009) $
**********************************************/

/* http://keith-wood.name/bookmark.html
   Sharing bookmarks for jQuery v1.0.3.
   Written by Keith Wood (kbwood@virginbroadband.com.au) March 2008.
   Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and 
   MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses. 
   Please attribute the author if you use it. */
(function($){function Bookmark(){this._defaults={sites:[],icons:'bookmarks.png',iconSize:16,target:'_blank',compact:false,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={'aol':{display:'myAOL',icon:2,url:'http://favorites.my.aol.com/ffclient/webroot/0.4.1/src/html/addBookmarkDialog.html?url={u}&amp;title={t}&amp;favelet=true'},'ask':{display:'Ask',icon:3,url:'http://myjeeves.ask.com/mysearch/BookmarkIt?v=1.2&amp;t=webpages&amp;url={u}&amp;title={t}'},'blinklist':{display:'BlinkList',icon:4,url:'http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Url={u}&amp;Title={t}'},'blogmarks':{display:'Blogmarks',icon:5,url:'http://blogmarks.net/my/new.php?mini=1&amp;simple=1&amp;url={u}&amp;title={t}'},'care2':{display:'Care2',icon:6,url:'http://www.care2.com/news/news_post.html?url={u}&amp;title={t}'},'delicious':{display:'del.icio.us',icon:7,url:'http://del.icio.us/post?url={u}&amp;title={t}'},'digg':{display:'Digg',icon:8,url:'http://digg.com/submit?phase=2&amp;url={u}&amp;title={t}'},'diigo':{display:'Diigo',icon:9,url:'http://www.diigo.com/post?url={u}&amp;title={t}'},'dzone':{display:'DZone',icon:10,url:'http://www.dzone.com/links/add.html?url={u}&amp;title={t}'},'facebook':{display:'Facebook',icon:11,url:'http://www.facebook.com/sharer.php?u={u}&amp;t={t}'},'fark':{display:'Fark',icon:12,url:'http://cgi.fark.com/cgi/fark/submit.pl?new_url={u}&amp;new_comment={t}'},'faves':{display:'Faves',icon:13,url:'http://faves.com/Authoring.aspx?u={u}&amp;t={t}'},'feedmelinks':{display:'Feed Me Links',icon:14,url:'http://feedmelinks.com/categorize?from=toolbar&amp;op=submit&amp;url={u}&amp;name={t}'},'furl':{display:'Furl',icon:15,url:'http://www.furl.net/storeIt.jsp?t={t}&amp;u={u}'},'google':{display:'Google',icon:16,url:'http://www.google.com/bookmarks/mark?op=edit&amp;bkmk={u}&amp;title={t}'},'hugg':{display:'Hugg',icon:17,url:'http://www.hugg.com/submit?url={u}'},'kool':{display:'Koolontheweb',icon:43,url:'http://www.koolontheweb.com/post?url={u}&title={t}'},'linkagogo':{display:'LinkaGoGo',icon:18,url:'http://www.linkagogo.com/go/AddNoPopup?url={u}&amp;title={t}'},'livejournal':{display:'LiveJournal',icon:19,url:'http://www.livejournal.com/update.bml?subject={u}'},'magnolia':{display:'ma.gnolia',icon:20,url:'http://ma.gnolia.com/bookmarklet/add?url={u}&amp;title={t}'},'mindbody':{display:'MindBodyGreen',icon:21,url:'http://www.mindbodygreen.com/passvote.action?u={u}'},'misterwong':{display:'Mister Wong',icon:22,url:'http://www.mister-wong.com/index.php?action=addurl&amp;bm_url={u}&amp;bm_description={t}'},'mixx':{display:'Mixx',icon:23,url:'http://www.mixx.com/submit/story?page_url={u}&amp;title={t}'},'multiply':{display:'Multiply',icon:24,url:'http://multiply.com/gus/journal/compose/addthis?body=&amp;url={u}&amp;subject={t}'},'myspace':{display:'MySpace',icon:25,url:'http://www.myspace.com/Modules/PostTo/Pages/?c={u}&amp;t={t}'},'netscape':{display:'Netscape',icon:26,url:'http://www.netscape.com/submit/?U={u}&amp;T={t}'},'netvouz':{display:'Netvouz',icon:27,url:'http://netvouz.com/action/submitBookmark?url={u}&amp;title={t}&amp;popup=no'},'newsvine':{display:'Newsvine',icon:28,url:'http://www.newsvine.com/_wine/save?u={u}&amp;h={t}'},'nowpublic':{display:'NowPublic',icon:29,url:'http://view.nowpublic.com/?src={u}&amp;t={t}'},'reddit':{display:'reddit',icon:30,url:'http://reddit.com/submit?url={u}&amp;title={t}'},'segnalo':{display:'Segnalo',icon:31,url:'http://segnalo.alice.it/post.html.php?url={u}&amp;title={t}'},'simpy':{display:'Simpy',icon:32,url:'http://www.simpy.com/simpy/LinkAdd.do?href={u}&amp;title={t}'},'slashdot':{display:'Slashdot',icon:33,url:'http://slashdot.org/bookmark.pl?url={u}&amp;title={t}'},'smarking':{display:'Smarking',icon:34,url:'http://smarking.com/editbookmark/?url={u}&amp;title={t}'},'sphinn':{display:'Sphinn',icon:44,url:'http://sphinn.com/submit.php?url={u}&amp;title={t}'},'spurl':{display:'Spurl',icon:35,url:'http://www.spurl.net/spurl.php?url={u}&amp;title={t}'},'squidoo':{display:'Squidoo',icon:42,url:'http://www.squidoo.com/lensmaster/bookmark?{u}&title={t}'},'stumbleupon':{display:'StumbleUpon',icon:36,url:'http://www.stumbleupon.com/submit?url={u}&amp;title={t}'},'tailrank':{display:'Tailrank',icon:37,url:'http://tailrank.com/share/?title={t}&amp;link_href={u}'},'technorati':{display:'Technorati',icon:38,url:'http://www.technorati.com/faves?add={u}'},'thisnext':{display:'ThisNext',icon:39,url:'http://www.thisnext.com/pick/new/submit/sociable/?url={u}&amp;name={t}'},'twitthis':{display:'TwitThis',icon:45,url:'http://twitthis.com/twit?url={u}'},'windows':{display:'Windows Live',icon:40,url:'https://favorites.live.com/quickadd.aspx?marklet=1&amp;mkt=en-us&amp;url={u}&amp;title={t}'},'yahoo':{display:'Yahoo MyWeb',icon:41,url:'http://myweb2.search.yahoo.com/myresults/bookmarklet?t={t}&amp;u={u}'}}}$.extend(Bookmark.prototype,{markerClassName:'hasBookmark',setDefaults:function(a){extendRemove(this._defaults,a||{});return this},addSite:function(a,b,c,d){this._sites[a]={display:b,icon:c,url:d};return this},getSites:function(){return this._sites},_attachBookmark:function(a,b){a=$(a);if(a.hasClass(this.markerClassName)){return}a.addClass(this.markerClassName);this._updateBookmark(a,b)},_changeBookmark:function(a,b){a=$(a);if(!a.hasClass(this.markerClassName)){return}this._updateBookmark(a,b)},_updateBookmark:function(f,g){g=extendRemove(extendRemove({},this._defaults),g);var h=g.sites;if(h.length==0){$.each(this._sites,function(a){h[h.length]=a})}var i='<ul class="bookmark_list'+(g.compact?' bookmark_compact':'')+'">';var j=function(a,b,c,d){var e='<li><a href="'+c+'"'+(d?' onclick="'+d+'"':(g.target?' target="'+g.target+'"':''))+'>';if(b!=null){if(typeof b=='number'){e+='<span title="'+a+'" style="background: '+'transparent url('+g.icons+') no-repeat -'+(b*g.iconSize)+'px 0px;'+($.browser.mozilla&&$.browser.version.substr(0,3)!='1.9'?' padding-left: '+g.iconSize+'px; padding-bottom: 3px;':'')+'"></span>'}else{e+='<img src="'+b+'" alt="'+a+'" title="'+a+'"'+(($.browser.mozilla&&$.browser.version<'1.9')||($.browser.msie&&$.browser.version<'7.0')?' style="vertical-align: bottom;"':($.browser.msie?' style="vertical-align: middle;"':($.browser.opera||$.browser.safari?' style="vertical-align: baseline;"':'')))+'/>'}e+=(g.compact?'':'&#xa0;')}e+=(g.compact?'':a)+'</a></li>';return e};if(g.addFavorite){i+=j(g.favoriteText,g.favoriteIcon,'#','jQuery.bookmark._addFavourite()')}if(g.addEmail){i+=j(g.emailText,g.emailIcon,'mailto:?subject='+escape(g.emailSubject)+'&amp;body='+escape(g.emailBody.replace(/{u}/,window.location.href).replace(/{t}/,document.title)))}var k=this._sites;$.each(h,function(a,b){var c=k[b];if(c){i+=j(c.display,c.icon,c.url.replace(/{u}/,escape(window.location.href)).replace(/{t}/,escape(document.title)))}});i+='</ul>';f.html(i)},_destroyBookmark:function(a){a=$(a);if(!a.hasClass(this.markerClassName)){return}a.removeClass(this.markerClassName);a.empty()},_addFavourite:function(){if($.browser.msie){window.external.addFavorite(window.location.href,document.title)}else{alert(this._defaults.manualBookmark)}}});function extendRemove(a,b){$.extend(a,b);for(var c in b){if(b[c]==null){a[c]=null}}return a}$.fn.bookmark=function(a){var b=Array.prototype.slice.call(arguments,1);return this.each(function(){if(typeof a=='string'){$.bookmark['_'+a+'Bookmark'].apply($.bookmark,[this].concat(b))}else{$.bookmark._attachBookmark(this,a||{})}})};$.bookmark=new Bookmark()})(jQuery);