﻿// JavaScript 文件
var pageNum = 1;//页码
var searchWord = "";//搜索字
var pageSum = 0;//页面总数
var tempX = "";
var tempY = "";
var tempWidth = "";
var tempHeight = "";
var tempScale = "";
var tempScale;

//window.onresize = function() //临时改变显示分辩率时初始化各个框架
//                  {
//                     document.getElementById("head").style.width = screen.width - 25;
//                     document.getElementById("MainPart").style.width = screen.width - 25;
//                     document.getElementById("left").style.width = parseInt(document.getElementById("MainPart").style.width) - 363;
//                     document.getElementById("MapFrame").style.width = parseInt(document.getElementById("left").style.width) -10;
//                     document.getElementById("MapFrame").style.height = screen.height - 275;   
//                     document.getElementById("InfoFrame").style.height = screen.height - 275;
//                     document.getElementById("HiddenRightBtn").style.top = parseInt(screen.height)/2 - 60;
//                     document.getElementById("HiddenRightBtn").style.left = parseInt(document.getElementById("left").style.width) -10; 
//                     if(document.getElementById("right").style.display == "none")
//                     {
//                        document.getElementById("left").style.width = parseInt(document.getElementById("MainPart").style.width) - 1;
//                        document.getElementById("MapFrame").style.width = document.getElementById("left").style.width;
//                        document.getElementById("HiddenRightBtn").style.left = parseInt(document.getElementById("left").style.width) - 20;                        
//                     }    
//                  }


//window.onload=function()
//            {
//          document.getElementById('head').style.width = screen.width - 30;
//          document.getElementById('MainPart').style.width = screen.width - 30;
//          document.getElementById('MainPart').style.height = screen.height -289;
//          document.getElementById('left').style.width = parseInt(document.getElementById('MainPart').style.width) - 389;
//          document.getElementById('MapFrame').style.width = parseInt(document.getElementById('left').style.width) -0;
//          document.getElementById('MapFrame').style.height = screen.height - 289;
//          document.getElementById('InfoFrame').style.height = screen.height - 289;
//          document.getElementById('InfoFrame').style.width= '389px';
//          document.getElementById('RightBtn').style.display = 'none';
//          document.getElementById('HiddenRightBtn').style.height = screen.height - 289;
//          document.getElementById('HiddenRightBtn').style.top = 119;
//          document.getElementById('HiddenRightBtn').style.left = parseInt(document.getElementById('left').style.width) -9;
//          //+ "document.getElementById('RightBtn').style.left = parseInt(document.getElementById('left').style.width) -55;"
//          document.getElementById('Div1').style.left = parseInt(document.getElementById('left').style.width) -9;
//          document.getElementById('MapFrame').src='map.aspx';
//          }


function ChangeBtn(idBtn)  //参数为获取相对的判断ID，此方法用于变换按钮\变换搜索栏
{
   if(idBtn.id == "mapSearch") //显示地图搜索栏
   {
      document.getElementById("mapSearch").src = "images/default/Search_an_01_b.jpg" ;
      document.getElementById("yelSearch").src = "images/default/Search_an_02_a.jpg" ;
     // document.getElementById("typeSearch").src = "images/typeSearchBtn.png";
      
      document.getElementById("mapSearchFrm").style.display = "";
      document.getElementById("yelSearchFrm").style.display = "none";
     // document.getElementById("typeSearchFrm").style.display = "none";
   }
   if(idBtn.id == "yelSearch"||idBtn=="yelSearch") //显示黄页搜索栏
   {
      document.getElementById("mapSearch").src = "images/default/Search_an_01_a.jpg" ;
      document.getElementById("yelSearch").src = "images/default/Search_an_02_b.jpg" ;
      //document.getElementById("typeSearch").src = "images/typeSearchBtn.png";
      
      document.getElementById("mapSearchFrm").style.display = "none";
      document.getElementById("yelSearchFrm").style.display = "";
     //document.getElementById("typeSearchFrm").style.display = "none";
   }
   /*if(idBtn.id == "typeSearch") //显示分类搜索栏
   {
      document.getElementById("mapSearch").src = "images/mapSearchBtn.png" ;
      document.getElementById("busSearch").src = "images/studentSearchBtn.png" ;
      document.getElementById("typeSearch").src = "images/typeSearchBtn0.png";
   
      document.getElementById("mapSearchFrm").style.display = "none";
      document.getElementById("busSearchFrm").style.display = "none";
      document.getElementById("typeSearchFrm").style.display = "";
      DisplaySearchFrmDropType();
   } */   
}

