/**
* catalog.js
*/

var uidUrl = '/user/uid.ajax';

function sendProfileData()
{
    if($('#profile_email').attr('value').length == 0 || $('#profile_password').attr('value').length == 0)
    {
        $('#err-message #err-message-text').text('Необходимо заполнить обязательные поля!');
        $('#err-message').show();
        return false;
    }
    else if($('#profile_password').attr('value') != $('#profile_password_confirm').attr('value'))
    {
        $('#err-message #err-message-text').text('Пароли не совпадают!');
        $('#err-message').show();
        return false;
    }

    return true;
}

$(document).ready(function()
{
    $('#user-profile input').each(function()
    {
        $(this)
            .focus(function()
            {
                $(this).addClass("form-input-active");
            })
            .blur(function()
            {
                $(this).removeClass("form-input-active");
            });
    });

    $('#user-profile #profile_email').focus();

    $.ajax({
        url:uidUrl,
        type:'POST',
        async:true,
        dataType:'xml',
        cache:false,
        success:function(data)
        {
            $('result',data).each(function()
            {
                $('#user-profile #uid').attr("value",$('uid', $(this)).text());
            });
        }
    });
});

