var site = window.location.href;
var urlencodedsite = urlencode(site);
var documenttitle = document.title;
var urlencodedtitle = urlencode(document.title);

//alert(site);
//alert(urlencodedsite);
$(document).ready(function() {
    // if javascript enabled show the menu
    $('#rightcolumn #iconsection ul#sharemenu').css('display', 'block');
    $('#rightcolumn #iconsection a.printthis').css('display', 'inline');
    // print preview
    $('a.printthis').click(function(){printPopUp();return false;});
    //for menu fadein/fadeout only!
    $("#sharemenu").superfish({ autoArrows: false, delay: 300, speed: 900 });
    
    //begin link data functions
    $("#shareface").click(function() {//replace hematology.org with actual url
        window.location.href = "http://www.facebook.com/share.php?u=" + site;//http://www.hematology.org/";
        return false;
    }),
    $("#sharedel").click(function() {
        window.location.href = "https://secure.delicious.com/login?v=5&jump=http%3A%2F%2Fdelicious.com%2Fsave%3Furl%3D" + urlencodedsite;//http%253A%252F%252Fwww.hematology.org/";
        return false;
    });
    $("#sharestumble").click(function() {
      window.location.href = "http://www.stumbleupon.com/submit?url=" + site +"&title=Homepage Title";
      return false;
    });
    $("#sharedigg").click(function() {
        window.location.href = "http://digg.com/submit?phrase=2&url="+urlencodedsite;//http%3A%2F%2Fwww.hematology.org";
        return false;
    });
    $("#sharegoogle").click(function() {
        window.location.href = "http://www.google.com/bookmarks/mark?op=edit&bkmk="+site+"&title="+urlencodedtitle;
        return false;
    });
    $("#sharetech").click(function() {
        window.location.href = "http://technorati.com";
    });
    $("#sharenewsvine").click(function() {
        window.location.href = "https://www.newsvine.com/_tools/user/login?popoff&redirect=http%3A%2F%2Fwww.newsvine.com%2F_wine%2Fsave%3Fu%3D"+urlencodedsite+")";
    });
    $("#shareyahoo").click(function() {
        window.location.href = "https://login.yahoo.com/config/login?.src=bmk2&.intl=us&.done=http%3A%2F%2Fbookmarks.yahoo.com%2Fmyresults%2Fbookmarklet%3Fu%3D"+urlencodedsite;
    });
    closeUp();
});
function urlencode (str) {
str = escape(str);
return str.replace(/[*+\/@]|%20/g,
function (s) {
switch (s) {
case "*": s = "%2A"; break;
case "+": s = "%2B"; break;
case "/": s = "%2F"; break;
case "@": s = "%40"; break;
case "%20": s = "+"; break;
}
return s;
}
);
}
function printPopUp() {
    window.print();
    return false;
}
function closeUp() {
    $('.closeup').each(function() {
        var imgSrc = $(this).parent().attr("href");
        var imgDesc = $(this).attr("alt");
        $(this).parent().attr("title", imgDesc);
    });
    $('.closeup').parent().lightBox();
}