function wave(){
    var card = $("#bank_products .product a");
    cards = [];
    card.each(
        function(){
            cards.push(new Card($(this)));
        }
    );

    //new Card($("#card_right a"));

    var waveCards = function(){
        for(var i=0; i < cards.length; i++){
            cards[i].trig(i);
        }
    };

    $("h2 a").hover(waveCards);
    waveCards();
}

function Card(el){
    var card = el;
    var img = el.find("img");
    var isAnimated = false

    img.hover(
        function(){
            if(!isAnimated){
                isAnimated = true;
                img.animate({top: -10}, 200);
            }
        },
        function(){
            img.animate({top: 0}, 200, function(){isAnimated = false});
        }
    );

    var trigHover = function(time){
        setTimeout(
            function(){
                if(!isAnimated){
                    isAnimated = true;
                    img.animate({top: -10}, 200, function(){
                        img.animate({top: 0}, 200, function(){isAnimated = false});
                    });
                }
            }, time*100       
        )
    };

    return{
        trig: function(time){
            trigHover(time);
        }
    }
}

$(function(){
	wave();
});

$(document).ready(function(){
	$('.register_link').mouseover(function(){
    $('.register_content span').css('background','url("/f/1/global/i/little_logo.png") no-repeat scroll -33px top transparent');
	});
	$('.register_link').mouseout(function(){
    $('.register_content span').css('background','url("/f/1/global/i/little_logo.png") no-repeat scroll left top transparent');
	});
});