

$(document).ready(function () {  
    validateForm()
});

function validateForm() {
   checkFields($('form#quote'));
   checkFields($('form#quote-request-panel'));
}

function checkFields(form){
	form.submit(function(){
        var failed = false;
	    $('p input[type="text"]', this).each(function(index, element){
	        var value = $(element).val();
	        if (!failed && value.length < 1) {
				alert('There was an error with your request. Please ensure you have completed all the fields, and that the data you have entered is correct.');
				failed = true;
			}	        
        });

		return !failed;
    });
}


