


/* Functions for internal use */


function hopintern_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
        3: escape
        
        
        Call: hopintern_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;
       default:
        return encodeURIComponent(functiontitle);
      }
      
}

function hopintern_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
        3: escape
        
        
        Call: hopintern_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;
      default:
        return encodeURIComponent(functionurl);
    }

}
  
/* Functions for calling bookmarking-services */
  
function hop_delicious(url,title) { window.open('http://del.icio.us/post?v=2&url='+hopintern_url(url,0)+'&notes=&tags=&title='+hopintern_title(title,0)); return false; }
function hop_delicious2(url,title) { window.open('http://del.icio.us/post?v=2&url='+encodeURIComponent(location.href)+'&notes=&tags=&title='+encodeURIComponent(document.title)); return false; }
function hop_digg(url,title) { window.open('http://digg.com/submit?phase=2&url='+hopintern_url(url,0)+'&bodytext=&tags=&title='+hopintern_title(title,0)); return false; }
function hop_facebook(url,title) { window.open('http://www.facebook.com/sharer.php?u='+hopintern_url(url,0)+'&t='+hopintern_title(title,0)); return false; }
function hop_favoriten(url,title) { window.open('http://www.favoriten.de/url-hinzufuegen.html?bm_url='+hopintern_url(url,0)+'&bm_title='+hopintern_title(title,0)); return false; }
function hop_googlebm(url,title) { window.open('http://www.google.com/bookmarks/mark?op=add&bkmk='+hopintern_url(url,0)+'&annotation=&labels=&title='+hopintern_title(title,0)); return false; }
function hop_live(url,title) { window.open('https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url='+hopintern_url(url,0)); return false; }
function hop_mrwong(url,title) { window.open('http://www.mister-wong.de/index.php?action=addurl&bm_url='+hopintern_url(url,0)+'&bm_notice=&bm_description='+hopintern_title(title,0)+'&bm_tags='); return false; }
function hop_myspace(url,title) { window.open('http://www.myspace.com/Modules/PostTo/Pages/?l=2&u='+hopintern_url(url,0)+'&title='+hopintern_title(title,0)); return false; }
function hop_twitter(url,title) { window.open('http://twitthis.com/twit?url='+hopintern_url(url,0)+'&title='+hopintern_title(title,0)); return false; }
function hop_webnews(url,title) { window.open('http://www.webnews.de/einstellen?url='+hopintern_url(url,0)+'&title='+hopintern_title(title,0)); return false; }
function hop_yahoobm(url,title) { window.open('http://myweb2.search.yahoo.com/myresults/bookmarklet?t='+hopintern_title(title,0)+'&d=&tag=&u='+hopintern_url(url,0)); return false; }
