var q = 1;
var tQ;

// go to the next question
function nextQuestion()
{
  if (q < tQ)
  {
  
    $("#questions").find("#q"+q).slideUp().next().slideDown();
    q++;
    $("#currentQ").text(q);
    
    $("#record-swf").get(0).setIID(q);
  
  }
  else
  {
    $("#questions").slideUp();
    $("#thanks").slideDown();
    
    $("#skip").addClass("hidden");
    $("#startOver").removeClass("hidden");
    
    $("#record-swf").addClass("hidden");
  
  }
}

// reset the questions
function startOver()
{
  q = 1;

  $("#questions").find("#q"+q).show();
  $("#questions").find("#q"+tQ).hide();
  $("#questions").slideDown();
  $("#thanks").slideUp();
  $("#currentQ").text(q);
  
  $("#skip").removeClass("hidden");
  $("#startOver").addClass("hidden");
  
  $("#record-swf").removeClass("hidden"); 
  $("#record-swf").get(0).setIID(q); 
}


// when the document is loaded, do some fun things.
$(document).ready(function()
{
  tQ = $("#questions").children().size();
  
  $("#totalQ").text(tQ);
  	
	$("#skip").live('click', function()
	{
      nextQuestion();
  });
  
  $("#startOver").live('click', function()
	{
      startOver();
  });
    
});

