function freeStoreOpen() {
    if ($('#yalla-box').length < 1) {
        var boxLeftSpace = ($(document).width()/2)-300;
        var boxBG = $(jQuery('<div id="yalla-box-bg" class="yalla-box-bg"><div class="yalla-box-space">&nbsp;</div></div>').css({opacity: '0.7', left: (boxLeftSpace-10)+'px', height: '470px', top: ($(document).scrollTop()+100)+"px"}).hide());
        var box = $(jQuery('<div id="yalla-box" class="yalla-box">&nbsp;</div>').css({height: '450px', left: boxLeftSpace+'px', top: ($(document).scrollTop()+111)+"px"}).hide());
        var boxLoader = $(jQuery('<div id="yalla-box-loader" class="yalla-box yalla-box-loader">&nbsp;</div>').css({opacity: '0.7', left: boxLeftSpace+'px', height: '450px', top: ($(document).scrollTop()+111)+"px"}).hide());
        $('body').append(boxBG).append(box).append(boxLoader);
        $('#yalla-box-bg').fadeIn(400);
        $('#yalla-box').fadeIn(400,function () {
            $('#yalla-box-loader').show();
            $.ajax({
                type: 'post',
                url: '/freestore.ajax.php',
                data: 'stage=firstStage',
                success: function(data) {
                    $('#yalla-box-loader').hide();
                    $('#yalla-box').html(data);
                },
                dataType: 'html',
                error: function() {
                    alert('error');
                }
            });
        });
    }
}

function freeStoreClose() {
    $('#yalla-box').fadeOut(400);
    $('#yalla-box-loader').fadeOut(400);
    $('#yalla-box-bg').fadeOut(400,function() {
        $('#yalla-box').remove();
        $('#yalla-box-bg').remove();
        $('#yalla-box-loader').remove();
    });
}
