function changeStamp(){

    $(".stamp").each(function(){

        var stampType = $(this).attr("stampType");

        if (getHash(stampType).stamps.length > 1)
        
            $(this).animate({opacity: 0.5}, 750, function(){

                $(this).attr("src", getNextStamp( stampType ).src);

                $(this).animate({opacity: 1}, 750, function(){

            });
            
        });     

    });

}

function getNextStamp(stampType){

    var stampHash = getHash(stampType);

    stampHash.lastIndex = (stampHash.lastIndex == stampHash.stamps.length - 1) ? 0 : stampHash.lastIndex + 1;

    return stampHash.stamps[stampHash.lastIndex];

}

function getHash(stampType){
    return eval("stamp" + stampType);
}

function initStamp(){

    $(".stamp").each(function(){
        $(this).attr("src", getNextStamp( $(this).attr("stampType") ).src);
    });


    window.setInterval(function(){
        changeStamp();
    }, 3000);

}