
String.prototype.trim = function()
{
	//用正则表达式将前后空格去掉
return this.replace(/(^\s*)|(\s*$)/g, "");
}


function searchChange(obj)
{
var objvalue=obj.options[obj.selectedIndex].value.trim();
if(objvalue=="1")
{
document.all("keyword").value="请输入线路目的地或关键字";
}else  if(objvalue=="2")
{
document.all("keyword").value="请输入旅行社名称或关键字";
}else  if(objvalue=="3")
{
document.all("keyword").value="请输入文章关键字";
}else   if(objvalue=="4")
{
document.all("keyword").value="请输入景点名称";
}else  if(objvalue=="5")
{ 
document.all("keyword").value="请输入目的地名称：国家/省/市/景点";
}else  if(objvalue=="6")
{
document.all("keyword").value="请输入“国家/省/市/景点”名称";
}else if(objvalue=="7")
{
document.all("keyword").value="请输入相关攻略的文章名称";
}
}







function openNew(url){
if(url!="")
window.open(url);
}
	
	
		
function typeimagesearch()
{
var url="";
var thevalue= document.getElementById('stype').options[document.getElementById('stype').selectedIndex].value;
var theKeyword=document.all("keyword").value;
if(theKeyword=="请输入线路目的地或关键字"||theKeyword=="请输入旅行社名称或关键字"||theKeyword=="请输入文章关键字"||theKeyword=="请输入景点名称"||theKeyword=="请输入目的地名称：国家/省/市/景点"||theKeyword=="请输入“国家/省/市/景点”名称"||theKeyword=="请输入相关攻略的文章名称")
{
theKeyword ="";
}
if( thevalue=="1")
{
url="../line/searchLine.aspx?toDest="+escape(theKeyword);           
}else if( thevalue=="2")
{
url="../travel/index.aspx?MemName="+escape(theKeyword);   
}else if( thevalue=="3")
{
url="../search/news.aspx?content="+escape(theKeyword);    
}else if( thevalue=="4")
{
url="../search/sight.aspx?content="+escape(theKeyword);     
}else if(thevalue=="5")
{
url="../search/destination.aspx?content="+escape(theKeyword);     
}else if(thevalue=="6")
{
url="../search/photo.aspx?content="+escape(theKeyword);     
}else if(thevalue=="7")
{
url="../search/Raiders.aspx?content="+escape(theKeyword);     
}        
openNew(url);
}
		
		
function dosearch(e)
{  		
e=e||window.event;
if(e.keyCode==13)
{
e.cancelBubble=true;
e.returnValue=false;
typeimagesearch();            
}
		
}

function getnow()
{		
var enabled = 0; today = new Date();
var day; var date;
if(today.getDay()==0) day = "星期日"
if(today.getDay()==1) day = "星期一"
if(today.getDay()==2) day = "星期二"
if(today.getDay()==3) day = "星期三"
if(today.getDay()==4) day = "星期四"
if(today.getDay()==5) day = "星期五"
if(today.getDay()==6) day = "星期六"
document.fgColor = "000000";
date = ""+(today.getYear()) + "年" + (today.getMonth() + 1 ) + "月" + today.getDate() + "日&nbsp;" + day +"";
return "<CENTER>" + date + "</CENTER>";
}
		
		
		
function loadSearch()
{
var theurl=window.location.href;
theurl=theurl.toLowerCase();
if(theurl.indexOf("line/")!=-1)
{
 document.all("stype").options[0].selected=true;
 document.all("keyword").value="请输入线路目的地或关键字";
 if(document.getElementById("topnytoptitle"))
 document.getElementById("topnytoptitle").innerText="参团";
 }else  if(theurl.indexOf("specializedlines/")!=-1)
 {
 document.all("stype").options[0].selected=true;
 document.all("keyword").value="请输入旅行社名称或关键字";
 if(document.getElementById("topnytoptitle"))
 document.getElementById("topnytoptitle").innerText="专线";
 }else  if(theurl.indexOf("news/")!=-1)
 {
 document.all("stype").options[2].selected=true;
 document.all("keyword").value="请输入文章关键字"; 
 if(document.getElementById("topnytoptitle"))
 document.getElementById("topnytoptitle").innerText="资讯";
 }else  if(theurl.indexOf("attractions/")!=-1)
 {
 document.all("stype").options[3].selected=true;
 document.all("keyword").value="请输入景点名称";
 if(document.getElementById("topnytoptitle"))
 document.getElementById("topnytoptitle").innerText="景点";
 }else  if(theurl.indexOf("destination/")!=-1)
 {
 document.all("stype").options[4].selected=true;
 document.all("keyword").value="请输入目的地名称：国家/省/市/景点"; 
 if(document.getElementById("topnytoptitle")) 
  document.getElementById("topnytoptitle").innerText="目的地";
 }else  if(theurl.indexOf("photo/")!=-1)
 {
 document.all("stype").options[5].selected=true;
 document.all("keyword").value="请输入“国家/省/市/景点”名称";
 if(document.getElementById("topnytoptitle"))
  document.getElementById("topnytoptitle").innerText="图库";
 }
 else  if(theurl.indexOf("ask/")!=-1)
 {if(document.getElementById("topnytoptitle"))
  document.getElementById("topnytoptitle").innerText="问答";
 }
 else  if(theurl.indexOf("hotel/")!=-1)
 {if(document.getElementById("topnytoptitle"))
  document.getElementById("topnytoptitle").innerText="酒店";
 }else  if(theurl.indexOf("travel/")!=-1)
 {
 document.all("stype").options[1].selected=true;
 document.all("keyword").value="请输入旅行社名称或关键字";
 if(document.getElementById("topnytoptitle"))
  document.getElementById("topnytoptitle").innerText="旅行社";
 }
}


function Travel_Sight()
{
var province=document.getElementById("Area_ddlContient");
var pindex = province.selectedIndex;
var pValue = province.options[pindex].value;
var pText  = province.options[pindex].text;
var city=document.getElementById("Area_ddlCountry");
var cindex = city.selectedIndex;
var cValue = city.options[cindex].value;
var cText  = city.options[cindex].text;
var Sight=document.getElementById("Area_ddlProvince");
var sindex = Sight.selectedIndex;
var sValue = Sight.options[sindex].value;
var sText  = Sight.options[sindex].text.split(".");
if(sValue=="00")
alert("目前尚无景点,不能直达!");
else
window.location="Attractionsinfo.aspx?ToCity="+escape(cText)+"&desid="+sValue+"&ToSight="+escape(sText[1])+"";
}
