(function($){
	$(function(){
		
		
		// Get the number of followers on twitter
		$('.twitter a.social').each(function(){
			var anchor = $(this);
			var href = anchor.attr('href');
			var pattern = /http(s)?\:\/\/(www\.)?twitter.com\/([\w]+)/;
			if(matches = href.match(pattern)) {
				var user_name = matches[3];
				var api_request_url = 'http://twitter.com/statuses/user_timeline/' + user_name +  '.json?count=10&callback=?';
				$.getJSON(api_request_url, function(response, status){
					if(response.length > 0) {
						var count = response[0].user.followers_count;
						anchor.html(anchor.text() + ' (' + count + ' followers)');
					}
				});
			}
		});
		
		var default_value = $("#emailsubscribe").attr('value');
	
		$("#emailsubscribe").focus(function(){
			if($(this).val() == default_value) {
				$(this).val('');
			}
		}).blur(function(){
			if($(this).val() == ''){
				$(this).val(default_value) 
			}
		});
		
		$(".social_list .twitter").each(function(){
			
		});
		
		
			$('a[rel*=facebox]').facebox();
			$("#link_to_first_time_wrapper").trigger('click');
	})
})(jQuery);

function first_time_visitor(){
	jQuery(function($){
		// $("body").append('<a href="#first_time_visit_wrapper" id="link_to_first_time_wrapper" rel="facebox">text</a>');
		// 		$("body").append('<div id="first_time_visit_wrapper"><h3>Welcome</h3><p>Make sure you <a href="http://twitter.com/hising">follow me on Twitter</a>. I post a lot of links on front-end topics there and use the blog for more in-depth articles.</p></div>');
	
	
		
//	$("#link_to_first_time_wrapper,#first_time_visit_wrapper").hide();
		
		
	
	});
}

function returning_visitor(){
	first_time_visitor();
}
