$(document).ready(function() {

  // Randomize talk bubble
  
  // Initialize values
  bubbles = [];
  
  base_path = '../_facebook/img/';
  
  // Bubbles array (file, textual content)
  bubbles.push( [ 'quotebox-hackers.png', 'Hackers can compromise an unprotected computer in under 15 seconds. Is yours safe?' ] );
  bubbles.push( [ 'quotebox-90percent.png', '90% of American teens have Internet access at home. Do you?' ] );
  bubbles.push( [ 'quotebox-55percent.png', '55% of users find Facebook privacy settings confusing. Do you?' ] );
  bubbles.push( [ 'quotebox-over200.png', 'Over 200 new viruses, Trojans, and other threats emerge every day. Are you protected?' ] );
  bubbles.push( [ 'quotebox-76percent.png', '76% of Facebook users are sharing less personal information. Are you?' ] );
  bubbles.push( [ 'quotebox-81percent.png', '81% of Facebook users are using the site more carefully...  Are you?' ] );
  
  var max_num = bubbles.length;
  var r = Math.floor( Math.random() * max_num);
  var show_this = bubbles[r];
  
  $('#quotebox').html( show_this[1] );
  $('#quotebox').css('background-image', 'url(' + base_path + show_this[0] + ')');
  //


  // Show/hide privacy content
  $('.privacy-link').click(function(e) {
    e.preventDefault();
    $('#privacy-policy').slideToggle();
  });
  //
  
  // Track downloads when form submitted.
  $('#download-form').submit(function(e) {
  
    //e.preventDefault();
  
    chapter = 'chapter' + $('#file-select').val();
    
    //alert(chapter);
    //var pageTracker = _gat._getTracker('UA-16645505-1');
    //pageTracker._trackPageview('/downloads/' + chapter);
    _gaq.push(['_trackPageview', '/downloads/' + chapter]);
    
    return true;
  
  });
  //
  
});
