$(document).ready(function() {

	// fade in content
	// Note: abandoning this for now due to flickering in some browsers
  // $('.internal #content').hide().fadeIn('slow');
	
	// If this is the home page
	if ($("body").hasClass("home")) {
    // Run the question slideshow
    start_intro();
	}

	// hide contact form
  if ($('#contact-thanks-message').is(':visible')) {
    $('#contact-form').hide();
  }
  
  //hide newsletter form
  if ($('#newsletter-thanks-message').is(':visible')) {
    $('#newsletter-form').hide();
  }
});

// Misc functions
function start_intro () {  
  // Do the slideshow stuff
  $('h2#questions').hide();
  $('p#findout').hide();
  $('<h2 id="question1">Lacking good software systems?</h2>')
    .insertAfter('h2#questions')
    .hide()
    .fadeIn(3000)
    .delay(1000)
    .fadeOut(2000, function() {
  	  $('<h2 id="question2">Lacking good software expertise?</h2>')
    	  .insertAfter('h2#question1')
    	  .hide()
    	  .slideDown(2000).delay(1000).fadeOut(2000, function() {
          $('<h2 id="question3">Not gaining an edge from software?</h2>')
            .insertAfter('h2#question2')
            .hide()
            .slideDown(2000);
          $('p#findout').delay(2100).fadeIn(1200);
        });
    });
}

