﻿//变量定义
var Arr_defaultTxt = 
[
'请输入您要搜索的企业名称、地址、电话', 
'请输入地点名称', 
'请输入关键字',
'请输入gpsid',
'请输入道路名称',
'起点名，如地名、路名、建筑物等',
'终点名，如地名、路名、建筑物等',
'站点名称，如岗顶、东圃',
'线路名称，如5、5路',
'如地名、路名、建筑物等',
'请输入起点',
'请输入终点'
];
var g_CurrentCityId =440100;
var g_CurrentCityName= "广州市";

function GetE(ID){
    return document.getElementById(ID);
}

//去掉字符窜的空格
function trim(str)
{
	return str.replace(/[ ]/g,"").replace(/[　]/g,"");  
}

// 获取输入框内容
function getInputText(inputTextId){
   var text = "";
//    text = document.getElementById( inputTextId ).value;
    text = trim( document.getElementById( inputTextId ).value );
//    
//    //非法字符 (32个) 过滤"'\~`!@#$%^&*()-_+=|\\{}[]:;<>,.?/
//    
    var re = /\"/g;
    text = text.replace(re,"");     //  "
                                    //  '
    text = text.replace(/'/g,"");
    text = text.replace(/~/g,"");   //  ~
    text = text.replace(/`/g,"");   //  `
    text = text.replace(/!/g,"");   //  !
    text = text.replace(/@/g,"");   //  @
    text = text.replace(/#/g,"");   //  #
    text = text.replace(/\$/g,"");  // $
    text = text.replace(/%/g,"");   //  %
    text = text.replace(/\^/g,"");  // ^
    text = text.replace(/&/g,"");   //  &
    text = text.replace(/\*/g,"");  // *
    text = text.replace(/\(/g,"");  // (
    text = text.replace(/\)/g,"");  // )
    text = text.replace(/-/g,"");   //  -
    text = text.replace(/_/g,"");   //  _
    text = text.replace(/\+/g,"");  // +
    text = text.replace(/=/g,"");   //  =
    text = text.replace(/\|/g,"");  // |
    text = text.replace(/\\/g,"");  // \
    text = text.replace(/{/g,"");   //  {
    text = text.replace(/}/g,"");   //  }
    text = text.replace(/\[/g,"");  // [
    text = text.replace(/]/g,"");   //  ]
    text = text.replace(/:/g,"");   //  :
    text = text.replace(/;/g,"");   //  ;
    text = text.replace(/</g,"");   //  <
    text = text.replace(/>/g,"");   //  >
    text = text.replace(/,/g,"");   //  ,
    text = text.replace(/\./g,"");  //  .
    text = text.replace(/\?/g,"");  // ?
    text = text.replace(/(\/)/g,"");// /
    
    return text;
}


function btnRoundSearch_click()
{//周边搜索
 var round = getInputText("txtHotelSearchAround");
 var content = "酒店";
 var kilo = document.getElementById("selectHotelSearchRound").value;

 var districtCode = g_CurrentCityId;
 var lat = 0;
 var lng = 0;

 if ((round == "" || round == Arr_defaultTxtContent[1]) &&
 (content == "" || content == Arr_defaultTxtContent[2])) {
 strUrl="http://s.csddt.com/Default.aspx?sSearchType="+AreaSearchType+"&districtCode="+g_CurrentCityId+"&districtName="+escape(g_CurrentName);
 window.open(strUrl);
 }

 if (round != "" && round != Arr_defaultTxtContent[1] &&
 content != "" && content != Arr_defaultTxtContent[2]) {
 var strUrl = "http://s.csddt.com/SearchSynthetic.aspx?";
 strUrl += "content=" + escape(content) + "&place=";
 strUrl += escape(round) + "&kilo=" + kilo + "&searchType=2";
 //searchType(区域：0，全国：1，周边：2，文章：3)
 strUrl += "&latlngCode=" + codeLatLng(lat, lng);
 strUrl += "&districtCode=" + g_CurrentCityId +
 "&districtName=" +
 escape(g_CurrentName);
 window.open(strUrl);
 }
 else {
 if (round == "" || round == Arr_defaultTxtContent[1]) {
 document.getElementById("txtHotelSearchAround").focus();
 }

 if (content == "" || content == Arr_defaultTxtContent[2]) {
 document.getElementById("selectHotelSearchRound").focus();
 }
 }
 return false;
} 