function ClearValue() //清除搜索栏中的关键字
{ 
   if(document.getElementById("mapKeyword").value == "")
   {
      document.getElementById("mapKeyword").value = "输入关键字：...";
   }
   else
   {
      if(document.getElementById("mapKeyword").value == "输入关键字：...")
      {
         document.getElementById("mapKeyword").value = "";
      }
   }
}
function ClearValue3() //清除搜索栏中的关键字
{ 
   if(document.getElementById("h1").value == "")
   {
      document.getElementById("h1").value = "输入关键字：购物/房产/...";
   }
   else
   {
      if(document.getElementById("h1").value == "输入关键字：购物/房产/...")
      {
         document.getElementById("h1").value = "";
      }
   }
}
function ClearValue2() //清除搜索栏中的关键字
{ 
   if(document.getElementById("from").value == "")
   {
      document.getElementById("from").value = "起始点";
   }
   else
   {
      if(document.getElementById("from").value == "起始点")
      {
         document.getElementById("from").value = "";
      }
   }
}
function ClearValue4() //清除搜索栏中的关键字
{ 
   if(document.getElementById("to").value == "")
   {
      document.getElementById("to").value = "目的地";
   }
   else
   {
      if(document.getElementById("to").value == "目的地")
      {
         document.getElementById("to").value = "";
      }
   }
}



function HiddenRightForm() //隐藏右栏
{
   if(document.getElementById("right").style.width == "389px")
   {
      document.getElementById("RightBtn").style.display = "";
      document.getElementById("right").style.width = "45px";
      document.getElementById("InfoFrame").style.width= "45px";
      document.getElementById("left").style.width = parseInt(document.getElementById("MainPart").style.width) - 45;
      document.getElementById("MapFrame").style.width = parseInt(document.getElementById("left").style.width) - 1;
      document.getElementById("HiddenRightBtn").style.left = parseInt(document.getElementById("left").style.width) -9;
      document.getElementById("Div1").style.left = parseInt(document.getElementById("left").style.width) -10;
 document.getElementById("RightBtn").style.left = parseInt(document.getElementById("left").style.width) -40;

      document.frames["MapFrame"].document.getElementById("Eye").style.left = screen.width - 20 - 233;
      document.frames["MapFrame"].document.getElementById("zoom").style.left = screen.width - 20 - 85;
      //document.frames["MapFrame"].document.getElementById("Zoom").style.left = screen.width - 20-987;
      document.frames["MapFrame"].document.getElementById("EyeMaximum").style.left = screen.width - 20 - 97;
      //document.getElementById("HiddenRightBtn").src = "images/hiddenRightBtn0.gif"; 
      document.frames["MapFrame"].document.getElementById("map").style.left = parseInt(document.frames["MapFrame"].document.getElementById("map").style.left) + 0;
      
      var scale = document.frames["MapFrame"].scale;
      var mainWidth = document.frames["MapFrame"].mainWidth;
      var mainHeight = document.frames["MapFrame"].mainHeight;
      
      var tempx = parseInt(document.frames["MapFrame"].document.getElementById("map").style.left);
      var tempy = parseInt(document.frames["MapFrame"].document.getElementById("map").style.top);
      
      var x = 0 - tempx + mainWidth/2;
      var y = 0 - tempy + mainHeight/2;

      document.frames["MapFrame"].RefreshMap(scale,x,y,mainWidth,mainHeight);

   }
   else
   {  
      document.getElementById("right").style.display = "";
      document.getElementById("RightBtn").style.display = "none";
      document.getElementById("right").style.width = "389px";
      document.getElementById("left").style.width = parseInt(document.getElementById("MainPart").style.width) - 389;
      document.getElementById("InfoFrame").style.width= "389px";
      document.getElementById("MapFrame").style.width = parseInt(document.getElementById("left").style.width) -1;
      document.getElementById("HiddenRightBtn").style.left = parseInt(document.getElementById("left").style.width) -9;
      document.getElementById("Div1").style.left = parseInt(document.getElementById("left").style.width) -10;
      document.frames["MapFrame"].document.getElementById("Eye").style.left = screen.width - 20 - 575;
      document.frames["MapFrame"].document.getElementById("zoom").style.left = screen.width - 20 - 428;
      //document.frames["MapFrame"].document.getElementById("Zoom").style.left = screen.width - 20- 987;
      document.frames["MapFrame"].document.getElementById("EyeMaximum").style.left = screen.width - 20 - 440;
      //document.getElementById("HiddenRightBtn").src = "images/hiddenRightBtn.gif";  
      document.frames["MapFrame"].document.getElementById("map").style.left = parseInt(document.frames["MapFrame"].document.getElementById("map").style.left) - 0;
      
      var scale = document.frames["MapFrame"].scale;
      var mainWidth = document.frames["MapFrame"].mainWidth;
      var mainHeight = document.frames["MapFrame"].mainHeight;
      
      var tempx = parseInt(document.frames["MapFrame"].document.getElementById("map").style.left);
      var tempy = parseInt(document.frames["MapFrame"].document.getElementById("map").style.top);
      
      var x = 0 - tempx + mainWidth/2;
      var y = 0 - tempy + mainHeight/2;

      document.frames["MapFrame"].RefreshMap(scale,x,y,mainWidth,mainHeight);
   }
   
}


