	function keyBlur(){
		if($('#to').val()==''){
			$('#to').val('地区名、景区名...');
		}
	}
	function keyFocus(){
		if($('#to').val()=='地区名、景区名...'){
			$('#to').val('');
		}
	}
	function areaFocus(id){
		if($('#'+id).val()=='请输入城市名...'){
			$('#'+id).val('');
		}
	}
	function areaBlur(id){
		if($('#'+id).val()==''){
			$('#'+id).val('请输入城市名...');
		}
	}
	//国内国外热点图切换
	function showMap(num){
		if(num==1){//国内
			document.getElementById('map_china_div').style.display='block';
			document.getElementById('map_globa_div').style.display='none';
		}else if(num==2){//全球
			document.getElementById('map_china_div').style.display='none';
			document.getElementById('map_globa_div').style.display='block';
		}
	}
	//根据国内外热点图加载参团类型(默认显示海南线路)
	//根据地名得到线路
	//国内
	function loadInCountryLineByMap(fromArea, toArea){
		var fArea = $('#'+fromArea).val();
		if(toArea=="本地")
			toArea = $('#startAdd_map_Hidden').val();
		
		$('#arriveInCountryCitySpan').html(toArea);
		
		$.ajax({
			   type: "POST",
			   url: "/www2009/dujia/ajax/getInCountryLineByMap_ajax.jsp",
			   data: "toArea="+toArea+"&fromArea="+$('#startAdd_map_Hidden').val(),
			   beforeSend:function(){
			   		$('#inCountryLineByMapSpan').html("<br/><br/><br/><div align='center'><img src='/www2009/images/wymp/loading.gif' width='27' height='26' align='absmiddle'/>正在载入参团信息... ...</div><br/>");
			   },
			   success: function(msg){
			   		$('#inCountryLineByMapSpan').html(msg);
			   },
			   error:function(){
		   			$('#inCountryLineByMapSpan').html($('#errorMap').html());
		   	   }
		 });
	}
	//国际
	function loadOutCountryLineByMap(fromArea, toArea){
		var fArea = $('#'+fromArea).val();
		
		$('#arriveOutCountryCitySpan').html(toArea);
		$.ajax({
			   type: "POST",
			   url: "/www2009/dujia/ajax/getOutCountryLineByMap_ajax.jsp",
			   data: "toArea="+toArea+"&fromArea="+$('#startAdd_map_Hidden').val(),
			   beforeSend:function(){
			   		$('#outCountryLineByMapSpan').html("<br/><br/><br/><div align='center'><img src='/www2009/images/wymp/loading.gif' width='27' height='26' align='absmiddle'/>正在载入参团信息... ...</div><br/>");
			   },
			   success: function(msg){
			   		$('#outCountryLineByMapSpan').html(msg);
			   },
			   error:function(){
		   			$('#outCountryLineByMapSpan').html($('#errorMap').html());
		   	   }
		 });
	}
	//span div table 样式切换	
	function showObject(name, index, newSpanCss, newHrefCss, oldSpanCss, oldHrefCss, num){
		for(var i=1;i<=num;i++){
			if(document.getElementById(name+'_span_'+i)!=null)		
				document.getElementById(name+'_span_'+i).className=oldSpanCss;
			if(document.getElementById(name+'_href_'+i)!=null)		
				document.getElementById(name+'_href_'+i).className=oldHrefCss;
			if(document.getElementById(name+'_div_'+i)!=null)
				document.getElementById(name+'_div_'+i).style.display='none';
		}
		if(document.getElementById(name+'_span_'+index)!=null)	
			document.getElementById(name+'_span_'+index).className=newSpanCss;
		if(document.getElementById(name+'_href_'+index)!=null)	
			document.getElementById(name+'_href_'+index).className=newHrefCss;
		if(document.getElementById(name+'_div_'+index)!=null)
			document.getElementById(name+'_div_'+index).style.display='block';
	}
	//增加一个 tab
	var tab_in_name = "";
	function addTab(tempLaunch){
		$('#tab_span').val(tempLaunch);
		if(tempLaunch!='请输入城市名...'){
			if(tempLaunch=='全国' || tempLaunch=='中国' || tempLaunch=='北京' || tempLaunch=='上海' || tempLaunch=='广州' || tempLaunch=='深圳' || tempLaunch=='成都' || tempLaunch=='重庆'){
				if(tempLaunch=='全国' || tempLaunch=='中国')
					showObject('inCountry',1,'ct_on','Gray04','ct_off','Gray04',8);
				else if(tempLaunch=='北京')
					showObject('inCountry',2,'ct_on','Gray04','ct_off','Gray04',8);
				else if(tempLaunch=='上海')
					showObject('inCountry',3,'ct_on','Gray04','ct_off','Gray04',8);
				else if(tempLaunch=='广州')
					showObject('inCountry',4,'ct_on','Gray04','ct_off','Gray04',8);
				else if(tempLaunch=='深圳')
					showObject('inCountry',5,'ct_on','Gray04','ct_off','Gray04',8);
				else if(tempLaunch=='成都')
					showObject('inCountry',6,'ct_on','Gray04','ct_off','Gray04',8);
				else if(tempLaunch=='重庆')
					showObject('inCountry',7,'ct_on','Gray04','ct_off','Gray04',8);
				
				loadLine_ajax(tempLaunch, 'readCache');
				return;
			}
			//如果输入的和上次一样
			if(tab_in_name==tempLaunch){
				showObject('inCountry',8,'ct_on','Gray04','ct_off','Gray04',8);
				loadLine_ajax(tempLaunch, 'readCache');
				
				return;
			}
			//增加 tab
			var spanContent = "<span class='ct_on' id='inCountry_span_8'>";
				spanContent += "<a href='javascript:void(0);' onclick=\"showObject('inCountry',8,'ct_on','Gray04','ct_off','Gray04',8);loadLine_ajax($('#tab_in_name_hidden').val(), 'readCache');\" class='Gray04'>"+tempLaunch+"出发</a>"; 
				spanContent += "</span>";
			$('#addTapDiv').html(spanContent);
			showObject('inCountry',8,'ct_on','Gray04','ct_off','Gray04',8);
			loadLine_ajax(tempLaunch, 'noCache');
			tab_in_name = tempLaunch;
			$('#tab_in_name_hidden').val(tempLaunch);
		}else
			alert('请输入城市名...');
	}
	//缓存线路信息   8个出发地 和 自定义出发地
	var zhongguo_in_Cache = null;
	var beijing_in_Cache = null;
	var shanghai_in_Cache = null;
	var guangzhou_in_Cache = null;
	var shenzhen_in_Cache = null;
	var chengdu_in_Cache = null;
	var chongqing_in_Cache = null;
	var my_in_Cache = null;
	//读取 8 个精品线路
	function loadLine_ajax(tempLaunch, isCache){
		//是否缓存
		if(isCache && isCache=='readCache'){
			if(zhongguo_in_Cache && (tempLaunch=='中国' || tempLaunch=='全国')){
				$('#lineDiv').html(zhongguo_in_Cache);
				return;
			}	
			if(beijing_in_Cache && tempLaunch=='北京'){
				$('#lineDiv').html(beijing_in_Cache);	
				return;
			}
			if(shanghai_in_Cache && tempLaunch=='上海'){
				$('#lineDiv').html(shanghai_in_Cache);	
				return;
			}
			if(guangzhou_in_Cache && tempLaunch=='广州'){
				$('#lineDiv').html(guangzhou_in_Cache);	
				return;
			}
			if(shenzhen_in_Cache && tempLaunch=='深圳'){
				$('#lineDiv').html(shenzhen_in_Cache);	
				return;
			}
			if(chengdu_in_Cache && tempLaunch=='成都'){
				$('#lineDiv').html(chengdu_in_Cache);	
				return;
			}
			if(chongqing_in_Cache && tempLaunch=='重庆'){
				$('#lineDiv').html(chongqing_in_Cache);	
				return;
			}
			if(my_in_Cache && tempLaunch==tab_in_name){
				$('#lineDiv').html(my_in_Cache);	
				return;
			}
		}
		$.ajax({
			type:'POST',
			url:'/www2009/dujia/ajax/getLine_ajax.jsp',
			data:'launch='+tempLaunch,
			beforeSend:function(){
				$('#lineDiv').html("<br/><br/><br/><div align='center'><img src='/www2009/images/wymp/loading.gif' width='27' height='26' align='absmiddle'/>正在载入参团信息... ...</div><br/><br/>");
			},
			success:function(msg){
				//设置缓存
				if(tempLaunch=='中国' || tempLaunch=='全国')
					zhongguo_in_Cache = msg;
				if(tempLaunch=='北京')
					beijing_in_Cache = msg;
				if(tempLaunch=='上海')
					shanghai_in_Cache = msg;
				if(tempLaunch=='广州')
					guangzhou_in_Cache = msg;
				if(tempLaunch=='深圳')
					shenzhen_in_Cache = msg;
				if(tempLaunch=='成都')
					chengdu_in_Cache = msg;
				if(tempLaunch=='重庆')
					chongqing_in_Cache = msg;
				if(tempLaunch==tab_in_name)
					my_in_Cache = msg;	
				
				$('#lineDiv').html(msg);
			},
			error:function(){
				$('#lineDiv').html("<br/><br/><br/><div align='center'><strong><font color='red'>对不起,查询出错!</font></strong></div><br/><br/>");
			}
		});
	}
	//点击地图上的出发城市弹出层
	function cityDivSubmit(){
		if($('#area_name_div').val()!='请输入城市名...'){
			$('#cityDiv').hide();
			$('#startAdd_map_Hidden').val($('#area_name_div').val());
			document.getElementById('cityDivAreaNameSpan').innerHTML=$('#area_name_div').val()+' ';
			document.getElementById('launchInCountryCitySpan').innerHTML=$('#area_name_div').val();
			document.getElementById('launchOutCountryCitySpan').innerHTML=$('#area_name_div').val();
			loadInCountryLineByMap('area_name_div',$('#arriveInCountryCitySpan').val());
			$('#arriveInCountryCitySpan').html('海南');
			loadOutCountryLineByMap('area_name_div',$('#arriveOutCountryCitySpan').val());
			$('#arriveOutCountryCitySpan').html('亚洲');
		}else
			alert('请输入城市名...');	
	}
	//显示弹出层
	function showDiv(e, div, leftNum){
		if($('#'+div).css('display')=='block'){
			$('#'+div).css({display:'none'});						
		}else{
			var a=e.srcElement || e.target;
			var off=$(a).offset();
			var h=a.offsetHeight;
			$('#'+div).css({display:'block'});
			$('#'+div).css({top:off.top+h+'px',left:off.left+leftNum+'px',position:'absolute'});
		}
	}
	function showPopSpan(id){
		document.getElementById('inCountryPopSpan').style.display='none';
		document.getElementById('outCountryPopSpan').style.display='none';
		var span = document.getElementById(id);
			span.style.display='block';
	}
	//提交条件开始搜索
	function doCheck(){
		if($('#to').val()=='地区名、景区名...'){
			alert("请先输入目的地关键字");
			return;
		}
		if($('#startAdd_name').val()=='请输入城市名...'){
			$('#startAdd').val('');
			$('#startAdd_name').val('');
		}
		document.f1.submit();
	}
	//******************************   选地名弹出层的方法   ******************************
	function getAreaShengfen(p_id){
		//更新热门区域
		var opt=document.getElementById('shengfen').options;
		opt.length=0;
		opt[opt.length]=new Option('选择省份','');
		for (var i=0;i,i<proary.length;i++){
			if (proary[i].length>2 && proary[i][3]==p_id)
				opt[opt.length]=new Option(proary[i][1],proary[i][0]);
		}
		//通过ajax更新对应省份
		
		$.ajax({
			type:'POST',
			url:'/www2009/dujia/ajax/search_line_ajax.jsp',
			data:'auction=1&p_id='+p_id,
			beforeSend:function(){
				var html=[];
					html.push("		<br/><br/><br/>");
					html.push("			<div align=\"center\"><img src='/www2009/images/wymp/loading.gif' width='27' height='26' align='absmiddle'/>信息载入中...</div>");
					html.push("		<br/><br/><br/>");
				$('#guoneiquyu').html(html.join(""));
			},
			success:function(msg){
				$('#guoneiquyu').html(msg);
			},
			error:function(){
				$('#guoneiquyu').html("<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='red'>对不起,查询出错</font><br/><br/>");
			}
		});
	}
	function getAreaCity(prov){
		var s='';
		var y=false;
		for (var i=0;i<cityary.length;i++){
			if (cityary[i][1]!=prov && y==true){
				break;
			}
			if (cityary[i][1]==prov){
				y=true;
				s+='<span class="tad03"><a href="javascript:setDest(\''+cityary[i][0]+'\',1)" class="Gray ud">'+cityary[i][0]+'</a></span>';
			}
		}
		$('#guoneiquyu').html(s);
	}
	function getAreaCJ(p_id){
		//通过ajax更新对应省份
		$('#haiwaiquyu').load('/www2009/dujia/ajax/search_line_ajax.jsp',{'auction':1,'p_id':p_id});
		var html='<span class="sp01"><strong>该地区对应国家:</strong></span>';
		var y=false;
		for (var i=0;i<cityary.length;i++){
			if (cityary[i][1]!=p_id && y==true)
				break;
			if (cityary[i][1]==p_id){
				y=true;
				html+='<span class=\"tad03\"><a href="javascript:setDest(\''+cityary[i][0]+'\',1)" class="Gray ud">'+cityary[i][0]+'</a></span>';
			}
		}
		$('#haiwaiquyu2').html(html);
	}
	function setDest(area,search_type){
		$('#inarea').val('');
		//setFormValue('start_time','');
		//setFormValue('end_time','');
		$('#pageNo').val('1');
		$('#to').val(area);
		$('#search_type').val(search_type);
		$('#lineKindDiv').hide();
	}
	var last_area='10011';
	//显示优秀网商
	function showlxs(area_id) {
		if (last_area.length>5)last_area=last_area.substring(0,5);
		document.getElementById(last_area).style.display='none';
		document.getElementById(area_id).style.display='block';
		document.getElementById('a_'+last_area).className='blue01';
		document.getElementById('a_'+last_area).parentNode.className=document.getElementById('a_'+last_area).parentNode.className.replace('on','off');
		document.getElementById('a_'+area_id).parentNode.className=document.getElementById('a_'+area_id).parentNode.className.replace('off','on');
		document.getElementById('a_'+area_id).className='White';
		last_area=area_id;
	}