function storeAd( params ) {
    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: '520px', top: ($(document).scrollTop()+100)+"px"}).hide());
        var box = $(jQuery('<div id="yalla-box" class="yalla-box">&nbsp;</div>').css({height: '500px', 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: '500px', top: ($(document).scrollTop()+111)+"px"}).hide());
        var boxBGOverlay = $('<div class="yalla-box-overlay" id="yalla-box-overlay"></div>').css({
            height: $(document).height()+'px',
            width: $(document).width()+'px',
            opacity: 0.7
        });
        $('body').append(boxBGOverlay).append(boxBG).append(box).append(boxLoader);
        $('#yalla-box-bg').show(0);
        $('#yalla-box').show(0,function () {
            $('#yalla-box-loader').show();
            $.post('/storead.ajax.php',params,function(data) {
                $('#yalla-box-loader').hide();
                $('#yalla-box').html(data);
            },'html');
        });
    }
}

function storeAdClose() {
    $('#yalla-box').hide(0);
    $('#yalla-box-loader').hide(0);
    $('#yalla-box-bg').hide(0,function() {
        $('#yalla-box-overlay').remove();
        $('#yalla-box').remove();
        $('#yalla-box-bg').remove();
        $('#yalla-box-loader').remove();
    });
}

function storeAdContact() {
    $('#yalla-box-loader').show();
    $.post('/storead.ajax.php','contact=1',function(data) {
        $('#yalla-box-loader').hide();
        $('#yalla-box').html(data);
    },'html');
}
