function aoaSetVisibility(id, visibility) {
   "use strict";
	document.getElementById(id).style.display = visibility;
}

function aoaShowClose() {
   "use strict";
	var closeBtns = document.getElementsByClassName("aoa_close_btn");
        Array.prototype.slice.call(closeBtns).every(function(closeBtn) {
                closeBtn.style.display = "block";
        } );

	var closeTexts = document.getElementsByClassName("aoa_close");
        Array.prototype.slice.call(closeTexts).every(function(closeText) {
                closeText.style.display = "block";
        } );
}

function aoaHideClose() {
   "use strict";
	var closeBtns = document.getElementsByClassName("aoa_close_btn");
        Array.prototype.slice.call(closeBtns).every(function(closeBtn) {
                closeBtn.style.display = "none";
        } );

	var closeTexts = document.getElementsByClassName("aoa_close");
        Array.prototype.slice.call(closeTexts).every(function(closeText) {
                closeText.style.display = "none";
        } );
}

function aoaHideAd() {
   "use strict";
	var ads = document.getElementsByClassName("aoa_overlay");
        Array.prototype.slice.call(ads).every(function(ad) {
                ad.style.display = "none";
        } );
}

function aoaShowAd() {
   "use strict";
	var ads = document.getElementsByClassName("aoa_overlay");
        Array.prototype.slice.call(ads).every(function(ad) {
                ad.style.display = "block";
        } );
}

function aoaClick() {
   "use strict";
        var d = new Date();
        var hours = 24;
        d.setTime(d.getTime() + (hours*60*60*1000));
        var expires = "expires="+ d.toUTCString();
        document.cookie = "aoa" + "=" + "1" + ";" + expires + ";path=/";
	aoaHideAd();
}

jQuery(document).ready(function(){
   "use strict";
	if ( typeof AoaShowAfter !== "undefined" && AoaShowAfter > 0 ) {
		aoaHideAd();
		setTimeout( aoaShowAd, AoaShowAfter * 1000);
	}
	if ( typeof AoaRepeatAfter !== "undefined" && AoaRepeatAfter > 0 ) {
		setInterval( aoaShowAd, AoaRepeatAfter * 1000);
	}
	if ( typeof AoaCloseTimer !== "undefined" && AoaCloseTimer > 0 ) {
		aoaHideClose();
		setTimeout( aoaShowClose, AoaCloseTimer * 1000);
	}
	if ( typeof AoaCloseAfter !== "undefined" && AoaCloseAfter > 0 ) {
		setTimeout( aoaHideAd, AoaCloseAfter * 1000);
	}
	jQuery(".aoa-click").click(function(){ aoaClick(); } );
});

