//Your twitter name
var twitter_name = "Spitfire_Darren";
//Number of tweets you want to get back
var twitter_count = 5;
//Callback function name
var callback_name = "tweet_callback";
//Twitter search url
var twitter_search = "http://twitter.com/statuses/user_timeline";
//Return type (json or xml)
var return_type = "json";
//Adds script tags to the head/body tag
( function() {
var ts = document.createElement('script');
ts.type = 'text/javascript';
ts.async = true;
ts.src = twitter_search + "." + return_type + "?screen_name=" + twitter_name + "&count=" + twitter_count + "&callback=" + callback_name;
( document.getElementsByTagName( 'head' )[ 0 ] || document.getElementsByTagName( 'body' )[ 0 ] ).appendChild( ts );
} )();

//Call back function
function tweet_callback( data ) {
//Loop through the data from twitter
$.each( data, function( i, tweet ) {
//Make sure the text isn't undefined
if( tweet.text != undefined ) {
//Lets do some regex magic to replace urls, hashtags, and usernames
var text = tweet.text.toString().replace( /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, '<a href="$1">$1</a>' ).replace( /(^|\s)@(\w+)/, '<a href="http://www.twitter.com/$2">@$2</a>' ).replace( /[#]+[A-Za-z0-9-_]+/ig, function(t) { var tag = t.replace("#","%23"); return t.link("http://search.twitter.com/search?q="+tag); } );
//Lets append each tweet to a ul with the id of tweet_container
$( ".twitter-feed" ).append( "<li>" + text + "&nbsp;&nbsp;<a href=\"http://twitter.com/#!/Spitfire_Darren\" class=\"t-follow\">Follow Us on Twitter</a></li>");
}
}), $('.twitter-feed').innerfade({
	speed: 'slow',
	timeout: 10000,
	type: 'sequence',
	containerheight: '43px'
});
};

$(document).ready(function(){
	
	$('.new-website').hide();
	
	$('.new-website-bg').css('opacity', '0.8');
	
	$('.content').hover(function(){
		$('.new-website').stop().fadeTo('fast', 1);
	}, function(){
		$('.new-website').stop().fadeTo('fast', 0);
	});
	
	$('.social-bar').hover(
		function() {
			$('.t-follow').stop().fadeTo('fast', 1);
		},
		function() {
			$('.t-follow').stop().fadeTo('fast', 0);
	});
	
	
	$('.contact-form-wrap').dialog({
			autoOpen: false,
			height: 450,
			width: 630,
			modal: true,
			title: "Contact Us"
	});
	
	$('.cbox-trigger').click(function() {
		$('.contact-form-wrap').dialog( "open" );
		return false;
	});
	
});

window.___gcfg = {lang: 'en-GB'};

(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