function changeBusKeyFrm(busValue) //换乘查询、站点查询、线路查询变换
{
  if(busValue.value == "换乘查询" )
  {
    document.getElementById("TransferBusQuery").style.display = "";
    document.getElementById("StationQuery").style.display = "none";
    document.getElementById("LineQuery").style.display = "none";
  }
  if(busValue.value == "站点查询" )
  {
    document.getElementById("TransferBusQuery").style.display = "none";
    document.getElementById("StationQuery").style.display = "";
    document.getElementById("LineQuery").style.display = "none";
  }
  if(busValue.value == "线路查询" )
  {
    document.getElementById("TransferBusQuery").style.display = "none";
    document.getElementById("StationQuery").style.display = "none";
    document.getElementById("LineQuery").style.display = "";
  }
}

function changeRight(value)
{
   if( value == "class")
   {
      classInfoKeyWord = "";
      document.getElementById("InfoFrame").src = "ClassInfo";
   }
   else
   {
      document.getElementById("InfoFrame").src = "Student/StudentRegister.aspx";
   }
}

document.oncontextmenu = function() //点击右键
{
   window.event.returnValue = false;//禁用右键
}


function DisplayResult()
{

   if( document.getElementById("mapKeyword").value != "输入关键字：楼名..." )
   {
       if(top.document.getElementById("CompanyList") != null)
       {
          top.document.getElementById("CompanyList").removeNode(true);
       }
         if(DH_Div.css)
       { DH_Div.css("display","none");}
       if(document.getElementById("resultList") != null)
       {
          document.getElementById("resultList").removeNode(true);
          pageNum = 1;//恢复原始状态
       }
       var oDiv = document.createElement("div");//插入搜索结果
       oDiv.id = "resultList";
       oDiv.style.position = "absolute";
       oDiv.style.width = "235px";
       oDiv.style.height = "220px";
       //oDiv.style.border = "1px solid #003399";
       oDiv.style.filter = "alpha(opacity=80)";
       oDiv.style.top = "152px";
       oDiv.style.left = "68px";
       oDiv.onmouseover = DisplayList;
       oDiv.onmouseout = HiddenList;
       
       document.body.insertAdjacentElement('BeforeEnd',oDiv);
       
       oDiv = document.createElement("div");//插入结果头
       oDiv.id = "resultListTitle";
       oDiv.style.width = "235px";
       oDiv.style.height = "22px";
       oDiv.style.background = "url(images/map/resultListTitle.gif)";

       document.getElementById("resultList").insertAdjacentElement('BeforeEnd',oDiv);
       
       oDiv = document.createElement("div");//插入关闭
       oDiv.id = "close";
       oDiv.style.position = "absolute";
       oDiv.style.left = "178px";
       oDiv.style.top = "0px";
       oDiv.style.width = "57px";
       oDiv.style.height = "22px";
       oDiv.style.cursor = "hand";
       oDiv.onmouseover=Change;
       oDiv.onmouseout=Change1;

       oDiv.onclick = Close; 
       document.getElementById("resultListTitle").insertAdjacentElement('BeforeEnd',oDiv);
       
       oDiv = document.createElement("div");//插入页码
       oDiv.id = "resultListPage";
       oDiv.style.width = "213px";
       oDiv.style.height = "20px";
       oDiv.style.background = "#A2A2A2";
       oDiv.style.padding = "5px 0px 0px 22px";
       
       document.getElementById("resultList").insertAdjacentElement('BeforeEnd',oDiv);

       
       oDiv = document.createElement("div");//插入结果列表
       oDiv.id = "listDisplay";
       document.getElementById("resultList").insertAdjacentElement('BeforeEnd',oDiv);
       
       document.getElementById("resultListPage").insertAdjacentHTML('BeforeEnd',"<a href='javascript:FirstPage();'style='color:#FF6C00;'>首页</a>   <a href='javascript:PreviousPage();'style='color:#FF6C00;'>上页</a>   <a href='javascript:NextPage();'style='color:#FF6C00;'>下页</a>   <a href='javascript:LastPage();'style='color:#FF6C00;'>尾页</a>    <span id='pNum'style='color:#FF6C00;'>1/</span><span id='pSum'style='color:#FF6C00;'>页</span>");
       
       searchWord = document.getElementById("mapKeyword").value;
       

          tempX = null;
          tempY = null;
       
          tempWidth = null;
          tempHeight = null;
          
          tempScale = document.frames["MapFrame"].scale;
          
          searchMethod(searchWord,pageNum,tempX,tempY,tempWidth,tempHeight,tempScale);//搜索方法
          //searchStudentMethod(searchWord,pageNum,tempScale);

   }
   else
   {
      alert("请输入关键字!");
   }
   
}

