function get_area_detail() {
	$.ajax({
	    url : "cm-services/cm-area.php",
	    type : "GET",
	    data: "pref_cd=" + $("#pref").val(),
	    success: function(result) {
	    	$("#city").empty();
	    	$("#city").append("<option value=''>▼市区町村を選んでください</option>");
	    	$("#city").append(result);
	    }
	});
	$("#m").val("search");
	$("#by").val("pref");
}

function get_area_detail_type_name() {
	$.ajax({
	    url : "../cm-services/cm-area.php",
	    type : "GET",
	    data: "type=name&pref_cd=" + $("#pref").val(),
	    success: function(result) {
	    	$("#city").empty();
	    	$("#city").append("<option value=''>▼市区町村を選んでください</option>");
	    	$("#city").append(result);
	    }
	});
}

function select_city() {
	$("#m").val("search");
	$("#by").val("city");
}

function vote(qid, aid, eid) {
	$.ajax({
		url : "../cm-services/cm-vote.php",
		type : "GET",
		data: "qid=" + qid + "&aid=" + aid,
		success: function(result) {
			$(eid).empty();
			$(eid).append(result);
		}
	});
}

function favorite(qid, eid) {
	$.ajax({
		url : "../cm-services/cm-favorite.php",
		type : "GET",
		data : "qid=" + qid,
		success: function(result) {
			$(eid).empty();
			$(eid).append(result);
		}
	});
}

function get_subcategory(mainElement, subElement, selCd) {
	$.ajax({
	    url : "../cm-services/cm-category.php",
	    type : "GET",
	    data: "cat_cd=" + $("#"+mainElement).val() + "&selected=" + selCd,
	    success: function(result) {
	    	$("#"+subElement).empty();
	    	$("#"+subElement).append("<option value=''>▼選んでください</option>");
	    	$("#"+subElement).append(result);
	    }
	});
}

function changePayment() {
	if ($("#payment-card").attr('checked')) {
		$(".card").show();
		$(".bank").hyde();
	}
	if ($("#payment-bank").attr('checked')) {
		$(".card").hyde();
		$(".bank").show();
	}
}

function changeFilter() {
	if ($("#cm-filter").attr("checked")) {
		$(".use_filter").removeAttr("disabled")
	} else {
		$(".use_filter").attr("disabled", "disabled");
	}
}

