
	$(document).ready(function(){
		$(".queryTarget").bind("click",function(){
			radioClick(this);
		});
		
		$("#leaveCity").focus(function(){
			$("#leaveCity_show").show();
			$("#arriveArea_show").hide();
		});
		
		$("#leaveCityImage").click(function(){
			$("#leaveCity_show").hide();
		});
		$(".leaveCityClass").bind("click",function(){
			var result = $(this).html();
			$("#leaveCity_show").hide();
			$("#leaveCity").val(result);
		});

		$("#arriveArea").focus(function(){
			$("#arriveArea_show").show();
			$("#leaveCity_show").hide();
		});
		$("#arriveAreaImage").click(function(){
			$("#arriveArea_show").hide();
		});
		$(".arriveAreaClass").bind("click",function(){

			var result = $(this).html();
			$("#arriveArea_show").hide();
			$(".arriveArea_1").val(result);
			$("#arriveArea").val(result);
		});
		
		
		
		/*首页弹出层*/
		$("#leaveCity_1").focus(function(){
			$("#leaveCity_show_1").show();
			$("#arriveArea_show_1").hide();
		});
		
		
		
		$("#leaveCityImage_1").click(function(){
			$("#leaveCity_show_1").hide();
		});
		$(".leaveCityClass").bind("click",function(){
			var result = $(this).html();
			$("#leaveCity_show_1").hide();
			$("#leaveCity_1").val(result);
		});

		$(".arriveArea_1").focus(function(event){
			$("#arriveArea_show_1").show();
			$("#leaveCity_show_1").hide();
			
			$(this).click(function(){
				event.stopPropagation();   //停止事件冒泡
				return false;
			});
		});
		$("#arriveAreaImage_1").click(function(){
			$("#arriveArea_show_1").hide();
		});
		$(".arriveAreaClass").bind("click",function(){

			var result = $(this).html();
			$("#arriveArea_show_1").hide();
			$("#arriveArea_1").val(result);
			
		});
		
		/*将搜索的弹出层绑定事件*/
		document.onclick = function(){
			$("#leaveCity_show_1").hide();
			$("#arriveArea_show_1").hide();
			
			$("#leaveCity_show").hide();
			$("#arriveArea_show").hide();
		}
		$("#arriveArea_1").bind("click",function(event){
			event.stopPropagation();   //停止事件冒泡
		});
		$("#leaveCity_1").bind("click",function(event){
			event.stopPropagation();   //停止事件冒泡
		});
		
	});

	function radioClick(obj){
//		$(".search_form").each(function(i){
		$(".search_table").each(function(i){
			$(this).hide();
		});
		var value = $(obj).val();
		
		
		if(value == 'visa'){
//			$("#visa_form").show();
			$("#visa_table").show();
		}else{
			/**
			 * value = 'all	group free steamboat'  
			 * remove所有的class='arriveArea_1'节点
			 * <input name="arriveArea" id="auto_group" type="text" class="put_120 arriveArea_1 input_auto_hidden" value="团队游"/>
			 * */
			$(".arriveArea_1").remove();
			var search_area = "#arriveArea_show_1";

			var result = '<input name="arriveArea" id="auto_'+value+'" type="text" class="put_120 arriveArea_1" value=""/>';
			$("#pop_arrive_1").before(result);
			
//			$("#input_add").append(result);
			switch(value){
			case 'all': 
				/**所有的自动提示代码*/
				var auto_all = new eyeshot_autocomplete();
				var all_input = "#auto_all";
				var all_url = "/autoComplete";
				auto_all.bind(all_input,search_area,all_url);
				break;
			case 'group': 
				/**团队游的自动提示代码*/
				var auto_group = new eyeshot_autocomplete();
				var group_input = "#auto_group";
				var group_url = "/autoComplete?tagId=114";
				auto_group.bind(group_input,search_area,group_url);
				break;
			case 'free' : 
				/**自由行的自动提示代码*/
				var auto_free = new eyeshot_autocomplete();
				var free_input = "#auto_free";
				var free_url = "/autoComplete?tagId=115";
				auto_free.bind(free_input,search_area,free_url);
				break
			case 'steamboat': 
				/**邮轮的自动提示代码*/
				var auto_steamboat = new eyeshot_autocomplete();
				var steam_input = "#auto_steamboat";
				var steam_url = "/autoComplete?tagId=116";
				auto_steamboat.bind(steam_input,search_area,steam_url);
				break;
			default: 
				/**所有的自动提示代码*/
				var auto_all = new eyeshot_autocomplete();
				var all_input = "#auto_all";
				var all_url = "/autoComplete";
				auto_all.bind(all_input,search_area,all_url);
				break;
		}
			$("#hide_submit").val(value);
//			$("#group_form").show();
			$("#group_table").show();
		}		
		
		$(".arriveArea_1").focus(function(event){
			$("#arriveArea_show_1").show();
			$("#leaveCity_show_1").hide();
			
			$(this).click(function(){
				event.stopPropagation();   //停止事件冒泡
				return false;
			});
		});
		
	}

