$(document).ready(function(){   
   $.fn.alignCenter = function() {
      var marginLeft =  - $(this).width()/2 + 'px';
      var marginTop =  - $(this).height()/2 + 'px';
      return $(this).css({'margin-left':marginLeft, 'margin-top':marginTop});
   };
   $.fn.togglePopup = function(){
     if($('#popup').hasClass('hidden'))
     {
       if($.browser.msie)
       {
         $('#opaco').height($(document).height()).toggleClass('hidden')
                    .click(function(){$(this).togglePopup();});
       }
       else
       {
         $('#opaco').height($(document).height()).toggleClass('hidden').fadeTo('slow', 0.7)
                    .click(function(){$(this).togglePopup();});
       }
       $('#popup')
         .html($(this).html()).alignCenter().toggleClass('hidden');
     }
     else
     {
       $('#opaco').toggleClass('hidden').removeAttr('style').unbind('click');
       $('#popup').toggleClass('hidden');
     }
   };
});
function showPopup(href,act){
    if(act=='delete'){
        if(!confirm("Данное действие не может быть отменено.\nПродолжить выполнение?")){
                return false;
            }
        }
    $.get(href,{action:act}, function(data){
        $('#admin').togglePopup();  
        $('#admin_content').html(data); 
        $('#popup').alignCenter();  
        });
    
}
