/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function scrollHot(outer, inner, heightDiv, speed, time)
{
    var div = $('.' +outer + ' .' + inner).find('.hot').eq('0');
    
    $('.' +outer + ' .' + inner).animate(
        {top:'-' + heightDiv + 'px'},
        speed,
        function(){
            
            $('.' +outer + ' .' + inner).find('.hot').eq(0).remove();
            $('.' +outer + ' .' + inner).append(div);
            $('.' +outer + ' .' + inner).css('top','0px');
            setTimeout(function(){scrollHot(outer, inner, heightDiv, speed, time)}, time);
        }
    );
}

function sighTo( email )
{
    if( email == 'Введите ваш e-mail' ) {alert( 'Введите E-mail'); return false;}
    if( !email ) { alert( 'Введите E-mail'); return false;}
    var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
    if( !filter.test(email) )
    {
        alert('Введите корректный E-mail');
        return false;
    }

    $.ajax({
        type:'POST',
        data:'email='+email+'&act=sighto',
        url:'/ajax',
        success:
            function(data){
                if( data == '1' )
                    alert('Вы успешно подиписны на рассылку новостей');
                else
                    alert(data);
            }
    });    
    
}

$(document).ready(function(){
   scrollHot('lastHot', 'innerhot', 200, 2000 ,8000);
    //                              height, speed, time
    $("a.fancy").fancybox();
});
