function my_click() {
   clicked_link_id = $(this).attr("id");
   $.ajax({
      dataType: "text",
      type: "POST",
      url: "ajax.php",
      data: "a=" + clicked_link_id,
      success: function(msg,status) {
         $("#maintext").fadeOut("slow", function() {
            $("#maintext").html(msg);
            $(".ajax_link").click(my_click);
            $("#maintext").fadeIn("slow");
         });
      },
      error: function(XMLHttpRequest, textStatus, errorThrown) {
         alert("Error:");
      }
   });
   return false;
}

$(document).ready(function(){
   $('#pics').cycle({
    fx:    'fade',
    speed:  1500,
    timeout: 7000
   });
   $('#logos').cycle({
    fx:    'fade',
    speed:  800,
    timeout: 3000
   });
   $('.ajax_link').click(my_click);
});
