(function(d, s, id) {
	var js, fjs = d.getElementsByTagName(s)[0];
	if (d.getElementById(id)) return;
	js = d.createElement(s); js.id = id;
	js.src = "//connect.facebook.net/ru_RU/sdk.js#xfbml=1&version=v2.9&appId=452012208471347";
	fjs.parentNode.insertBefore(js, fjs);
}
(document, 'script', 'facebook-jssdk'));
window.fbAsyncInit = function() {
    FB.init({
      appId      : '452012208471347',
      xfbml      : true,
      version    : 'v2.9'
    });
    FB.AppEvents.logPageView();
  };
(function(d, s, id){
	var js, fjs = d.getElementsByTagName(s)[0];
	if (d.getElementById(id)) {return;}
	js = d.createElement(s); js.id = id;
	js.src = "//connect.facebook.net/ru_RU/sdk.js";
	fjs.parentNode.insertBefore(js, fjs);
}
(document, 'script', 'facebook-jssdk'));

function SendStatement(x) {
	var lang = $(x).attr('data-lange');
	if (lang == "en") {
		$("#sendmessage").css("display", "block");
		$("#sendmessage").text("Sending message");	
	}
	else if(lang == "ru") {
		$("#sendmessage").css("display", "block");
		$("#sendmessage").text("Идет отправка");
	}
	else {
		$("#sendmessage").css("display", "block");
		$("#sendmessage").text("Жуктоолуудо");
	}
	var dates = new FormData(document.getElementById("app"));
	$.ajax({
		url: 'https://kssda.kg/send_application',
		type: 'POST',
		data: dates,
		mimeTypes: 'multipart/form-data',
		contentType: false,
		cache: false,
		processData: false,
		success: function(data) {
			$("#sendmessage").css("display", "block");
			$("#sendmessage").html(data);
		}
		
	});
}
function send_message(h) {
	var lang = $(h).attr('data-lang');
	if (lang == "en") {
		$("#sendmessage").css("display", "block");
		$("#sendmessage").text("Sending message");	
	}
	else if(lang == "ru") {
		$("#sendmessage").css("display", "block");
		$("#sendmessage").text("Идет отправка");
	}
	else {
		$("#sendmessage").css("display", "block");
		$("#sendmessage").text("Жуктоолуудо");
	}
	var action = $(h).attr('action');
	var wW = $(h).serialize();
	$.ajax({
		url: "https://kssda.kg/sendmessage",
		type: 'POST',
		data: wW,
		success: function(data) {
			$("#sendmessage").css("display", "block");
			$("#sendmessage").html(data);
		}
	});
}
$(document).on('click', '.cbp-l-loadMore-button-link', function(data) {
	var count = $(".news").length;
	var lang = $(this).attr("data-lang");
	$.ajax({
		url: 'https://kssda.kg/get_more_news',
		method: 'GET',
		data: {"num" : count, "lang" : lang},
		success: function(data) {
			$(".news_content").append(data);
		}
	})
});

$(".toggle-btn").click(function(e) {
	e.preventDefault();
  $(this).prev().toggleClass("text-open")
});
$(".toggle-btn").click(function(e) {
	e.preventDefault();
	$(this).prev().toggleClass("desc-open");
});
$(".open-msg").click(function(e) {
	e.preventDefault();
	$(this).prev().toggleClass("feed-open");
})
