var tweetUrl = "http://twitter.com/home/?status=";
var facebookurl = "http://www.facebook.com/sharer.php?u="
var xyz = new Array();
xyz[0] = "http://twitter.com/home/?status=";
xyz[1] = "http://www.facebook.com/sharer.php?u=";
xyz[2] = "http://www.stumbleupon.com/submit?url=";
xyz[3] = "http://digg.com/submit?phase=2&url=";
xyz[4] = "http://www.myspace.com/Modules/PostTo/Pages/?l=3&u=";
xyz[5] = "http://www.linkedin.com/shareArticle?mini=true&url=";
xyz[6] = "http://buzz.yahoo.com/buzz?targetUrl=";
xyz[7] = "http://del.icio.us/post?url=";
xyz[8] = "http://www.google.com/reader/link?url=";
function tweet(ui, url, title) {

    try {
        if (ui == 0) {
            window.open(xyz[ui] + title + ' ' + url);
        }
        else if (ui == 3) {
            window.open(xyz[ui] + url + "&title=" + title);
        }
        else if (ui == 6) {
            window.open(xyz[ui] + url);
        }
        else {
            window.open(xyz[ui] + url + '&title=' + title);
        }
    }
    catch (e) {
        alert(e)
    }
}

function thumbsUp(key, userId) {
    try {
        if (userId <= 0) {
            showMsg("Please login to vote", true);
            return;
        }
        var pars = "/Ajax/ThumbsAction.aspx?key=" + key + "&userId=" + userId + "&action=up";

        $.getJSON(pars, function(obj) {
            if (obj.status != "") showMsg(obj.status, true);
            var upcount = document.getElementById(key + '-upcount');
            var downcount = document.getElementById(key + '-downcount');
            upcount.innerHTML = obj.thumbsUp;
            downcount.innerHTML = obj.thumbsDowm;
        }); 
        }
    catch (e) {
        alert(e);
    }

}
function thumbsDown(key, userId) {
    try {
        if (userId <= 0) {
            showMsg("Please login to vote", true);
            return;
        }
        var pars = "/Ajax/ThumbsAction.aspx?key=" + key + "&userId=" + userId + "&action=down";

        $.getJSON(pars, function(obj) {
            if (obj.status != "") showMsg(obj.status, true);
            var upcount = document.getElementById(key + '-upcount');
            var downcount = document.getElementById(key + '-downcount');
            upcount.innerHTML = obj.thumbsUp;
            downcount.innerHTML = obj.thumbsDowm;
        });
    }
    catch (e)
    { }

}

function showShareIt(obj) {
    var ctrl = document.getElementById(obj);
    ctrl.style.display = 'block';
}

function hideShareIt(obj) {
    var ctrl = document.getElementById(obj);
    ctrl.style.display = 'none';
}