		$(document).ready(function(){ 
			$("#submit").click(function(){
				$(".error").hide();
				var hasError = false;
				var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
				
				$("#form-error").empty();
				
				var subjectVal = $("#name").val();
				if(subjectVal == '') {
					$("#form-error").append("Please enter your name.<br>"); 
					hasError = true;
				}
				
				var emailToVal = $("#email").val();
				if(emailToVal == '') {
					$("#form-error").append("Please enter your email address.<br>"); 
					hasError = true;
				} else if(!emailReg.test(emailToVal)) {
					$("#form-error").append("Please enter a valid e-mail address.<br>"); 
					hasError = true;
				}
				
				var phoneVal = $("#phone").val();
				if(phoneVal == '') {
					$("#form-error").append("Please enter your telephone number.<br>"); 
					hasError = true;
				}
				
				var addressVal = $("#address_1").val();
				if(addressVal == '') {
					$("#form-error").append("Please enter your address.<br>"); 
					hasError = true;
				}
				
				var cityVal = $("#city").val();
				if(cityVal == '') {
					$("#form-error").append("Please enter your city.<br>"); 
					hasError = true;
				}
				
				var stateVal = $("#state").val();
				if(stateVal == '') {
					$("#form-error").append("Please enter your state.<br>"); 
					hasError = true;
				}
				
				var option;
				paymentVal = $("input[@name='payment']:checked").val();
				
				if(paymentVal == 'Mastercard/VISA')
				{
					var cc_nameVal = $("#cc_name").val();
					if(cc_nameVal == '') {
						$("#form-error").append("Please enter the name on your credit card.<br>"); 
						hasError = true;
					}
					
					var cc_cardnumVal = $("#cc_cardnum").val();
					if(cc_cardnumVal == '') {
						$("#form-error").append("Please enter your credit card number.<br>"); 
						hasError = true;
					}
					
					var cc_mmVal = $("#cc_mm").val();
					if(cc_mmVal == '') {
						$("#form-error").append("Please enter your credit card expiry date - month.<br>"); 
						hasError = true;
					}
					
					var cc_yyyyVal = $("#cc_yyyy").val();
					if(cc_yyyyVal == '') {
						$("#form-error").append("Please enter your credit card expiry date - year.<br>"); 
						hasError = true;
					}
					
					var cc_codeVal = $("#cc_code").val();
					if(cc_codeVal == '') {
						$("#form-error").append("Please enter your credit card CC number. (Last 3 digits on the back.)<br>"); 
						hasError = true;
					}
				}
				
				if(paymentVal == 'Purchase Order')
				{
					var po_numVal = $("#po_num").val();
					
					if(po_numVal.length < 2) {
						$("#form-error").append("Please enter a purchase order number.<br>"); 
						hasError = true;
					}
				}
				
				$("#form-error").append("<br>"); 
				
				if(hasError){
					return false;
				}else{
					return true;
				}
			});
		});