this.resizeFlag = false;
window.addEventListener("resize", function() {
	if(this.resizeFlag == false){
		this.resizeFlag = true;
	}else{
		this.resizeFlag = false;
	}
});


$(function() {
var window_height = $(window).height();
var body_height = $('body').height() - window_height;
    $(window).scroll(function() {
        var scroll_top = $(this).scrollTop();
        var fixed_end = body_height - scroll_top;
		var userAgent = navigator.userAgent.toLowerCase();
		if (userAgent.indexOf("android") != -1){
			if (scroll_top > 364 && fixed_end > 100) {
	        	$('#btn_entry_fixed').addClass('fixed_bottom');
			}else{
				$('#btn_entry_fixed').removeClass('fixed_bottom');
			}
		}
		if ((userAgent.indexOf("iphone") != -1)||(userAgent.indexOf("ipad") != -1)){
			if(this.resizeFlag == false &&fixed_end < 48){
            	$('#btn_entry_fixed').removeClass('fixed_bottom');
        	}else if (this.resizeFlag == true && fixed_end < 161){
				$('#btn_entry_fixed').removeClass('fixed_bottom');
			}else if(scroll_top < 365){
				$('#btn_entry_fixed').removeClass('fixed_bottom');
			} else if (scroll_top > 364 && fixed_end > 48) {
	        	$('#btn_entry_fixed').addClass('fixed_bottom');
			}
		}
		
    });
});