

jQuery(document).ready(function(){


	// Place ID's of all required fields here.
	required = ["firstname", "lastname", "phone", "email", "zip"];
	// If using an ID other than #email or #error then replace it here
	firstname = jQuery("#firstname");
	lastname = jQuery("#lastname");
	phone = jQuery("#phone");
	email = jQuery("#email");
	zip = jQuery("#zip");
	errornotice = jQuery("#error");
	// The text to show up within a field when it is incorrect
	emptyerror = "Please fill out this field.";
	emailerror = "Invalid Email";

	jQuery("#consult_form").submit(function(){	
		//Validate required fields
		for (i=0;i<required.length;i++) {
			var input = jQuery('#'+required[i]);
			if ((input.val() == "First Name") || (input.val() == "Last Name") || (input.val() == "Phone Number") || (input.val() == "Email Address") || (input.val() == "Zip") || (input.val() == emptyerror)) {
				input.addClass("error_input_field");
			} else {
				input.removeClass("error_input_field");
			}
		}
		// Validate the e-mail.
/*
		if (!/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(email.val())) {
			email.addClass("error_input_field");
			email.val(emailerror);
		}
*/

		if (jQuery('#nonconfidential').not(':checked')) {
			jQuery('#nonconfidential').next().addClass("error_label");
		}
		if (jQuery('#nonconfidential').is(':checked')) {
			jQuery('#nonconfidential').next().removeClass("error_label");
		}
		
		if (jQuery('#privacypolicy').not(':checked')) {
			jQuery('#privacypolicy').next().addClass("error_label");
		}
		
		if (jQuery('#privacypolicy').is(':checked')) {
			jQuery('#privacypolicy').next().removeClass("error_label");
		}

		//if any inputs on the page have the class 'needsfilled' the form will not submit
		if (jQuery(":input").hasClass("error_input_field") || jQuery("label").hasClass("error_label")) {
			return false;
		} else {
			errornotice.hide();
			return true;
		}
	});
	
	
	// Place ID's of all required fields here.
	ctcrequired = ["name", "yourphone"];
	// If using an ID other than #email or #error then replace it here

	name = jQuery("#name");
	yourphone = jQuery("#yourphone");
	errornotice = jQuery("#error");
	// The text to show up within a field when it is incorrect

	
		jQuery("#clicktocall").submit(function(){	
		//Validate required fields
		for (i=0;i<ctcrequired.length;i++) {
			var ctcinput = jQuery('#'+ctcrequired[i]);
			if ((ctcinput.val() == "Your Name") || (ctcinput.val() == "Phone Number") || (ctcinput.val() == emptyerror)) {
				ctcinput.addClass("error_input_field");
			} else {
				ctcinput.removeClass("error_input_field");
			}
		}

		//if any inputs on the page have the class 'needsfilled' the form will not submit
		if (jQuery(":input").hasClass("error_input_field") || jQuery("label").hasClass("error_label")) {
			return false;
		} else {
			errornotice.hide();
			return true;
		}
	});
	
	
	
	
	
	jQuery.fn.clearOnFocus = function(){
    return this.focus(function(){
        var v = jQuery(this).val();
        jQuery(this).val( v === this.defaultValue ? '' : v );
    }).blur(function(){
        var v = jQuery(this).val();
        jQuery(this).val( v.match(/^\s+$|^$/) ? this.defaultValue : v );
    });
 
	};
	jQuery('input.input_field').clearOnFocus();


});



jQuery(document).ready(function(){


	// Place ID's of all required fields here.
	required = ["firstname", "email"];
	// If using an ID other than #email or #error then replace it here
	firstname = jQuery("#firstname");
	email = jQuery("#email");
	errornotice = jQuery("#error");
	// The text to show up within a field when it is incorrect
	emptyerror = "Please fill out this field.";
	emailerror = "Invalid Email";

	jQuery("#yazconsult_form").submit(function(){	
		//Validate required fields
		for (i=0;i<required.length;i++) {
			var input = jQuery('#'+required[i]);
			if ((input.val() == "") || (input.val() == emptyerror)) {
				input.addClass("error_input_field");
			} else {
				input.removeClass("error_input_field");
			}
		}

		if (jQuery('#nonconfidential').not(':checked')) {
			jQuery('#nonconfidential').next().addClass("error_label");
		}
		if (jQuery('#nonconfidential').is(':checked')) {
			jQuery('#nonconfidential').next().removeClass("error_label");
		}
		
		if (jQuery('#privacypolicy').not(':checked')) {
			jQuery('#privacypolicy').next().addClass("error_label");
		}
		
		if (jQuery('#privacypolicy').is(':checked')) {
			jQuery('#privacypolicy').next().removeClass("error_label");
		}

		//if any inputs on the page have the class 'needsfilled' the form will not submit
		if (jQuery(":input").hasClass("error_input_field") || jQuery("label").hasClass("error_label") || jQuery("span").hasClass("error_label")) {
			return false;
		} else {
			errornotice.hide();
			return true;
		}
	});
	
	
	
	jQuery.fn.clearOnFocus = function(){
    return this.focus(function(){
        var v = jQuery(this).val();
        jQuery(this).val( v === this.defaultValue ? '' : v );
    }).blur(function(){
        var v = jQuery(this).val();
        jQuery(this).val( v.match(/^\s+$|^$/) ? this.defaultValue : v );
    });
 
	};
	jQuery('input.input_field').clearOnFocus();

	
});