 var current_id;
 function ShowMenu(id,flag) {
    if (document.getElementById('menugroup_'+id)) {
      var group=document.getElementById('menugroup_'+id);
       if (flag==1) {
        group.style.display='';
        if ((current_id>0) && (current_id!=id)) { document.getElementById('menugroup_'+current_id).style.display='none'; }
        current_id=id;
       }
       else {
        group.style.display='none';
       }
    }
 }



 function MakeSearch() {
          request=new Ajax.Request(
                "ajax/sear.php?quer="+$('search_cell').value,
                {
                 method: 'get',
                 onComplete: function(resp) {
                     $('main_content').innerHTML=resp.responseText;
                 }
                }
               );
     }

 var process=false;
 function SlideUpDown(id) {
  if ((!process) && ($(id))) {
     if ($(id).className=='hdiv') {
       $(id).className='vdiv';
       $(id).style.display='none';
     }
     if ($(id).style.display=='none') {
       new Effect.SlideDown(id,{beforeStart:function(){process=true;},afterFinish:function(){process=false;}});
     }
     else {
      new Effect.SlideUp(id,{beforeStart:function(){process=true;},afterFinish:function(){process=false;}});
     }
  }
}


function GetContent(flag,id) {
   Loading(true);
   request=new Ajax.Request(
                "ajax/getcont.php",
                {
                 method: 'post',
                 parameters: 'action='+flag+'&id='+id,
                 onComplete: function(resp) {
                     $('content_'+id).innerHTML=resp.responseText;
                     Loading(false);
                 }
                }
               );
}


function Loading(fl) {
 if (fl==true) {
        html="<table width=100%><tr><td align=center><img src=\"images/loading.gif\"></td></tr></table>";
        showDialog('Загрузка',html,'prompt',false,200,35);
  } else {
       hideDialog();
  }
 }

function Shrink(id) {
  var cl=$('li_'+id).className;
  if (cl=='out') {$('li_'+id).className='in';} else {$('li_'+id).className='out';}
  SlideUpDown('q_'+id);
  return false;
}


