

$(function() {

$("#login").live('change', function() {
		
		
		                      $.ajax({	   type: "POST",
		                                   url: "log.php",
                                           data: "login="+$("#login").val(), 
				                           success: function(html){
					                       $("#login_err").html(html);
										   
					                          		}     
		         
});
});		

$("#domen").live('change', function() {
		
		
		                      $.ajax({	   type: "POST",
		                                   url: "log.php",
                                           data: "domen="+$("#domen").val()+"&domen_zone="+$("#domen_zone :selected").val(), 
				                           success: function(html){
					                       $("#domen_err").html(html);
										   
					                          		}     
		         
});
});	
						   

$("#reg_cat").change(function() {

		                      $.ajax({	   type: "POST",
		                                   url: "reg_cat.php",
                                           data: "reg_cat="+$("#reg_cat").val(), 
				                           success: function(html){
					                       $("#reg_cat_err").html(html);
										   
										   $("#categories").change(function() {

		                      $.ajax({	   type: "POST",
		                                   url: "reg_cat.php",
                                           data: "categories="+$("#categories").val(), 
				                           success: function(html){
					                       $("#categories_err").html(html);
										   	}     
                                                });
                                                });		
					                          		}     
});
});								 


$("#domen_zone").live('change', function() {

		                      $.ajax({	   type: "POST",
		                                   url: "log.php",
                                           data: "zone="+$("#domen_zone :selected").val(), 
				                           success: function(html){
					                       $("#sum").html(html);
										   //$("#sum1").val(html);
					                          		}     
		         
});

		                      $.ajax({	   type: "POST",
		                                   url: "log.php",
                                           data: "domen="+$("#domen").val()+"&domen_zone="+$("#domen_zone :selected").val(), 
				                           success: function(html){
					                       $("#domen_err").html(html);
										   
										   $("#domen_ur").live('change', function() {
										   $.ajax({	   type: "POST",
		                                   url: "log.php",
                                           data: "domen_ur="+$("#domen_ur").val(), 
				                           success: function(html){
					                       $("#domen_ur_err").html(html);
										   
					                          		}     
		         
                                            });
										    });
										   
										   
										   
					                          		}     
		         
});
});		





$(".blocknot_close").live('click', function(){
              $('#note').animate({marginTop : '0'}, {queue:false, duration:1500, easing: 'easeOutBounce'});
			  $.ajax({	   
		                       url: "blocknot_del.php",                              
				               success: function(html){	}     
				    });                 
			  
			   return false;
      
              });
	  
			  

       	$('#add_blocknot').submit(function(){ 

           var str = $(this).serialize();
		   
		   $.ajax({	   
		             type: "POST",
                     url: "add_blocknot.php",
                     data: str,					 
					 success: function(data, textStatus, xhr){							 
					 $('#note').animate({marginTop : '-35'}, {queue:false, duration:1000, easing: 'easeOutBounce'});
					 
					 //setTimeout(function() {$('#note').hide();}, 2000);
					 }
		    });  
			
		

                              $.ajax({	   
		                       url: "blocknot_bt.php",
                              
				               success: function(html){
					           $("#blocknot_bottom_div").html(html);
					                          		}     
				             
                              });                 
		
        return false;
    });
	for(a = 1; a < 11; a++) {

	$('#add_blocknot'+a).submit(function(){ 

           var str = $(this).serialize();
		   
		   $.ajax({	   
		             type: "POST",
                     url: "add_blocknot.php",
                     data: str,					 
					 success: function(data, textStatus, xhr){							 
					 $('#note').animate({marginTop : '-35'}, {queue:false, duration:1000, easing: 'easeOutBounce'});
					 
					 //setTimeout(function() {$('#note').hide();}, 2000);
					 }
		    });  
			
		

                              $.ajax({	   
		                       url: "blocknot_bt.php",
                              
				               success: function(html){
					           $("#blocknot_bottom_div").html(html);
					                          		}     
				             
                              });                 
		
        return false;
    });
	}
	
});
//Кодировка	функция после ajax			
//function decode_string($str)
//{
//  $s = mb_detect_encoding($str);//Определяем кодировку
//  return iconv($s, 'CP1251//TRANSLIT', $str);//Декодируем
//}				
