Create these functions (uses Jquery but can be modified to Javascript):
function alrt(msg) {
var tint = $('<div class="PopupBgTint"></div>');
tint.appendTo('body');
alert(msg);
tint.remove();
}
function cnfrm(msg) {
var tint = $('<div class="PopupBgTint"></div>');
tint.appendTo('body');
var rtrn = confirm(msg);
tint.remove();
return rtrn;
}
<span style="line-height: 17.8px; font-family: Arial,'Liberation Sans','DejaVu Sans',sans-serif; font-size: 14px;">In your CSS file, define PopupBgTint like so:</span>
<span style="line-height: 17.8px; font-family: Arial,'Liberation Sans','DejaVu Sans',sans-serif; font-size: 14px;"><span><span>.PopupBgTint </span></span></span>
{
position: fixed;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
background-color: black;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=50);
-moz-opacity: 0.5;
-khtml-opacity: 0.5;
opacity: 0.5;
z-index:99999; }