var map = new Vivus('germany', {
    type: 'async',
    duration: 250,
    start: 'autostart',
    forceRender: false
}, function doDone(obj) {
    $(obj.el).addClass('finished');

    setTimeout(function() { $(obj.el).addClass('ready'); }, 2000);

    setTimeout(function() {
        var elements = document.getElementsByClassName('overlayBox land');
        var t = 0;

        // Iterate through the retrieved elements and add the necessary class names.
        for(var i = 0; i < elements.length; i++)
        {
            t += 150;
            mimiAddClass(elements[i], 'show', t);
        }
    }, 100);


    setTimeout(function() {
        var elements = document.getElementsByClassName('overlayBox dot');
        var t = 0;

        // Iterate through the retrieved elements and add the necessary class names.
        for(var i = 0; i < elements.length; i++)
        {
            t += 50;
            mimiAddClass(elements[i], 'show', t);
        }
    }, 2000);

});

function mimiAddClass(obj, name, t) {
    setTimeout( function() {
        $(obj).addClass(name);
    }, t);
}

$(document).ready(function() {

    $('.overlayBox.dot').bind('touchstart', function() {
        $('.overlayBox').addClass('trans');
        $(this).addClass('hover');
    }).bind('touchend', function(){
        $(this).removeClass('hover');
        $('.overlayBox').removeClass('trans');
    });

    $('.map').bind('touchstart', function() {
        $(this).removeClass('hover');
        $('.overlayBox').removeClass('trans');
    });

    $('.overlayBox.dot').bind('mouseover', function() {
        $('.overlayBox').addClass('trans');
    }).bind('mouseout', function(){
        $('.overlayBox').removeClass('trans');
    });

});