﻿$(document).ready(function() {

	// validate signup form on keyup and submit
	var validator = $("#loginform").validate({	
		
	
	 submitHandler: function(form) {

     jQuery(form).ajaxSubmit({

    target: "#login",
    timeout: 3000 // тайм-аут

               });

       },
	
		// set this class to error-labels to indicate valid fields
		success: function(label) {
			// set &nbsp; as text for IE
			label.html("&nbsp;");
		}
	
		});

});

// this one requires the value to be the same as the first parameter
	$.validator.methods.equal = function(value, element, param) {
		return value == param;
	};


$(document).ready(function() {

$('label.ignore').append('&nbsp;&nbsp;&nbsp;');
$('label.required').append('&nbsp;<font color="#af0c61"><strong>*</strong></font>&nbsp;');



	// validate signup form on keyup and submit
	var validator = $("#signupform").validate({	
	
	 

ignore: ".ignore", 


		rules: {
	    	
		   contact: "required",		
		   phone: "required",

			password: {
				required: true,
				minlength: 5
			},
			password_confirm: {
				required: true,
				minlength: 5,
				equalTo: "#password"
			},
			
			email: {
				required: true,
				minlength: true
			
			}
		},
			
					
		messages: {
  
		     contact: "Введите имя контактного лица",
			 phone: "Введите правильный номер телефона",
		  
			password: {
				required: "Введите пароль",
				rangelength: jQuery.format("Введите минимум {0} символов")
			},
			password_confirm: {
				required: "Повторите пароль",
				minlength: jQuery.format("Введите минимум {0} символов"),
				equalTo: "Введите одинаковый пароль"
			},
				
			email: {
				required: "Введите правильный email адрес",
				minlength: "Введите правильный email адрес"
			
			}
			
		},

		// the errorPlacement has to take the table layout into account
		errorPlacement: function(error, element) {
		
			if ( element.is(":radio") )
				error.appendTo( element.parent().next().next() );
			else if ( element.is(":checkbox") )
				error.appendTo ( element.next() );
			else
				error.appendTo( element.parent().next() );
		},

	
	 submitHandler: function(form) {

     jQuery(form).ajaxSubmit({

    target: "#regoutput",
    timeout: 3000 // тайм-аут

               });

       },
	
		// set this class to error-labels to indicate valid fields
		success: function(label) {
			// set &nbsp; as text for IE
			label.html("&nbsp;").addClass("checked");
		}

		});

	 $("input.phone").mask("(999) 999-9999");
	
});


$(document).ready(function() {





	// validate signup form on keyup and submit
	var validator = $("#signinform").validate({	

ignore: ".ignore", 


		rules: {
	    	
		   contact: "required",		
		   phone: "required",
		   salon: "required",
           date: "required",		   
		   vremya: "required",

		
			email: {
				
				minlength: true
			
			}
		},
			
					
		messages: {
  
		     contact: "Введите имя контактного лица",
			 phone: "Введите правильный номер телефона",
			 salon: "Выберите адрес салона",
			  date: "Выберите дату",
			 vremya: "Выберите удобное время",
		  
		
				
			email: {
		
				minlength: "Введите правильный email адрес"
			
			}
			
		},

		// the errorPlacement has to take the table layout into account
		errorPlacement: function(error, element) {
		
			if ( element.is(":radio") )
				error.appendTo( element.parent().next().next() );
			else if ( element.is(":checkbox") )
				error.appendTo ( element.next() );
			else
				error.appendTo( element.parent().next() );
		},

	
	 submitHandler: function(form) {

     jQuery(form).ajaxSubmit({

    target: "#signoutput",
    timeout: 3000 // тайм-аут

               });

       },
	
		// set this class to error-labels to indicate valid fields
		success: function(label) {
			// set &nbsp; as text for IE
			label.html("&nbsp;").addClass("checked");
		}

		});

	
	
});







