window.onload = function() {

	addHandler($$('#room_count'), 'click', function() {
		$('.model_box_room_count').removeClass('fadeInUp animated');
		$('.model_box_room_count').removeClass('fadeInDown animated');

		$(".model_room_count").show();
		$('.model_box_room_count').show();
		$("#body_mod").addClass("mod_fil");
		$('.model_box_room_count').addClass('fadeInUp animated');
	})
	
	
	$(".room_count_num").on('click',function(){
		var count = $(this).text();
		$('.room_title').html('选择房间数 — '+count);
		$('.model_box_room_count').addClass('fadeInDown animated');
		setTimeout(function() {
			$('.model_room_count').hide();
			$('#body_mod').removeClass('mod_fil');
		}, 400);
	})
	$(".model_room_count").on("click", function(e) {
		$(".model_box_room_count").animate({
			height: "hide"
		}, 400, function() {
			$(".model_room_count").hide();
			$("#body_mod").removeClass("mod_fil");
		});
	});

	$(".model_box_room_count").on("click", function(e) {
		e.stopPropagation();
	});

}

//辅助函数
function addHandler(element, type, handler) {
	try{
		element.addEventListener(type, handler, false);
	}catch(e){
		try{
			element.attachEvent("on" + type, handler);
		}catch(e){
			element["on" + type] = handler;
		}
	}
}

function $$(str) {
	return document.querySelector(str);
}