/*
  Social Bookmarking Script

  Version: 2.1.1

  Copyright (c) 2008,2009,2010 by Christian Petersen (www.iscp.de) - All rights reserved

  This script is licensed under: Creative Commons Attribution-Share Alike 3.0
  http://creativecommons.org/licenses/by-sa/3.0/

  This means, that you can use this script free of charge for commercial and noncommercial.
  We would like if you put an seo-friendly ("do follow") link to http://www.social-bookmarking-script.com on the site
  which uses this script.

  For the newest version of the Social Bookmarking Script visit: http://www.social-bookmarking-script.com

*/

/*  *********************************************************
    Functions for internal use
    *********************************************************
*/

function sbsintern_title(title,encoding) {
    /*
      This function tests if a external title is given. If not the title of the document is used.
      It encodes the url if wanted:
      encoding:
        0: encodeURIComponent
        1: no encoding
        2: escape
                3: unescape


        Call: sbsintern_title(title,encoding)

     */

      var functiontitle = "";

      if (typeof title != "undefined") functiontitle = title;
      else functiontitle = document.title;

//      return functiontitle;
      switch(encoding){
       case 1:
        return functiontitle;
        break;
       case 2:
        return escape(functiontitle);
        break;
           case 3:
            return unescape(functiontitle);
                break;
       default:
        return encodeURIComponent(functiontitle);
      }

}

function sbsintern_url(url,encoding) {
    /*
      This function tests if a external url is given. If not the url of the document is used.
      It encodes the url if wanted:
      encoding:
        0: encodeURIComponent
        1: no encoding
        2: escape
                3: unescape


        Call: sbsintern_url(url,encoding)
     */

    var functionurl = "";

    if (typeof url != "undefined") {
      if (url != "") functionurl = url
      else functionurl = location.href;
    }
    else functionurl = location.href;

    switch(encoding){
      case 1:
        return functionurl;
        break;
      case 2:
        return escape(functionurl);
        break;
          case 3:
                return unescape(functionurl);
                break;
      default:
        return encodeURIComponent(functionurl);
    }

}

/*  *********************************************************
    Functions for calling bookmarking-services
    *********************************************************
*/


function sbs_facebook(url,title) { window.open('http://www.facebook.com/sharer.php?u='+sbsintern_url(url,0)+'&t='+sbsintern_title(title,0)); return false; }
function sbs_favoriten(url,title) { window.open('http://www.favoriten.de/url-hinzufuegen.html?bm_url='+sbsintern_url(url,0)+'&bm_title='+sbsintern_title(title,0)); return false; }
function sbs_folkd(url,title) { window.open('http://www.folkd.com/submit/'+sbsintern_title(title,1)); return false; }
function sbs_google(url,title) { window.open('http://www.google.com/bookmarks/mark?op=add&bkmk='+sbsintern_url(url,0)+'&annotation=&labels=&title='+sbsintern_title(title,0)); return false; }
function sbs_mrwong(url,title) { window.open('http://www.mister-wong.de/index.php?action=addurl&bm_url='+sbsintern_url(url,0)+'&bm_notice=&bm_description='+sbsintern_title(title,0)+'&bm_tags='); return false; }
function sbs_twitter(url,title) { window.open('http://twitter.com/home?status='+sbsintern_title(title,0)+sbsintern_url(url,0)); return false; }
function sbs_yahoo(url,title) { window.open('http://myweb2.search.yahoo.com/myresults/bookmarklet?t='+sbsintern_title(title,0)+'&d=&tag=&u='+sbsintern_url(url,0)); return false; }
function sbs_edelight(url,title) { window.open('http://www.edelight.de/geschenk/neu?purl='+sbsintern_url(url,0)); return false; }
function sbs_myspace(url,title) { window.open('http://www.myspace.com/Modules/PostTo/Pages/?u='+sbsintern_url(url,0)); return false; }
