window.document.onclick=function(){
	//alert(window.event.srcElement.id);
	if(window.event.srcElement.id!="open_1"){
		$("#h_city_box").hide();
	}
	if(window.event.srcElement.id!="open_2"){
		$("#CalFrame").hide();
	}
	if(window.event.srcElement.id!="open_3"){
		$("#CalFrame").hide();
	}	
	if(window.event.srcElement.id!="open_4"){
		$("#t_city_box").hide();
	}	
	if(window.event.srcElement.id!="open_5"){
		$("#t_city_box2").hide();
	}	
	if(window.event.srcElement.id!="open_6"){
		$("#CalFrame").hide();
	}	
	if(window.event.srcElement.id!="open_7"){
		$("#c_city_box").hide();
	}	
	if(window.event.srcElement.id!="open_8"){
		$("#w_city_box").hide();
	}	
	if(window.event.srcElement.id!="open_9"){
		$("#t_city_box7").hide();
	}	
	if(window.event.srcElement.id!="open_10"){
		$("#t_city_box8").hide();
	}
	if(window.event.srcElement.id!="open_11"){
		$("#r_city_box").hide();
	}	
	if(window.event.srcElement.id!="open_12"){
		$("#r_city_box2").hide();
	}	
	if(window.event.srcElement.id!="open_13"){
		$("#f_city_box").hide();
	}
	if(window.event.srcElement.id!="open_14"){
		$("#f_city_box2").hide();
	}	
	if(window.event.srcElement.id!="open_15"){
		$("#t_city_box4").hide();
	}	
	if(window.event.srcElement.id!="open_16"){
		$("#t_city_box3").hide();
	}	
	if(window.event.srcElement.id!="open_17"){
		$("#CalFrame").hide();
	}
	if(window.event.srcElement.id!="open_18"){
		$("#CalFrame").hide();
	}	
	if(window.event.srcElement.id!="hotel_city"){
		$("#t_city_ajax_box").hide();
	}	
	if(window.event.srcElement.id!="spring_city"){
		$("#s_city_ajax_box").hide();
	}	
	if(window.event.srcElement.id!="city_to"){
		$("#to_city_ajax_box").hide();
	}
	if(window.event.srcElement.id!="city_from"){
		$("#f_city_ajax_box").hide();
	}	
	if(window.event.srcElement.id!="sort"){
		$("#c_city_ajax_box").hide();
	}		
	if(window.event.srcElement.id!="trip_city"){
		$("#tc_city_ajax_box").hide();
	}		
}

//舌签
function changeTab(currentId,menuPrefix,boxPrefix,count,selectClass,grade,keyword,ajaxFlag,action){
	for(var i=1;i<=count;i++){
		$("#"+boxPrefix+i).hide();
		if(i==currentId){
			$("#"+menuPrefix+i).addClass(selectClass);
			$("#"+boxPrefix+i).show();
		}else{
			$("#"+menuPrefix+i).removeClass(selectClass);
			$("#"+boxPrefix+i).hide();
		}
	}
	
	if(ajaxFlag==true&&action=="special"){
		boxId=boxPrefix;
		$("#"+boxId).html("<div class=\"load_box\"><img src=\"images/load.gif\" /></div>");
		showSpecilAjax(boxId,grade,keyword,action);
	}else if(ajaxFlag==true&&action=="hotel"){
		$("#"+boxPrefix).html("<div class=\"load_box2\"><img src=\"images/load.gif\" /></div>");
		showHotelAjax(boxPrefix,keyword,action);
	}else if(ajaxFlag==true&&action=="ticket"){
		$("#"+boxPrefix).html("<div class=\"load_box2\"><img src=\"images/load.gif\" /></div>");
		showTicketAjax(boxPrefix,keyword,action);
	}
	
}
function showSpecilAjax(boxId,grade,keyword,action){	
	var url="index_ajax.asp?grade="+grade+"&action="+action+"&keyword="+keyword;
	url=encodeURI(url);
	$.get(url,null,function(data){
		
		$("#"+boxId).html(data);
	},"html");
}
function showHotelAjax(boxId,keyword,action){
	var url="index_ajax.asp?action="+action+"&areaName="+keyword;
	url=encodeURI(url);
	$.get(url,null,function(data){	
		$("#"+boxId).html(data);
	},"html");
}
function showTicketAjax(boxId,keyword,action){
	var url="index_ajax.asp?action="+action+"&cityName="+keyword;
	url=encodeURI(url);
	$.get(url,null,function(data){	
		$("#"+boxId).html(data);
	},"html");
}