function DisplayStudentResult()
{
   if( document.getElementById("studentKeyword").value != "输入关键字：同学名或昵称..." )
   {
       if(top.document.getElementById("CompanyList") != null)
       {
          top.document.getElementById("CompanyList").removeNode(true);
       }
       if(document.getElementById("resultList") != null)
       {
          document.getElementById("resultList").removeNode(true);
          pageNum = 1;//恢复原始状态
       }
       var oDiv = document.createElement("div");//插入搜索结果
       oDiv.id = "resultList";
       oDiv.style.position = "absolute";
       oDiv.style.width = "223px";
       oDiv.style.height = "21px";
       oDiv.style.border = "1px solid #003399";
       oDiv.style.filter = "alpha(opacity=80)";
       oDiv.style.top = "112px";
       oDiv.onmouseover = DisplayList;
       oDiv.onmouseout = HiddenList;
       
       document.body.insertAdjacentElement('BeforeEnd',oDiv);
       
       oDiv = document.createElement("div");//插入结果头
       oDiv.id = "resultListTitle";
       oDiv.style.width = "235px";
       oDiv.style.height = "19px";
       oDiv.style.background = "url(images/map/resultListTitle.gif)";

       document.getElementById("resultList").insertAdjacentElement('BeforeEnd',oDiv);
       
       oDiv = document.createElement("div");//插入关闭
       oDiv.id = "close";
       oDiv.style.position = "absolute";
       oDiv.style.left = "200px";
       oDiv.style.top = "3px";
       oDiv.style.width = "15px";
       oDiv.style.height = "13px";
       oDiv.style.cursor = "hand";
       oDiv.onclick = Close; 
       document.getElementById("resultListTitle").insertAdjacentElement('BeforeEnd',oDiv);
       
       oDiv = document.createElement("div");//插入页码
       oDiv.id = "resultListPage";
       oDiv.style.width = "235px";
       oDiv.style.height = "20px";
       oDiv.style.background = "#ffffcc";
       oDiv.style.padding = "5px 0px 0px 22px";
       
       document.getElementById("resultList").insertAdjacentElement('BeforeEnd',oDiv);

       
       oDiv = document.createElement("div");//插入结果列表
       oDiv.id = "listDisplay";
       document.getElementById("resultList").insertAdjacentElement('BeforeEnd',oDiv);
       
       document.getElementById("resultListPage").insertAdjacentHTML('BeforeEnd',"<a href='javascript:FirstPage();'>首页</a>   <a href='javascript:PreviousPage();'>上页</a>   <a href='javascript:NextPage();'>下页</a>   <a href='javascript:LastPage();'>尾页</a>    <span id='pNum'>1</span>/<span id='pSum'></span>页");
       
       searchWord = document.getElementById("studentKeyword").value;
       

       tempX = null;
       tempY = null;
      
       tempWidth = null;
       tempHeight = null;
      
       tempScale = document.frames["MapFrame"].scale;
      
       searchStudentMethod(searchWord,pageNum,tempScale);//学生搜索方法
   }
   else
   {
      alert("同志，请输入关键字!");
   }
   
}

function Close()//关闭搜索列表
{
   if(document.getElementById("resultList") !=null)
   {
      document.getElementById("resultList").removeNode(true);
   }
   
}

function Change()
{
   document.getElementById("close").style.background = "url(images/map/Search02_b.gif)";
}
function Change1()
{
   document.getElementById("close").style.background = "url(images/map/Search02_a.gif)";
}
function HiddenList()//隐藏列表
{
   if(document.getElementById("listDisplay").style.display == "")
   {
      document.getElementById("listDisplay").style.display = "none";
      
      if(document.getElementById("resultListPage") != null)
      {
         document.getElementById("resultListPage").style.display = "none";
      }
   }
}

function DisplayList()//隐藏列表
{
   if(document.getElementById("listDisplay").style.display == "none")
   {
      document.getElementById("listDisplay").style.display = "";
      
      if(document.getElementById("resultListPage") != null)
      {
         document.getElementById("resultListPage").style.display = "";
      }

   }
}


