﻿var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-8117098-2']);
_gaq.push(['_trackPageview']);

(function () {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

$(document).ready(function () {
    var panel = $('#twitter');
    $.getJSON("feeds/twitter.ashx", function (data) {
        $.each(data.tweets, function (key, val) {
            id = val[0];
            dt = val[1];
            txt = val[2];
            if (txt.length > 32) { txt = txt.substring(0, 32) + '...'; }
            else { txt = txt + '...'; }
            panel.append($('<div></div>').append(
                $('<img/>').attr('src', '/globals/images/tweet.gif').after(
                $('<a></a>').append(txt).attr('title', val[2]).attr('href', 'http://twitter.com/w3tonline/status/' + id).attr('target', '_blank'))).append(
                $('<br/>').after($('<span></span>').append(dt))));
        });
    });
});
