// JavaScript Document

function Validate(form)	{

	var formErrors = true;
	//$(form).find("input")
	$('.required').each(function(){
		if ($(this).val() == "") {			
				$(this).focus(function() {
					$(this).css({"border-color":"#aaa","background-color":"#fff","background-image":"none"});
				});
				$(this).css({"border-color":"#ff0000","background-color":"#eee"});
				//$("#message").css({ width: '30px', height: '10px', 'text-align': 'center'});
				
				formErrors = false;
		} else {
			$(this).css("background-image","none");
		}
	})
	
	if (formErrors == false) {
		$("#summary").css("display","block");
	}
	
	return formErrors;
}


function PrepareForm() {
	
	 $(".required").each(function() {
					if ($(this).val() != "") {
						$(this).css("background-image","none");
					}
					$(this).focus(function() {
						$(this).css("background-image","none");
					});
					$(this).blur(function() {
						if ($(this).val() == "") {
							$(this).css("background-image","url('images/required.png')");
						}
					});
			});		
   $("#form1").submit(function(){
   		return (Validate($(this)));
 	});
   
	
 }
 
  $(document).ready(PrepareForm);