﻿u = location.href;
t = document.title;

function bookmarksite() {
    if (window.sidebar) // firefox
        window.sidebar.addPanel(t, u, "");
    else if (window.opera && window.print) { // opera
        var elem = document.createElement('a');
        elem.setAttribute('href', u);
        elem.setAttribute('title', t);
        elem.setAttribute('rel', 'sidebar');
        elem.click();
    }
    else if (document.all)// ie
        window.external.AddFavorite(u, t);
}

function fbs_click() {
    window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u) + '&t=' + encodeURIComponent(t), 'sharer', 'toolbar=0,status=0,width=626,height=436');
    return false;
}

function deli_click() {
    window.open('http://delicious.com/save?url=' + encodeURIComponent(u) + '&title=' + encodeURIComponent(t) + '&notes=' + encodeURIComponent(getKeywords()) + '&v=5&noui=1&jump=doclose', 'sharer', '');
    return false;
}

function digg_click() {
    window.open('http://digg.com/submit?url=' + encodeURIComponent(u) + '&title=' + encodeURIComponent(t) + '&bodytext=' + getKeywords() + '&media=news&topic=travel_places', 'sharer', '');
    return false;
}

function link_click() {
    window.open('http://www.linkedin.com/shareArticle?mini=true&url=' + encodeURIComponent(u) + '&title=' + encodeURIComponent(t) + '&summary=' + getKeywords() + '&source=' + encodeURIComponent('Trans4mation.org'), 'sharer', '');
    return false;
}

function twit_click() {
    window.open('http://twitter.com/home?status=' + encodeURIComponent("is reading \"") + encodeURIComponent(t) + encodeURIComponent("\" from ") + encodeURIComponent(u), 'sharer', '');
    return false;
}

function getKeywords() {
    var metaElements = document.all ?
								    document.all.tags('META') :
								    document.getElementsByTagName ?
								    document.getElementsByTagName('META') : new Array();
    var metaKeywords = new Array();
    var i = 0;
    for (var m = 0; m < metaElements.length; m++)
        if (metaElements[m].name == 'description')
        metaKeywords[i++] = metaElements[m].content;
    return metaKeywords;
}

function getKeys() {
    var metaElements = document.all ?
								    document.all.tags('META') :
								    document.getElementsByTagName ?
								    document.getElementsByTagName('META') : new Array();
    var metaKeywords = new Array();
    var i = 0;
    for (var m = 0; m < metaElements.length; m++)
        if (metaElements[m].name == 'keywords')
        metaKeywords[i++] = metaElements[m].content;
    return metaKeywords;
}
