$(document).ready( function() {
	
	// TWITTER STUFF JACK
	
	// Hash tag search url
	// http://twitter.com/#!/search?q=%23test
	
	/*
	REST API Rate Limiting

	The default rate limit for calls to the REST API varies depending on the authorization method being used and whether the method itself requires authentication.

	Unauthenticated calls are permitted 150 requests per hour. Unauthenticated calls are measured against the public facing IP of the server or device making the request.
	OAuth calls are permitted 350 requests per hour and are measured against the oauth_token used in the request.
	Ensure you inspect the headers returned when requesting methods which do not require authentication. If the request you make includes invalid OAuth information the API will do one of two things:

	For methods which require authentication, the API will return an error response with more information about the error. For example an HTTP 401 error with the response body
	Could not authenticate with OAuth.
	For methods which can be requested unauthenticated, the API will process the request as if authentication had not been used. This means the request will count against the unauthenticated rate limit. If this has happened the API will include the following header in it's response:
	X-Warning: Invalid OAuth credentials detected.
	*/
	

	var username='thriceborn';
	var format='json';
	var hashtag ='#test'

	var url='http://api.twitter.com/1/statuses/user_timeline/'+username+'.'+format+'?callback=?'; // make the url

	$.getJSON( url, function( tweet ) { // get the tweets
		console.log( tweet.length );
		for ( var i=0; i < tweet.length; i++ ) {
			
			// Find the hashtag you need
			if ( tweet[i].text.indexOf( hashtag ) + 1 ) {
				var text = tweet[i].text;
				text = text.replace( hashtag, '' );
				$( "#twitter_feed #right #text" ).html( text ); // get the first tweet in the response and place it inside the div	
			}
		}
	});

});
