//ページ読み込み時の処理
$(document).ready(function() {
	$(window).bottom({proximity: 0.15});
	$(window).bind("bottom", function() {
		read_more();
	});
});

//jQuery Mobileの設定
$(document).bind("mobileinit", function(){
	$.mobile.defaultTransition = "none";
	$.mobile.defaultPageTransition = 'none';
	$.mobile.defaultDialogTransition = 'none';
	$.mobile.ajaxEnabled = false;
	$.mobile.ajaxLinksEnabled = false;
	$.mobile.ajaxFormsEnabled = false;
});


//もっとよむ
var isComplete = true;
function read_more() {
	if($("#read_next_page > input").val() == undefined) {
		isComplete = false;
	}
	else if(isComplete) {
		isComplete = false;
		$(".mobile_loading").show();
		$.ajax({
			complete:
				function (XMLHttpRequest, textStatus) {
					isComplete = true;
					$("#read_next_page").remove();
					$(".mobile_loading").remove();
					$(".mobile_timeline").append(XMLHttpRequest.responseText);
				},
			data: $("#read_next_page").serialize(),
			dataType:"html",
			success:
				function (data, textStatus) {
					$("null").html(data);
				},
			type:"post",
			url: $(".base_url").html() + "mobile\/mobile_timelines\/getmessage"}
		);
	}
}