function FirstPage()//首页
{
   pageNum = 1;
   document.getElementById("pNum").innerText = pageNum;
   searchMethod(searchWord,pageNum,tempX,tempY,tempWidth,tempHeight,tempScale);
}
function PreviousPage()//上页
{
   if(pageNum > 1)
   {
      pageNum = pageNum - 1;
   }
   document.getElementById("pNum").innerText = pageNum;
   searchMethod(searchWord,pageNum,tempX,tempY,tempWidth,tempHeight,tempScale);
}
function NextPage()//下页
{
   if(pageNum < pageSum)
   {
      pageNum = pageNum + 1;
   }
   document.getElementById("pNum").innerText = pageNum;
   searchMethod(searchWord,pageNum,tempX,tempY,tempWidth,tempHeight,tempScale);
}
function LastPage()//最后一页
{
   pageNum = pageSum;
   document.getElementById("pNum").innerText = pageNum;
   searchMethod(searchWord,pageNum,tempX,tempY,tempWidth,tempHeight,tempScale);
}


function searchMethod(keyWord,page,x,y,width,height,scale)//返回搜索结果
{
     if(document.getElementById("listDisplay") != null)//删除原始列表
   {
      document.getElementById("listDisplay").removeNode(true);
      
      var oDiv = document.createElement("div");//插入结果列表
      oDiv.id = "listDisplay";
      document.getElementById("resultList").insertAdjacentElement('BeforeEnd',oDiv);
   }

  search.getSearchResult(keyWord,page,x,y,width,height,scale,getSearchResult_callback);
}

//回调函数，返回搜索结果
function getSearchResult_callback(Response)
{
   //SearchInfo对象数组
   var arSearchInfo = Response.value;
   
   if(arSearchInfo[0] != undefined )
   {
     //alert(arSearchInfo[1].NAME);
     tempScale = document.frames["MapFrame"].scale;
     pageSum = arSearchInfo[0].PAGESUM;
     document.getElementById("pSum").innerText = pageSum;
     for(i=0;i<arSearchInfo.length;i++)
     {
       oDiv = document.createElement("div");//插入1个结果
       oDiv.id = "s"+arSearchInfo[i].ID;
       oDiv.style.width = "235px";
       oDiv.style.height = "16px";
       oDiv.style.background = "white";
       oDiv.style.borderBottom = "1px solid #cccccc";
       oDiv.style.padding = "2px 0px 0px 10px";
       oDiv.x = arSearchInfo[i].BSX;
       oDiv.y = arSearchInfo[i].BSY;
       oDiv.si = arSearchInfo[i].MID;
       oDiv.type = arSearchInfo[i].TYPE;
       document.getElementById("listDisplay").insertAdjacentElement('BeforeEnd',oDiv);
       document.getElementById(oDiv.id).insertAdjacentHTML('BeforeEnd',"<img src='images/map/listMark.gif'>  " + arSearchInfo[i].NAME);
       document.getElementById(oDiv.id).onmouseover = function()
                                                      {
                                                         document.getElementById(this.id).style.cursor = "hand";
                                                         document.getElementById(this.id).style.background = "#c5cbda";
                                                         
                                                      }
       document.getElementById(oDiv.id).onclick = function()
                                                      {
                                                         insertResultFrame(this.x,this.y,this.si,this.type);
                                                         
                                                      }
       document.getElementById(oDiv.id).onmouseout = function()
                                                      {
                                                         document.getElementById(this.id).style.background = "white";
                                                      }
     }
   }
   else
   {
       document.getElementById("resultListPage").removeNode(true);//删除页码
       oDiv = document.createElement("div");//插入1个结果
       oDiv.id = "nothing";
       oDiv.style.width = "235px";
       oDiv.style.height = "16px";
       oDiv.style.background = "white";
       oDiv.style.borderBottom = "1px solid #cccccc";
       oDiv.style.padding = "2px 0px 0px 10px";
       document.getElementById("listDisplay").insertAdjacentElement('BeforeEnd',oDiv);
       
       document.getElementById(oDiv.id).insertAdjacentHTML('BeforeEnd',"<img src='images/map/listMark.gif'>  没有结果");
   }
}


function searchStudentMethod(keyWord,page,scale)//返回学生搜索结果
{
     if(document.getElementById("listDisplay") != null)//删除原始列表
   {
      document.getElementById("listDisplay").removeNode(true);
      
      var oDiv = document.createElement("div");//插入结果列表
      oDiv.id = "listDisplay";
      document.getElementById("resultList").insertAdjacentElement('BeforeEnd',oDiv);
   }

  search.getSearchStudentResult(keyWord,page,scale,getSearchStudentResult_callback);
}

