function goFormPasswordRestoration()
{
    if(!isValidEmailAddress($('#password_restoration_email').attr('value')))
	{
        $('#password_restoration_email').fadeOut(200).fadeIn(200).fadeOut(200).fadeIn(200).fadeOut(200).fadeIn(200).focus();
		return;
	}

	$("#password_restoration_error").html('<font color="green">проверяю.....</font>') ;
	$.post(URL+"ajax/registration/password_restoration.htm",{'user_email':$('#password_restoration_email').val()},function(data){
		if(data)
		{
			$("#password_restoration_error").html(data) ;
		}
		else
		{
			$("#password_restoration_error").html('');
			$("#load_password_restoration").html( $('#text_password_restoration').html()) ;
		}

	});	
}
function goFormClinic()
{
    var checkInput = new Array('new_clinic_name','new_clinic_user_email','new_clinic_user_password1','new_clinic_user_password2','user_mob_tel','new_clinic_user_name') ;
	for(var i=0;i<checkInput.length;i++)
	{
		if (!$('#'+checkInput[i]).attr('value')) {
			$('#'+checkInput[i]).fadeOut(200).fadeIn(200).fadeOut(200).fadeIn(200).fadeOut(200).fadeIn(200).focus();
			return;
		}
	}
	if(!isValidEmailAddress($('#new_clinic_user_email').attr('value')))
	{
		$('#new_clinic_user_email').fadeOut(200).fadeIn(200).fadeOut(200).fadeIn(200).fadeOut(200).fadeIn(200).focus();
		return;
	}
	
	$("#new_clinic_error").html('<font color="green">записываю.....</font>') ;
	var str = $('#form_new_clinic').serialize();	
	$.post(URL+"ajax/registration/new_clinic.htm",str,function(data){
		
		if(data)
		{
			$("#new_clinic_error").html(data) ;
		}
		else
		{
			$("#new_clinic_error").html('');
			$("#load_new_clinic").html( $('#text_good_registration').html()) ;
		}

	});	
}
function isValidEmailAddress(emailAddress) {
    var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
    return pattern.test(emailAddress);
}

function goAuth()
{
    $("#auth_error").html('<font color="green">авторизовываюсь.....</font>') ;
	var str = $('#form_auth').serialize();	
	$.post(URL+"ajax/auth.htm",str,function(data){
		
		if(data=='1')
		{
			location.href = '';
		}
		else
		{
			$("#auth_error").html(data) ;
		}

	});
}