/*
 	$(document).ready(function(){

		clearHidden();
		backgroundColor();
		$(".none").mouseover(function(){
			$(this).addClass("spa_mouseover");
			$(this).children().addClass("li_mouseover");
		});
		$(".none").mouseout(function(){
			$(this).removeClass("spa_mouseover");
			$(this).children().removeClass("li_mouseover");
		});

		
		$(".dayNumber").click(function(){
			var text = $(this).text();
			var id = $(this).attr("id");
			$("#dayNumber_hidden").val(text+id);
			subject_submit();
		});
		$(".priceRange").click(function(){
			var text = $(this).text();
			var id = $(this).attr("id");
			$("#priceRange_hidden").val(text+id);
			subject_submit();
		});
		$(".people").click(function(){
			var text = $(this).text();
			var id = $(this).attr("id");
			$("#people_hidden").val(text+id);
			subject_submit();
		});
		$(".consumeGrade").click(function(){
			var text = $(this).text();
			var id = $(this).attr("id");
			$("#consumeGrade_hidden").val(text+id);
			subject_submit();
		});
		$(".general").click(function(){
			var text = $(this).text();
			var id = $(this).attr("id");
			$("#general_hidden").val(text+id);
			subject_submit();
		});
		$(".natural").click(function(){
			var text = $(this).text();
			var id = $(this).attr("id");
			$("#natural_hidden").val(text+id);
			subject_submit();
		});
		$(".humanism").click(function(){
			var text = $(this).text();
			var id = $(this).attr("id");
			$("#humanism_hidden").val(text+id);
			subject_submit();
		});
		$(".sports").click(function(){
			var text = $(this).text();
			var id = $(this).attr("id");
			$("#sports_hidden").val(text+id);
			subject_submit();
		});
		$(".festival").click(function(){
			var text = $(this).text();
			var id = $(this).attr("id");
			$("#festival_hidden").val(text+id);
			subject_submit();
		});
		

		
	});


	function clearHidden(){
		$("#dayNumber_hidden").val("");
		$("#priceRange_hidden").val("");
		$("#people_hidden").val("");
		$("#consumeGrade_hidden").val("");
		$("#general_hidden").val("");
		$("#natural_hidden").val("");
		$("#humanism_hidden").val("");
		$("#sports_hidden").val("");
		$("#festival_hidden").val("");
	}
	

	function subject_submit(){
		$("#query_hidden").val("query");
		$("#group_form").submit();
	}

	function backgroundColor(){
		

		$(".tagSet").each(function(i){


			var str = $(this).val();			
			if(str != ''){
				var result = str.split("TAG");
				var text = result[0];
				var id = "#TAG" + result[1];
				
				$(id).parent().parent().children().each(function(i){
					$(this).removeClass("spa_mouseover").addClass("none");
					$(this).children().removeClass("li_mouseover").addClass("blue_color_css");
				});
				$(id).parent().addClass("spa_mouseover").removeClass("none");
				$(id).addClass("li_mouseover");		
			}
		
			
		});
		
	}
	


 */
	
	
	function group_form_submit(){
//		var type = $('input[name=queryTarget][checked]').val(); 
//		alert(type);
//		$("#hide_submit").val(type);
		$("#group_form").submit();
	}
	
	
	
	
	
	
