/*
 * Code to setup the jQuery form validation on forms
 *
 * Author: Nick Schoonens <nick@marketing-results.com.au>
 * Date: 13/05/2009
 * Version: 1.0
 */


$(document).ready(function(){
	// Trigger the validation on all forms on the page
  $("form.report-signup").validate();
	
	// Add the required attribute to all labels for an item (in case we want to make them bold)
	// This isn't great because it's not degradable - so if you want it 100% usable, make sure you add the class manually
	$(":input.required").each(function() {
		if ($(this).attr("id")) {
			$("label[for=" + $(this).attr("id") + "]").addClass("required");
		}
	});
	



	
	// Make it so that selected elements are given a class so they can be styled if needed
	$(":input")
	.addClass("inactive-item")
	.focus(function() {
		$(this).removeClass("inactive-item");
		$(this).addClass("active-item");
	})
	.blur(function() {
		$(this).removeClass("active-item");
		$(this).addClass("inactive-item");
	})
});