$(document).ready(function() { 
	$("#One,#Two,#Three,#Four,#Five,#Six,#Seven,#Eight,#Nine").tooltip({ 
		effect: "fade",
		offset: [0, 0]					
	});
});


$(document).ready(function() { 
	$.localScroll( {
		offset:-70
	});
});


jQuery(document).ready(function($) {
	$(".tweet").tweet({
	  username: "totalresistance",
	  count: 3,
	  avatar_size: 40,
	  loading_text: "Loading tweets..."
	});
})    

$(document).ready(function () {
    var t = new Date().getTime();
    $('#ticker').html("loading...")
    
    $.ajax({
        url: 'http://etf2l.org/?feed=match&days_ahead=-3&team=7260&show=20&t=' + t,
        type: 'GET',
        dataType: 'xml',
        timeout: 1000,
        
        success: function(xml){
            var out = '';
            $(xml).find('match').each(function(){
                match = $(this)
                result = $(match).find('result')
                
                link = '<a href="http://etf2l.org/matches/' + $(match).attr('id') + '">' + $(result).attr('r1') + ' - ' + $(result).attr('r2') + '</a>'
                
                time = new Date($(match).attr('time')*1000)
                date_time = time.getDate() + '/' + (time.getMonth() + 1) + '/' + time.getFullYear()
                
                teams = []
                $(match).find("team").each(function() {
                    teams.push('<a href="http://etf2l.org/teams/' + $(this).attr('id') + '">' + $(this).text() + '</a>')
                })
            
                out = out + '<div class="match"><h1>' + teams[0] + ' - ' + teams[1] + '</h1><p>' + $(match).find('competition').text() + ': ' + $(match).find('round').text() + '<br />' + link + '<br />' + date_time + '</p></div>'
            });
            
            $('#ticker').html(out);		
        }
    });
})
