  function ClearFields()
  {
  	$("#response").val('');
  	$("#name").val('');
  	$("#button").attr('disabled','true');
  	return false;
  }
  
  function ClearFields_q()
  {
  	$("#quest").val('');
  	$("#name_q").val('');
  	$("#button_q").attr('disabled','true');
  	return false;
  }  
  

  function GetRespCount(id)
  {
	$.ajax({   
			type: "POST",
			url: "/modules/resp_ajax/ajax_work.php", 
			data:"mode=resp_count&id="+id, 
			cache: false,   
			success: function(html){   
				$("#send_ok").hide();
				$("#r_count").html(html);
			}   
		});   
  }
  
  function GetQuestCount(id)
  {
	$.ajax({   
			type: "POST",
			url: "/modules/resp_ajax/ajax_work.php", 
			data:"mode=quest_count&id="+id, 
			cache: false,   
			success: function(html){   
				$("#send_ok").hide();
				$("#q_count").html(html);
			}   
		});   
  }  

  function ViewResp(id)
  {
	if ($("#view_resp").css('display') == 'block')
	{
		$("#view_resp").hide('show'); 
	}
	else
	{
		$("#view_resp").show('show');	
		$.ajax({   
				type: "POST",
				url: "/modules/resp_ajax/ajax_work.php", 
				data:"mode=view_resp&id="+id, 
				cache: false,
				success: function(html){   
					$("#send_ok").hide();
					$("#view_resp").html(html);
				}   
			});
	}
	return false;	
  }
  
  function ViewQuest(id)
  {
	if ($("#view_quest").css('display') == 'block')
	{
		$("#view_quest").hide('show'); 
	}
	else
	{
		$("#view_quest").show('show');	
		$.ajax({   
				type: "POST",
				url: "/modules/resp_ajax/ajax_work.php", 
				data:"mode=view_quest&id="+id, 
				cache: false,
				success: function(html){   
					$("#send_ok").hide();
					$("#view_quest").html(html);
				}   
			});
	}
	return false;	
  }  


  function SendForm()
  {
	$.ajax({type: "POST",
		url: parent.location.href,
		data:$("#myform").serialize(), 
		success: function (html) {
			ClearFields();
			$("#qform").hide('show');
			$("#send_ok").show('show');
			$("#send_ok").html("Ваше отзыв добавлен. Спасибо.");
		}
	});
	return false;	
  }
  
  function SendQuestForm(id)
  {
	$.ajax({type: "POST",
		url: "/modules/resp_ajax/ajax_work.php", 
		data:"mode=insert_q&id="+id+"&"+$("#myform_q").serialize(), 
		success: function (html) {
			ClearFields_q();
			$("#qform_quest").hide('show');
			$("#send_ok").show('show');
			$("#send_ok").html("Ваше ответ отправлен. Спасибо.");
		}
	});
	return false;	
  }  
