

function jqLoading()
{
        $.blockUI({ 
        message: "Загрузка...", 
        fadeIn: 0,
	fadeOut: 0,
        centerY: true,
        css: {
                left: '', 
                //right: '0',
		textAlign:      'left',
		 top: '0', 
                width: '100px', 
                border: 'none', 
                padding: '8px',
                backgroundColor: '#DFE9EE', 
                opacity: .8, 
                color: '#436A6F',
'border-radius': '0 0 6px 0',
'-moz-border-radius':'0 0 6px 0',
'-khtml-border-radius': '0 0 6px 0',
'text-shadow': '0 -1px 0 #F5F7FA'
        },
	showOverlay: false
	   
		/*overlayCSS:  {
			backgroundColor: '#000',
			opacity:          .3
		}*/
        }); 
}

function jqLoadingBlock(id)
{
	jqLoading();
        $(id).block({
        message: null , 
        fadeIn: 0,
	fadeOut: 0,
        centerY: true,
        css: {
                left: '', 
		 top: '0', 
                border: 'none', 
                padding: '5px',
                backgroundColor: '#DFE9EE', 
                opacity: .5, 
                color: '#fff'
        },
	showOverlay: true,
		overlayCSS:  {
			backgroundColor: '#fff',
			opacity:          .3
		}
        }); 
}

function jqBlockMessage(text)
{
        $.blockUI({ 
        message: text, 
            fadeIn: 300, 
            fadeOut: 500, 
            timeout: 2500, 
        centerY: true,
        css: {
                /*width: '250px',*/ 
                border: 'none', 
                padding: '15px',
                backgroundColor: '#AD125E', 
                opacity: .8, 
                color: '#fff',
'border-radius': '6px 6px 6px 6px',
'-moz-border-radius':'6px 6px 6px 6px',
'-khtml-border-radius': '6px 6px 6px 6px',
'text-shadow': '0 -1px 0 #8B0A48'
        },
	showOverlay: false
	   
		/*overlayCSS:  {
			backgroundColor: '#000',
			opacity:          .3
		}*/
        }); 
}


function jqLoadingHide()
{
	/*$("#loading").fadeOut(100);*/
	$.unblockUI();
}

$().ready(function() {
$("body").ajaxError(function(x,e, settings, exception) {
	//$(this).html("Message engine:<br> "+x.type+" "+e.status+": "+e.responseText);
	//$("#ajaxError").fadeIn(100);
	
	        $.blockUI({ 
            message: "Ошибка "+e.status+": "+e.responseText, 
            fadeIn: 100, 
            centerY: true,
            css: {
		textAlign:      'left',
                left: '', 
                //right: '0',
		 top: '0', 
               // width: '100px', 
                border: 'none', 
                padding: '10px',
                backgroundColor: '#ff0000', 
                opacity: .8, 
                color: '#fff' ,
'border-radius': '0 0 6px 0',
'-moz-border-radius':'0 0 6px 0',
'-khtml-border-radius': '0 0 6px 0'
            },
	    showOverlay: false
	   
			/*overlayCSS:  {
				backgroundColor: '#000',
				opacity:          .3
			}*/
        
        }); 
	
});
});

    function getSiteCounter(vId, cookName, setTimer, randPlus)
    {
	$(document).ready(function(){
		
      $('#counter_'+vId).each(function(){
        $(this).text($.cookie('counter_'+cookName));
      });
      
    $(document).everyTime(setTimer, 'timer_stat', function() {
	$('#counter_'+vId).each(function(){
		var cntr=parseInt($(this).text()) + $.random(randPlus);
		$.cookie('counter_'+cookName, cntr, {path: "/"});
		$(this).text(cntr);
      });
    });
     });
    }