function getSearchStudentResult_callback(Response)
{
   //SearchInfo对象数组
   var arSearchInfo = Response.value;
   
   if(arSearchInfo[0] != undefined )
   {
     tempScale = document.frames["MapFrame"].scale;
     pageSum = arSearchInfo[0].PAGESUM;
     document.getElementById("pSum").innerText = pageSum;
     for(i=0;i<arSearchInfo.length;i++)
     {
       oDiv = document.createElement("div");//插入1个结果
       oDiv.id = "s"+arSearchInfo[i].ID;
       oDiv.style.width = "235px";
       oDiv.style.height = "16px";
       oDiv.style.background = "white";
       oDiv.style.borderBottom = "1px solid #cccccc";
       oDiv.style.padding = "2px 0px 0px 10px";
       oDiv.x = arSearchInfo[i].BSX;
       oDiv.y = arSearchInfo[i].BSY;
       oDiv.si = arSearchInfo[i].ID;
       document.getElementById("listDisplay").insertAdjacentElement('BeforeEnd',oDiv);
       document.getElementById(oDiv.id).insertAdjacentHTML('BeforeEnd',"<img src='images/map/listMark.gif'>  " + arSearchInfo[i].NAME);
       document.getElementById(oDiv.id).onmouseover = function()
                                                      {
                                                         document.getElementById(this.id).style.cursor = "hand";
                                                         document.getElementById(this.id).style.background = "#c5cbda";
                                                         
                                                      }
       document.getElementById(oDiv.id).onclick = function()
                                                      {
                                                         insertStudentResultFrame(this.x,this.y,this.si);
                                                         
                                                      }
       document.getElementById(oDiv.id).onmouseout = function()
                                                      {
                                                         document.getElementById(this.id).style.background = "white";
                                                      }
     }
   }
   else
   {
       document.getElementById("resultListPage").removeNode(true);//删除页码
       oDiv = document.createElement("div");//插入1个结果
       oDiv.id = "nothing";
       oDiv.style.width = "235px";
       oDiv.style.height = "16px";
       oDiv.style.background = "white";
       oDiv.style.borderBottom = "1px solid #cccccc";
       oDiv.style.padding = "2px 0px 0px 10px";
       document.getElementById("listDisplay").insertAdjacentElement('BeforeEnd',oDiv);
       
       document.getElementById(oDiv.id).insertAdjacentHTML('BeforeEnd',"<img src='images/map/listMark.gif'>  没有结果");
   }
}





function insertResultFrame(x,y,si,type) //添加结果定位框
{
   tempx = x / (document.frames["MapFrame"].modulus * tempScale);
   tempy = y / (document.frames["MapFrame"].modulus * tempScale);
     
   x = tempx * document.frames["MapFrame"].modulus * document.frames["MapFrame"].scale;
   y = tempy * document.frames["MapFrame"].modulus * document.frames["MapFrame"].scale;
   
   if( type == "map")
   {
      document.frames["MapFrame"]. AjustMap(x+195,y+50); ;
      document.frames["MapFrame"].insertInfoFrame(x,y,si);
   }
}

function insertStudentResultFrame(x,y,si)//添加学生结果定位框
{
   tempx = x / (document.frames["MapFrame"].modulus * tempScale);
   tempy = y / (document.frames["MapFrame"].modulus * tempScale);
     
   x = tempx * document.frames["MapFrame"].modulus * document.frames["MapFrame"].scale;
   y = tempy * document.frames["MapFrame"].modulus * document.frames["MapFrame"].scale;
   
   document.frames["MapFrame"].AjustMap(x,y);
   document.frames["MapFrame"].insertStudentInfoFrame(x,y,si,"StudentInfoFrame.aspx");
}


var searchStationKeyWord = "";//搜索站点的关键字
var searchBusLineKeyWord = "";//搜索线路的关键字
var searchStartStation = "";//起点站点
var searchEndStation = "";//终点站点

var IntelligentMark = "";//智能标识
var point = "";//终点
var endPointName = "";//终点名称
var startPointName = "";//起点名称;
var EndStationDistance = "";//终点站距离
var StartStationDistance = "";//起点站距离

function DisplayBusResult()//显示公交搜索结果
{
   if(document.getElementById("StationQuery").style.display == "")//搜索站点
   {
      if(document.getElementById("StationQueryWord").value == "例如:天河站" || document.getElementById("StationQueryWord").value == "")
      { 
         alert("公交站点不能为空！");
         document.getElementById("StationQueryWord").value = "";
         document.getElementById("StationQueryWord").focus();
      }
      else
      {
         searchStationKeyWord = document.getElementById("StationQueryWord").value;
         document.getElementById("InfoFrame").src = "Bus/SearchStation.aspx";
      }
   }
   if(document.getElementById("LineQuery").style.display == "")//搜索线路
   {
      if(document.getElementById("BusNo").value == "例如:11路" || document.getElementById("StationQueryWord").value == "")
      { 
         alert("公交线路不能为空！");
         document.getElementById("BusNo").value = "";
         document.getElementById("BusNo").focus();
      }
      else
      {
         searchBusLineKeyWord = document.getElementById("BusNo").value;
         document.getElementById("InfoFrame").src = "Bus/SearchLine.aspx";
      }
   }
  if(document.getElementById("TransferBusQuery").style.display == "")//公交换乘
   {
      if(document.getElementById("startStation").value != "" && document.getElementById("startStation").value != "")
      {
         var startStation = escape(document.getElementById("startStation").value);//进行编码
         var endStation = escape(document.getElementById("endStation").value);//进行编码

         document.getElementById("InfoFrame").src = "Bus/TransferBusQuery.aspx?s="+startStation+"&e="+endStation;
      }
      else
      {
         alert("起点和终点不能为空！");
         document.getElementById("startStation").focus();
      }
   }
}

