blink = {
	init : function() {
		var self = this;
		$span = $('<span style="background: #00CF27">&nbsp;</span>');
		$('h1').append($span);
		self.clignote();
	},
	clignote : function() {
		$('h1 span').fadeOut(1000,function(){
			$(this).fadeIn(1000, blink.clignote);
		});
	}
}

twitter = {
  init: function(){
    var self = this;
    // http://api.twitter.com/1/user/lists/list_id/statuses.format
    var url = "http://twitter.com/1/montrealhackers/lists/6290230/statuses.json?callback=?&per_page=7";
    $.getJSON(url, function(data, textresponse){
      self.populate(data);
    });
  },
  populate : function(data){
    var self = this;
    var retstr = '';
    for (var i = 0; i < data.length; i++){
      retstr += "<p><a href='http://twitter.com/"+data[i].user.screen_name+"' target='_blank'>"+data[i].user.screen_name+"</a>: "+self.textFormat(data[i].text)+"</p>";
    };
    $('#twitterfeeds').append(retstr);
  },
  textFormat: function(texto){ // taken from http://juitter.com/ library
		//make links
		var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
		texto = texto.replace(exp,"<a href='$1' class='extLink' target='_blank'>$1</a>"); 
		var exp = /[\@]+([A-Za-z0-9-_]+)/ig;
		texto = texto.replace(exp,"<a href='http://twitter.com/$1' class='profileLink'>@$1</a>"); 
		return texto;
	},
}