function selectItem(inputBox,itemValue,boxId){
	$("#"+inputBox).val(itemValue);
	hiddenBox(boxId);
	if (inputBox!='hotel_city'&&inputBox!='spring_city'&&inputBox!='city_from'&&inputBox!='city_to'&&inputBox!='sort'&&inputBox!='trip_city'){
		$("#"+inputBox).select();
	}
}
function hiddenBox(boxId){
	$("#"+boxId).hide();
}
function showBox(boxId){
	$("#"+boxId).show();
}


function selectType(type,prefix,count){
	//$("#"+type).checked=true;
	document.getElementById(type).checked=true;
	if(type=="type_1"){
		$("#"+prefix+1).show();
		$("#"+prefix+2).hide();
		
	}else if(type=="type_2"){
		$("#"+prefix+1).hide();
		$("#"+prefix+2).show();
	}
}
function checkSubmit(){
	if (document.getElementById("type_2").checked==true){
		var date1=$("#StartDate2").val();
		var date2=$("#BackDate").val();
		$("#StartDate").val(date1);
		if(date1==""){
			alert("请选择出发日期");
			$("#StartDate2").focus();
			return false;
			
		}
		if(date2==""){
			alert("请选择返程日期");
			$("#BackDate2").focus();
			return false;
		}
	}else{
		var date1=$("#StartDate").val();
		if(date1==""){
			alert("请选择出发日期");
			$("#StartDate").focus();
			return false;
			
		}
	}
}
function checkHotelSubmit(){
	var areaName=$("#hotel_city").val();
	var CheckInDate=$("#CheckInDate").val();
	var CheckOutDate=$("#CheckOutDate").val();
	var hotelName=$("#hotelName").val();
	if(areaName==""&&hotelName==""){
		alert("请输入地区名或者输入关键字");
		$("#hotel_city").focus();
		return false;
	}
	if (CheckInDate==""){
		alert("请输入入住日期");
		$("#CheckInDate").focus();
		return false;
	}
	if (CheckOutDate==""){
		alert("请输入离店日期");
		$("#CheckOutDate").focus();
		return false;
	}
}
function checkSpringSubmit(){
	var spring_city=$("#spring_city").val();
	var spring_keyword=$("#spring_keyword").val();
	if (spring_city=="" && spring_keyword==""){
		alert("请选择地区或输入关键字！");
		$("#spring_city").focus();
		return false;
	}
}
function checkTripSubmit(){
	var route_start_city=$("#route_start_city").val();
	var route_end_city=$("#route_end_city").val();
	if(route_start_city==""){
		alert("请选择出发城市！");
		$("#route_start_city").focus();
		return false;
	}
	if(route_end_city==""){
		alert("请选择到达城市！");
		$("#route_end_city").focus();
		return false;		
	}
}
function checkFreeSubmit(){
	var free_start_city=$("#free_start_city").val();
	var free_end_city=$("#free_end_city").val();
	if(free_start_city==""){
		alert("请选择出发城市！");
		$("#free_start_city").focus();
		return false;
	}
	if(free_end_city==""){
		alert("请选择到达城市！");
		$("#free_end_city").focus();
		return false;
	}
}
function checkCarSubmit(){
	var car_start_city=$("#car_start_city").val();
	var car_end_city=$("#car_end_city").val();
	if(car_start_city==""){
		alert("请选择出发城市!");
		$("#car_start_city").focus();
		return false;
	}
	if(car_end_city==""){
		alert("请选择到达城市！");
		$("#car_end_city").focus();
		return false;
	}
}

function checkTrainSubmit(){
	var train_start_city=$("#train_start_city").val();
	var train_end_city=$("#train_end_city").val();
	if(train_start_city==""){
		alert("请选择出发城市！");
		$("#train_start_city").focus();
		return false;		
	}
	if(train_end_city==""){
		alert("请选择到达城市");
		$("#train_end_city").focus();
		return false;
	}
}

//selectBox:ajax显示框，cityBox：城市列表。
function searchCityAjax(action,type,inputId,cityBox,page){
	var keyword=$("#"+inputId).val();
	var url="index_ajax.asp?action="+action+"&searchType="+type+"&keyword="+keyword+"&page="+page;
	url=encodeURI(url);
	//alert(url);
	$.get(url,null,function(data){
		//alert(data);
		$("#"+cityBox).show();
		$("#"+cityBox).html(data);
	},"html")
}

function checkCityName(cityBox,action){
	var cityName=$("#"+cityBox).val();
	if(cityName!=""){
		var url="index_ajax.asp?action="+action+"&cityName="+cityName;
		url=encodeURI(url);
		$.get(url,null,function(data){
			if(data!=""){
				//$("#"+cityBox).val(data);
			}
		},"html");
	}
}






























