$(function() {
  $('.error').hide();
  $('input.text-input').css({backgroundColor:"#FFFFFF"});
  $('input.text-input').focus(function(){
    $(this).css({backgroundColor:"#FFDDAA"});
  });
  $('input.text-input').blur(function(){
    $(this).css({backgroundColor:"#FFFFFF"});
  });

  $(".button").click(function() {
		// validate and process form
		// first hide any error messages
    $('.error').hide();
		
	  var rank = $("select#rank").val();
	  var videoid = $("input#videoid").val();
	  
	  var dataString = 'rank='+ rank + '&videoid='+ videoid;
	 
	// alert (dataString);return false; - for testing to make sure the values pass
		
		$.ajax({
      type: "POST",
      url: "submit_rating.php",
      data: dataString,
      success: function() {
        $('#ranking_form').html("<div id='message'></div>");
        $('#message').html("<h2>Your Ranking of this Video has been Submitted!</h2>")
        .hide()
        .fadeIn(1500, function() {
         <!-- $('#message').append("<img id='checkmark' src='images/check.png' />"); -->
        });
      }
     });
    return false;
	});
});
runOnLoad(function(){
  $("input#name").select().focus();
});
