function digg()
{
    var metaContent = "";
    var allMetas = document.getElementsByTagName("meta");

    for(var i = 0; i < allMetas.length; i++)
    {
        if(allMetas[i].name == "description")
        {
            metaContent = allMetas[i].content;
break;
        }
    }

    metaContent = metaContent.substring(0, 349);



    var url =
        "http://digg.com/submit?phase=2&"+
        "url="+encodeURIComponent(window.location.href)+"&"+
        "title="+encodeURIComponent(document.title)+"&"+
        "bodytext="+encodeURIComponent(metaContent)+"&"+
        "topic=environment"; 
var imgUrl = "/Images/buttons/digg.gif";
    var anchor = document.createElement("a");
anchor.href = url;
anchor.style.textDecoration = "none";
    var img = document.createElement("img");
img.border = "0";
    img.src = imgUrl;
var text = document.createTextNode(" Digg");

    anchor.appendChild(img);
    anchor.appendChild(text);

    return anchor;
}

function delicious()
{
    var url = 
        'http://del.icio.us/post?v=4&noui&jump=close&url='
+encodeURIComponent(location.href)+
        '&title='+encodeURIComponent(document.title);
    var imgUrl = "/Images/buttons/delicious.gif";
    var anchor = document.createElement("a");
    anchor.href = url;
    anchor.style.textDecoration = "none";
    var img = document.createElement("img");
    img.border = "0";
    img.src = imgUrl;
    var text = document.createTextNode(" Del.icio.us");

    anchor.appendChild(img);
    anchor.appendChild(text);

    return anchor;
}

function reddit()
{
    var url =
        "http://reddit.com/submit?url="+encodeURIComponent(window.location.href);
    var imgUrl = "/Images/buttons/reddit.png";
    var anchor = document.createElement("a");
    anchor.href = url;
    anchor.style.textDecoration = "none";
    var img = document.createElement("img");
    img.border = "0";
    img.src = imgUrl;
    var text = document.createTextNode(" Reddit");

    anchor.appendChild(img);
    anchor.appendChild(text);

    return anchor;
}

function newsvine()
{
    var url =
        "http://www.newsvine.com/_wine/save?popoff=1&u="+encodeURIComponent(window.location.href);
    var imgUrl = "/Images/buttons/newsvine.gif";
    var anchor = document.createElement("a");
    anchor.href = url;
    anchor.style.textDecoration = "none";
    var img = document.createElement("img");
    img.border = "0";
    img.src = imgUrl;
    var text = document.createTextNode(" Newsvine");

    anchor.appendChild(img);
    anchor.appendChild(text);

    return anchor;

}

/* To use this function add <span id="share_span"></span> wherever
    you want the share links to be placed */
function display()
{
var spanElement = document.getElementById("share_span");
spanElement.appendChild(digg());
spanElement.appendChild(document.createTextNode(" "));
spanElement.appendChild(delicious());
spanElement.appendChild(document.createTextNode(" "));
spanElement.appendChild(reddit());
spanElement.appendChild(document.createTextNode(" "));
spanElement.appendChild(newsvine());
}

/* To use this function add <span class="sharespan"></span> wherever 
   you want the share links to be placed */
function multiDisplay()
{
    var spanElements = document.getElementsByTagName("span");
        
    for(var i = 0; i < spanElements.length; i++)
    {
        if(spanElements[i].className == "sharespan")
        {
            spanElements[i].appendChild(digg());
            spanElements[i].appendChild(document.createTextNode(" "));
            spanElements[i].appendChild(delicious());
            spanElements[i].appendChild(document.createTextNode(" "));
            spanElements[i].appendChild(reddit());
            spanElements[i].appendChild(document.createTextNode(" "));
            spanElements[i].appendChild(newsvine());
         }            
    }
}