﻿$().ready(function() {
	// validate signup form on keyup and submit
	
	$("#form-register").validate({
		rules: {
			password: {
				required: true,
				minlength: 5
			},
			confirm_password: {
				required: true,
				minlength: 5,
				equalTo: "#password"
			},
			email: {
				required: true,
				email: true
			},			
			referral: "required"
		},
		messages: {
			password: {
				required: "<span style='color:red;font-weight:bold; font-size: 10px'>Please provide a password</span>",
				minlength: "<span style='color:red;font-weight:bold; font-size: 10px'>Your password must be at least 5 characters long</span>"
			},
			confirm_password: {
				required: "<span style='color:red;font-weight:bold; font-size: 10px'>Please provide a password</span>",
				minlength: "<span style='color:red;font-weight:bold; font-size: 10px'>Your password must be at least 5 characters long</span>",
				equalTo: "<span style='color:red;font-weight:bold; font-size: 10px'>Your passwords do not match, please try again.</span>"
			},
			email: "<span style='color:red;font-weight:bold; font-size: 10px'>Please enter a valid email address</span>",
			user_terms_of_service: "<span style='color:red;font-weight:bold; font-size: 10px'>Please accept our Terms of Service</span>"
		}
		

		
	});
	$("input.phone").mask("(999) 999-9999");
  	$("input.zipcode").mask("99999");

	
	$("#form-refer").validate({
		rules: {
			firstname: "required",
			lastname:	"required",
			ref_firstname: "required",
			ref_lastname:	"required",
			email: {
				required: true,
				email: true
			},
			ref_email: {
				required: true,
				email: true
			}

		},
		messages: {
			firstname: "<span style='color:red;font-weight:bold; font-size: 10px'>This field is required to complete the form.</span>",
			lastname: "<span style='color:red;font-weight:bold; font-size: 10px'>This field is required to complete the form.</span>",
			email: "<span style='color:red;font-weight:bold; font-size: 10px'>Please enter a valid email address.</span>",
			ref_firstname: "<span style='color:red;font-weight:bold; font-size: 10px'>This field is required to complete the form.</span>",
			ref_lastname: "<span style='color:red;font-weight:bold; font-size: 10px'>This field is required to complete the form.</span>",
			ref_email: "<span style='color:red;font-weight:bold; font-size: 10px'>Please enter a valid email address.</span>"
		}
	});
	
	$("#form-contact").validate({
		rules: {
			firstname: "required",
			lastname:	"required",
			message: "required"	,			
			email: {
				required: true,
				email: true
			}
	
		},
		messages: {
			firstname: "<span style='color:red;font-weight:bold'>This field is required to complete the form.</span>",
			lastname: "<span style='color:red;font-weight:bold'>This field is required to complete the form.</span>",
			email: "<span style='color:red;font-weight:bold'>Please enter a valid email address.</span>",
			message: "<span style='color:red;font-weight:bold'>We can't help you if you don't have a message.</span>"
		}
	});
	

	
});

