$(document).ready(function() {
  $('#container .content').corner();
  $('#container #explanation #uno').corner();
  $('#container #explanation #uno h3').corner();
  $('#container #explanation ul#twitter_update_list li').corner();
  
   var footerHeight = 0,
       footerTop = 0,
       $footer = $("#footer");

   positionFooter();

   function positionFooter() {
      footerHeight = $footer.outerHeight();
      footerTop = ($(window).scrollTop()+$(window).height()-footerHeight)+"px";
      if ( ($(document.body).height()+footerHeight) < $(window).height()) {
         $footer.css({
              position: "absolute",
              top: footerTop
         });
      } else {
         $footer.css({
              position: "static"
         });
      }
   };

   $(window)
    .scroll(positionFooter)
    .resize(positionFooter);

  $('#container .content #questions a.question').click(function() {
    var question = $(this).attr('id');

    $('#container .content #answers img').hide();    
    $.each($('#container .content #answers .answer'), function(idx, answer) {
      if ($(answer).hasClass(question)) {
        $(this).slideDown('slow');
      } else {
        $(this).hide();
      }
    });

    return false;
  });

  $('form#contact').submit(function() {
    var request = $('form#contact').serialize();

    $.ajax({
      type:    'POST',
      url:     'contact.php',
      data:    request,
      success: function(response) {
        $('p#notice').html('<p>' + response + '</p>');
        $('p#notice').fadeIn('slow');
      }
    });

    return false;
  });
});