function DisplayLineStation()//显示线路经过站点
{
   if(searchBusLineKeyWord !="")
   {  
      document.getElementById("InfoFrame").src = "Bus/SearchLine.aspx";
   }
}

var classInfoFirstType = new Array();//分类信息二级分类数组
var classInfoSecType = new Array();//分类信息二级分类数组

function DisplaySearchFrmDropType()//显示搜索栏分类信息下拉列表类型
{
   if(document.getElementById("SearchType").length == 0)
   {
      ClassInfo.GetClassInfoSecType("return",GetClassInfoSecType_callback);
   }
}

function GetClassInfoSecType_callback(response)//搜索栏分类信息返回函数
{
   arClassInfoSecType = response.value;
   
   var firstTypeTemp = arClassInfoSecType[0].FIRSTNAME;
   
   for(i=0;i<arClassInfoSecType.length;i++)
   { 
      if(arClassInfoSecType[i].FIRSTNAME != firstTypeTemp)//判断是否分隔
      {
         var oOption = document.createElement("option");//创建option
         oOption.innerText = "---------------------";  
         document.getElementById("SearchType").appendChild(oOption);
         firstTypeTemp = arClassInfoSecType[i].FIRSTNAME;
         
         oOption = document.createElement("option");//创建option
         oOption.innerText = arClassInfoSecType[i].NAME;  
         document.getElementById("SearchType").appendChild(oOption);
      }
      else
      {
         var oOption = document.createElement("option");//创建option
         oOption.innerText = arClassInfoSecType[i].NAME;  
         document.getElementById("SearchType").appendChild(oOption); 
      }
      
      classInfoFirstType[i] = arClassInfoSecType[i].FIRSTNAME;
      classInfoSecType[i] = arClassInfoSecType[i].NAME;     
   }  
}

var classInfoKeyWord = "";//分类信息搜索关键字
var secondType = "";//分类信息类型
var firstType = "";//分类信息所属一级分类

function DisplaySearchClassInfoResult()//显示分类信息搜索结果
{
   if(document.getElementById("ClassInfoKeyword").value == "输入关键字：寻房问屋、同城交易...")
   {
       alert("请输入关键字");
   }
   else
   {
       var choose = document.getElementById("SearchType");
       classInfoKeyWord = document.getElementById("ClassInfoKeyword").value;
       secondType = choose.options[choose.selectedIndex].text;
       for(i=0;i<classInfoSecType.length;i++)
       {
          if(classInfoSecType[i] == secondType)
          {
             firstType = classInfoFirstType[i];
          }
       }
       document.getElementById("InfoFrame").src = "ClassInfo";
   }
}


function showSelect(obj)
    {
     document.getElementById("h1").value=obj.options[obj.selectedIndex].value;
     var sel_value=obj.options[obj.selectedIndex].value;
     alert(sel_value);
     if(sel_value=="")
     {
      return;
     }
     RefreshDiv(obj.id,sel_value);
    }
    function RefreshDiv(objId,value)
     {
      var divObj=d1;
      var selArray=d1.getElementsByTagName("select");
      var j;
      var del=false;
      for(i=0;i<selArray.length;i++)
      {
        if(selArray[i].id==objId)
        {
         j=i+1;
         del=true;
         break;
        }
      }
      if(del)
      {
        for(var len=selArray.length;len>j;len--)
        {
          d1.removeChild(selArray[len-1]);
        }
        del=false;
      }
      //d1.innerHTML+="<select id='aa'><option></option><option value='11'>xx</option><option value='22'>22</option></select>";
      text1.getSelect(value,getResult_callback);
     }
     function getResult_callback(response)
     {
      var sel=response.value;
      if(sel.length>0)
      {
        var newSel=document.createElement("select");
        newSel.id=sel[0].Sel_value;
        //alert(newSel.id);
        newSel.onchange=function(){showSelect(this)};
        var ss=new Option();
        ss.text="";
        ss.value="";
        newSel.options.add(ss);
        for(i=0;i<sel.length;i++)
        {
         var opt=new Option();
         opt.text=sel[i].Sel_text;
         opt.value=sel[i].Sel_value;
         newSel.options.add(opt);
        }
        d1.appendChild(newSel);
        //alert(document.getElementById("h1").value);
      }
     }
