function identicalAllDays(){
  $(document).ready(function(){
     if($('#all_days').attr('checked')){
       var arr = $("tr");
       for(i=1; i<arr.length;i++){
        $('#tr_'+i).hide();
      }
     }else{
        var arr = $("tr");
       for(i=1; i<arr.length;i++){
        $('#tr_'+i).show();
      }
     }
  });
}


function  addForm( ident ){
       $(document).ready(function(){
        var ident_arr = ident.split('_');
        var next_num = +ident_arr[1]+1;
        var shab ='<select name="time_list['+ident_arr[0]+']['+next_num+'][start_h]">';
        for(var i=0; i<24; i++){
          shab= shab+'<option value="'+i+'">'+i+'ч';
        }
        shab+='</select>&#x2009;<select name="time_list['+ident_arr[0]+']['+next_num+'][start_m]">';
        for(var m=0; m<60; m+=5){
          if(m<10){ shab+='<option value="0'+m+'">0'+m+'мин'; }else{
              shab+='<option value="'+m+'">'+m+'мин';
          }
        }
        shab +='</select>&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<select name="time_list['+ident_arr[0]+']['+next_num+'][end_h]">';
        for(var i=0; i<24; i++){
          shab= shab+'<option value="'+i+'">'+i+'ч';
        }
        shab+='</select>&#x2009;<select name="time_list['+ident_arr[0]+']['+next_num+'][end_m]">';
        for(var m=0; m<60; m+=5){
          if(m<10){ shab+='<option value="0'+m+'">0'+m+'мин'; }else{
              shab+='<option value="'+m+'">'+m+'мин';
          }
        }
        shab+='</select>&#x2002;';
        shab+='<input name="time_list['+ident_arr[0]+']['+next_num+'][price]">';
        shab+='<input name="time_list['+ident_arr[0]+']['+next_num+'][note]">';
        shab+='<a href="#" onclick="addForm(\x27'+ident_arr[0]+'_'+next_num+'\x27)" id="a_'+ident_arr[0]+'_'+next_num+'"><img src="/images/icons/add.gif"></a>';
        shab+='&#x2002;<a href="#" onclick="delForm(\x27'+ident_arr[0]+'_'+next_num+'\x27)" id="del_'+ident_arr[0]+'_'+next_num+'"><img src="/images/icons/del.png"></a>';
        shab+='<div id="'+ident_arr[0]+'_'+next_num+'"></div>';
        $('#'+ident).html(shab);
        $('#a_'+ident).hide();
        $('#del_'+ident).hide();

       })
}

function delForm(ident){
        $(document).ready(function(){
          var ident_arr = ident.split('_');
          var prev_num = +ident_arr[1]-1;
          var prev_ident = ''+ident_arr[0]+'_'+ prev_num;
          $('#'+prev_ident).html('');
          $('#a_'+prev_ident).show();
          $('#del_'+prev_ident).show();
        })
}
