$(document).ready(function() {
  $("body").fontunstack( ' Calibri, "Lucida Sans", Verdana, sans-serif ' );
	Cufon.replace('#contact-header strong, #extras h4, .outsource, #bodyContent h3, .contactSection p.head', { fontFamily: 'HelveticaNeue' });
	
	Cufon.replace('#contact-header span, #services li h3, .tabs li h3, #clients h3, #bodyContent h3#clientsTitle, .project h3, .project h4, .service-description', { fontFamily: 'HelveticaNeueLight' });
	Cufon.replace('h1#welcome, p#intro, .tab_content p, h1#pageTitle span', { fontFamily: 'Helvetica' });
	Cufon.replace('h1#welcome span, h1#pageTitle, #sideBar h3, #aboutUsContent h3, .contactSection h3, #subContent h3', { fontFamily: 'HelveticaNeueThin' });
	
  	//$("#clients ul li img[title]").tooltip();
	$('#clients ul li img').hover(
			function() {
			//Hover In
			$(this).attr("src", $(this).attr("src").replace('_bw.', '_rollover.'));
			},
			function() {
			//Hover Out
			$(this).attr("src", $(this).attr("src").replace('_rollover.', '_bw.'));			
			}
		)
  		$.ajax({
				url: 'http://blog.fatfreemedia.co.uk/api/read/json/',
				dataType: "jsonp",
				data: {
					num: 20
				},
				success: function(data){
					var output = '';
					
					var len = data.posts.length;
					var postCount = 0;
					for(var i=0; i<len; i++){
						var entry = data.posts[i];
						console.log(entry['regular-title']);
						var t = '';
						if (entry['regular-title'] != null) {
							//t = '<li><a href="' + entry['url-with-slug'] + '">' + entry['regular-title'] + ' &raquo;</a>';
							t = '<p class="news"><strong>' + entry['regular-title'] + '</strong> <a href="' + entry['url-with-slug'] + '">Read more &raquo;</a>';
							//<strong></strong> <a href="#">Read more &raquo;</a></p>
							postCount += 1;
							}							
						output += t;
						if (postCount == 3) {break;}
					}//end for
					$("#newsStories").html('<ul>' + output + '</ul>');
				}//end success()
			});
});

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-1410304-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