//     function RefreshSel()
//     {
//             alert('sss');
//       text1.getSelect("",getSel_callback);

//     }
//     function getSel_callback(response)
//     {
//      var sel=response.value;
//      for(i=0;i<sel.length;i++)
//      {
//       var opt=new option();
//       opt.text=sel[i].Sel_text;
//       opt.value=sel[i].Sel_value;
//       document.getElementById("s1").options.add(opt);
//      }
//     }
function searchQY()
{
 if(DH_Div.css)
       { DH_Div.css("display","none");}
 var ss=document.getElementById("mapKeyword").value;
 ss=encodeURI(ss);
 document.getElementById("InfoFrame").src="QY_SEARCH/search.aspx?search="+ss;
 ShowRightForm();
}
function Return()
{
document.getElementById("InfoFrame").src = "classInfo/default.aspx"
}
function Turntosale()
{
document.getElementById("InfoFrame").src = "classInfo/defaultsale.aspx"
}

function ShowRightForm()
{
  if(document.getElementById("right").style.width != "389px")
   {
       document.getElementById("right").style.display = "";
      document.getElementById("RightBtn").style.display = "none";
      document.getElementById("right").style.width = "389px";
      document.getElementById("left").style.width = parseInt(document.getElementById("MainPart").style.width) - 389;
      document.getElementById("InfoFrame").style.width= "389px";
      document.getElementById("MapFrame").style.width = parseInt(document.getElementById("left").style.width) -1;
      document.getElementById("HiddenRightBtn").style.left = parseInt(document.getElementById("left").style.width) -10;
      document.getElementById("Div1").style.left = parseInt(document.getElementById("left").style.width) -10;

       document.frames["MapFrame"].document.getElementById("Eye").style.left = screen.width - 20 - 575;
      document.frames["MapFrame"].document.getElementById("zoom").style.left = screen.width - 20 - 428;
      //document.frames["MapFrame"].document.getElementById("Zoom").style.left = screen.width - 20- 987;
      document.frames["MapFrame"].document.getElementById("EyeMaximum").style.left = screen.width - 20 - 440;
      //document.getElementById("HiddenRightBtn").src = "images/hiddenRightBtn.gif";  
      document.frames["MapFrame"].document.getElementById("map").style.left = parseInt(document.frames["MapFrame"].document.getElementById("map").style.left) - 0;
      
   }
}
function searchHot(search)
{
   document.getElementById("mapKeyword").value=search;
   ShowRightForm();
//   HiddenRightForm();
   //ChangeBtn("yelSearch");
   search=escape(search);
   document.getElementById("InfoFrame").src="QY_SEARCH/search.aspx?search="+search;
}

function buildingSearch()
{
  var build_from=document.getElementById("from").value;
  build_from=build_from.replace(' ','');
  build_from=escape(build_from);
  var build_to=document.getElementById("to").value;
  build_to=build_to.replace(' ','');
  build_to=escape(build_to);
  document.getElementById("InfoFrame").src="BuildingSearch/BuildingSearch.aspx?from="+build_from+"&to="+build_to;
  ShowRightForm();
}


function showModel()
{
 alert('此功能即将推出，敬请期待！');
}


 function Building_position()
   {
    alert("请先在地图区域点击选取出租地点");
    var str = "<div id='XYBuilding' style='filter: glow(color=#FF9900,strength=3); height:10px; color:white; padding:10px 0px 0px 15px;position:absolute;top:0px;left:0px;z-index:200'>"
    var oDiv = document.createElement(str);
    document.frames["MapFrame"].document.getElementById("map").insertAdjacentElement('BeforeEnd',oDiv);
    document.frames["MapFrame"].document.getElementById("XYBuilding").insertAdjacentText('beforeEnd','点击左键选取地点,右键取消添加');
    
    document.frames["MapFrame"].document.getElementById("map").onmousemove = document.frames["MapFrame"].XYMove2;
   }
   
 function building_info()
 {
 document.getElementById("InfoFrame").src = "rental.aspx";
 ShowRightForm();
 //document.frames["MapFrame"].DisplayHouse();
 }
  function buildingS_info()
 {
 document.getElementById("InfoFrame").src = "huiyuan/Default.aspx?action=house";
 ShowRightForm();
 
 
 }



 function showHuiYuan()
 {
   document.getElementById("InfoFrame").src = "huiyuan/Default.aspx";
  ShowRightForm();
 }