$(document).ready(function() {
 $('.newsLink').click(function() {
 $('#newsContentLoading').css({ opacity: 0.7, 'width':$(document).width(),'height':$(document).height()});
  $('#newsContentLoading img').css({opacity: 0.7});
		$("#newsContent").fadeTo("fast", 0.33);
  var id = this.id;
  if (location.hostname.match("localhost")) {
		  var host = "http://localhost/bikeshedcms/";
		}
		else {
		  var host = "http://www.bikeshedwales.com/";
		}
/*  $.ajax({
			type: "GET",
			url: host + "ajax-news.php",
data: "news="+escape(id),
			success: function(result){
  		$('#newsContentLoading').css({ opacity: 0, 'width':0,'height':0});
    $("#newsContent").html(result).fadeTo("slow", 1).fadeIn();
   },
   error: function() {
				$('#newsContentLoading').css({ opacity: 0, 'width':0,'height':0});
			 $("#newsContent").fadeTo("fast", 1);
 	 }
	 });*/

  $.getJSON(host + "ajax-news.php?news=" + escape(id),
	 function(data, success){
   if(success) {
   	$('#newsContentLoading').css({ opacity: 0, 'width':0,'height':0});
    $("#newsContent").html(data.content).fadeTo("slow", 1).fadeIn();					
    document.title = "Bike Shed Wales .:. Cardiff's only Genesis Bikes dealer .:. Bicyle sales and repair; Cathedral Road, Pontcanna, Cardiff .:. News .:. " + data.title;
	 	}
			else {
		  $('#newsContentLoading').css({ opacity: 0, 'width':0,'height':0});
		  $("#newsContent").fadeTo("fast", 1);
 		}
		});

		pageTracker._trackPageview($(this).attr('href'));
  return false;
 });
});