function announcement(a,id){
        //  debugger;
        var i=0;
        var Ltype=document.getElementById('T1');
        var Lemail=document.getElementById('CL_email');
        var Lbaner=document.getElementById('picture');
        var Lbaner_path=document.getElementById('picture_new');
        var Ltext=document.getElementById('CL_text');
        var L_period=document.getElementById('CL_period');
        var Lresult=document.getElementById('R_add');
        var L_category=document.getElementById('CL_category');
        var region=document.getElementById('region').value;
        if (a==1 || a==3){

                  if (a==1) {var action ='add';}
                  if (a==3) {var action ='edit';}
                  if (Ltype.value.length>0) {i++;}
                  if (Lemail.value.length>0) {i++;}
                  if (Ltext.value.length>0) {i++;}
                  if (EMCHK(Lemail)){i++;}
                  if (i==4)
                  { wait('Подождите, идет обработка данных');
                    doLoad({'ect':action,'type':Ltype.value,'email':Lemail.value,'picture':Lbaner.value,'text':Ltext.value,'period':L_period.value,'category':L_category.value,'region':region,'id':id},'/ajax_response/announcement_response.php5','announcement(2);');

                    }
                  else {alert('Не все поля запонены или заполнены не верно!');}
        }
        if (a==2){Lbaner.value=Ltext.value= Lbaner_path.value=Lbaner_path='';
                   document.getElementById('pic_new').src='/images/noimages.gif';
                   stop_wait();window.scroll(0,0);
                 //Lresult.innerHTML='<b>Заполните форму:</b>';
        }
  }
  function EMCHK(nod)
  {
    if (!check_email(nod.value)) {nod.style.color='red'; return false;}
    else  {nod.style.color=''; return true;}
  }

function content_pr(obg){
	var content='<div style="padding:10px; magrin:10px;">'+obg.parentNode.childNodes[1].innerHTML+'</div>';
return  content;}

function act_anno(act,List){
   if(List){doload_2({'act':act, 'id': List}, '','/ajax_response/announcement_response.php5','wait();','stop_wait();');}
}

function paging_ajax(pagingArray){
    var paging_str='';
    var kol=pagingArray.length;
  if (kol>1){
   //   document.getElementById('show_links').innerHTML= kol;

     for(var i=0; i<kol;i++){
         if (pagingArray[i]!=undefined){
 	        paging_str+='<span onclick="paging(this)">'+pagingArray[i]+'</span> ';
         }
     }
   }
    document.getElementById('paging_show_anno').innerHTML=paging_str;

}

function paging(obj){
	doload_2({'act':'paging','page':obj.innerHTML},'admin_show_anno','/ajax_response/announcement_response.php5','wait("Подождите, идет обработка данных");','stop_wait();')
}
