//** ------------------------------------- **//
//** overlayMsg function ver. 0.3beta      **//
//** Copyright 2011 by Piotr Szymankiewicz **//
//** license for WEBMOTION                 **//
//** ------------------------------------- **//

function overlayMsg(overMsg,dealy){

//-- settings --//


    var imageClosePath = "http://madis.pl/close.png"  // close button
    
    var backgroundPathMode = 0 // 1 = #color | 0 = background: url(....) , default = 0    
    var backgroundColor = "#000000" // if backgroundPathMode is = 1   
    var imageBackgroundPath = "http://no21.pl/images/bg_overlay.png"  // background image
    
    var textColor = "#ffffff" // color text
    var backgroundMsg = 'transparent' // background div overlayMsg
    
    var dealyCloseOverlay = dealy // dealy close overlayMsg (milliseconds)
    var topPadding = '20px' // example: 20px or 20%
    var widthDivOverlay = '881px'   // example: 20px or 20%
    var paddingLeftCloseButton = '799px'   // example: 20px or 20%
    var marginTopCloseButton = '-20px'     // example: 20px or 20%
    
    
//-- please do not edit --//       

    var heightBody = $(window).height(); 
    $('body').html('<div id="overlayBody"><div id="overlayMsg"><img src="'+imageClosePath+'" alt="close" />'+overMsg+'</div></div>');
    
    if(backgroundPathMode == 1){ 
      $('#overlayBody').css({background:''+backgroundColor+'', position:'absolute', width:'100%', height:'100%', top:'0', left:'0', zIndex:'99999', opacity:'0.8'});
    }else{
      $('#overlayBody').css({background:'url('+imageBackgroundPath+')', position:'fixed', width:'100%', height: heightBody+'px' , padding:'0', margin:'0', bottom:'0', right:'0', top:'0', left:'0', zIndex:'99999'});
    }

    $('#overlayMsg').css({background:''+backgroundMsg+'', position:'relative', width:''+widthDivOverlay+'', color:''+textColor+'', padding:'20px', top:''+topPadding+'', margin:'0 auto'});
    $('#overlayMsg img[alt="close"]').css({position:'absolute', zIndex:'1112', marginTop:''+marginTopCloseButton+'', marginLeft:''+paddingLeftCloseButton+'', cursor:'pointer'});
    
    $('#overlayMsg img[alt="close"]').click(function() {
      $('#overlayBody').hide();
    });
    
    setTimeout(function() { $('#overlayBody').hide(); }, dealyCloseOverlay);
}
