
$().ready(function()
{
    /* Message support */

    if ($('#message').html()){
        
        $('#message').fadeIn('slow');

        $('#message a.close-notify').click(function () {
            $('#message').fadeOut('slow');
            return false;
        });
    }
    
    /* Login input support */
    
    $('input.login_input').focus(function(){
        
        if(this.value == this.defaultValue){
            this.value='';
        }

    }).blur(function(){
        
        if(this.value == ''){
            this.value = this.defaultValue;
        }
    });
    
    /* Date Filter support */
    if (typeof($.datepicker) != 'undefined')
    {
            $('#dateBegin').datepicker({
                    numberOfMonths: 2,
                    minDate: -90, maxDate: '+0D'
            });
            $('#dateEnd').datepicker({
                    numberOfMonths: 2,
                    minDate: -90, maxDate: '+0D'
            });	
            
    }
})

function formCheck(form) 
{
    err = 0;
    $('#'+form+" .required").each(function () 
    {
        $(this).css("outline", "0px none transparent");
        
        if ($(this).val() == '' || $(this).val()==$(this).attr('defaultValue')) 
        {
            getAttention($(this));
            err++;
        }
    });
    
    if (err) {
        alert('Все поля, отмеченные звездочками, обязательны для заполнения.');
        return false;
    }
    
    return true;
}


function getAttention(to) 
{
    for(i=1; i<=3; i++) {
        $(to).animate({
            outline: "0px none transparent"
        }, 50);
        $(to).animate({
            outline: "1px solid red"
        }, 50);
    }
}

