if(typeof(T3) == "undefined") T3 = {};
if(!T3.Utilities) T3.Utilities = {};

T3.Utilities.CreateElement = function(parent,elm,id,cls) {
	if(id && cls) {
		return $("<" + elm + " id=\"" + id + "\" class=\"" + cls + "\" ></" + elm + ">").appendTo(parent);
	} else if(id) {
		return $("<" + elm + " id=\"" + id + "\"></" + elm + ">").appendTo(parent);
	} else if(cls) {
		return $("<" + elm + " class=\"" + cls + "\"></" + elm + ">").appendTo(parent);
	} else {
		return $("<" + elm + "></" + elm + ">").appendTo(parent);
	}
}

T3.Utilities.GetTweets = function(callback,error_callback) {
	$.ajax({
			type:"GET",
			dataType:"jsonp",
			url:"http://api.twitter.com/1/statuses/user_timeline.json",
			data:{id:"tier3", exclude_replies:"true"},
			success:function(data, textStatus, XMLHttpRequest) {  				
				callback(data, textStatus, XMLHttpRequest);
			},
			error:function(req, status, error) {
				if(error_callback) error_callback(req, status, error);
			}
	});
}

T3.Utilities.ParseDate = function(str) {
	var v=str.split(' ');
	return new Date(Date.parse(v[1]+" "+v[2]+", "+v[5]+" "+v[3]+" UTC"));
}
