$(document).ready(function(){

	$("input,textarea").focus(function() {
		$(this).parent().addClass("focus")
	});
	$("input,textarea").blur(function() {
		$(this).parent().removeClass("focus")
	});

	$('#quoteform').ajaxForm(function(data) {


		if (data.match('Form submission sucessful')){
			$('#quoteform').hide();
			$('#success').fadeIn("slow");
		}
		else{
			if (data.match("Name not valid.")){
				$('#bad1').parent().addClass("highlight")
				$('#bad1').show("slow");
			}
			else{
				$('#bad1').hide("slow");
				$('#bad1').parent().removeClass("highlight");
			}
			if (data.match('Company name not valid.')){
				$('#bad2').parent().addClass("highlight");
				$('#bad2').show("slow");
			}
			else{
				$('#bad2').hide("slow");
				$('#bad2').parent().removeClass("highlight");
			}
			if (data.match('Email not valid.')){
				$('#bad3').parent().addClass("highlight");
				$('#bad3').show("slow");
			}
			else{
				$('#bad3').hide("slow");
				$('#bad3').parent().removeClass("highlight");
			}
			if (data.match('Telephone not valid.')){
				$('#bad4').parent().addClass("highlight");
				$('#bad4').show("slow");
			}
			else{
				$('#bad4').hide("slow");
				$('#bad4').parent().removeClass("highlight");
			}
			if (data.match('Requirements not valid.')){
				$('#bad5').parent().addClass("highlight");
				$('#bad5').show("slow");
			}
			else{
				$('#bad5').hide("slow");
				$('#bad5').parent().removeClass("highlight");
			}

		}
	});
});