﻿$(document).ready(function () {
    $('a.tweet').click(function () {
        var url = 'http://twitter.com/share?url=' + encodeURIComponent(window.location);
        if ($(this).attr('href') != '#')
            url = 'http://twitter.com/share?url=' + encodeURIComponent($(this).attr('href'));
        window.open(url, 'twitter', 'width=500,height=300');
        return false;

        if ($(this).hasClass("track") && _gaq != null) {
            var hash = location.hash;
            if (hash != '') {
                hash = hash.replace('#', '');
            } else {
                hash = 'home';
            }

            _gaq.push(['_trackPageview', '/share/twitter/' + hash]);
        }
    });
    $('a.fb-share').click(function () {
        var url = 'http://www.facebook.com/sharer.php?u=' + encodeURIComponent(window.location);
        if ($(this).attr('href') != '#')
            url = 'http://www.facebook.com/sharer.php?u=' + encodeURIComponent($(this).attr('href'));
        window.open(url, 'facebook', 'width=500,height=300');
        return false;

        if ($(this).hasClass("track") && _gaq != null) {
            var hash = location.hash;
            if (hash != '') {
                hash = hash.replace('#', '');
            } else {
                hash = 'home';
            }

            _gaq.push(['_trackPageview', '/share/facebook/' + hash]);
        }
    });
});
