﻿/*   2008-7-30   自己添加的用来切换 Tab 的JS Begin*/

// ========================= 获取用户选择的信息 Begin
function SetInnerHTML(UserSetUp,parameter){
	
   document.getElementById(defaultInfo).style.display='none'; 

   document.getElementById(UserSetUp).innerHTML = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"tableCs\"><tr><th>系统参数: </th><td>&nbsp;&nbsp;"+parameter+"</td></tr></table>";

}
// ========================= 获取用户选择的信息 End
// =========================  判断当前的栏目样式
var newsID = '';
function getMenuStyle(id){
  var newsObj = document.getElementById(newsID);
  if(newsObj){
    newsObj.style.display = 'none';
    document.getElementById('div'+newsID).className ='';
  }
  var obj = document.getElementById('div' + id);
  document.getElementById('div' + id).className = 'current';
  obj.style.display = '';
  newsID = id;
}
//========================== 获取用户可能的查询内容
function getSearchContent(str){

	var ds = new XMLDatastore();
	ds.init();
	if (!ds.loadFile(path+"xml/Search.xml")) {
		alert("加载文件出错！");
		ds.destroy();
		return;
	}
	var str = "<ul class=\"card\" id=\"Menu_menuList\">";
	var flag = true;
	for(var i=0;i<ds.rowCount();i++)
	{
		
	}
	str += "</ul>";   
	ds.destroy();
}

//  =============== 屏蔽右键功能  Begin

//document.oncontextmenu=new Function("event.returnValue=false");
//document.onselectstart=new Function("event.returnValue=false");

//  =============== 屏蔽右键功能  End

//  首页显示一级栏目，呈现二级栏目
function showMenu(showDiv,path) {
	if (path == undefined) {path="";}
	var ds = new XMLDatastore();
	ds.init();
	if (!ds.loadFile(path+"xml/NewMenu.xml")) {
		alert("加载文件出错！");
		ds.destroy();
		return;
	}
	var str = "<ul class=\"card\" id=\"Menu_menuList\">";
	var flag = true;
	var firstcode = "";
	var count = 1;
	var j = 0;
	var arr=new Array();    //排序
	for (var i = 0; i < ds.rowCount(); i++) {	  
	        arr[j] = new Array();   
	        arr[j][0]=ds.getItemByName(i, "Sort");
	        arr[j][1] = i;
	        j++;
	} 	   

	BubbleSort(arr);
	
	
	for (var i = 0; i < 6; i++) 
	{       
        if (flag) {
            firstcode = ds.getItemByName(arr[i][1], "Code");
            str += "<li class=\"card0" + (count++) + "\" onclick=\"clickMenu('subMenuList','" + ds.getItemByName(arr[i][1], "Code") + "',this,'" + path + "')\"><a href=\"#\" class=\"current\"></a></li>";
            flag = false;
        }
        else {
            str += "<li class=\"card0" + (count++) + "\" onclick=\"clickMenu('subMenuList','" + ds.getItemByName(arr[i][1], "Code") + "',this,'" + path + "')\"><a href=\"#\"></a></li>";
        }
	 }	   
	
	str += "</ul>";
	document.getElementById(showDiv).innerHTML = str;
	if (firstcode != "") {
		clickMenu('subMenuList',firstcode,null,path);
	}
	ds.destroy();
}

// 首页点击一级栏目,呈现二级栏目
function clickMenu(showDiv,code,obj,path) {
	if (path == undefined) {path="";}
	var ds = new XMLDatastore();
	ds.init();
	if (!ds.loadFile(path+"xml/NewMenu.xml")) {
		alert("加载文件出错！");
		ds.destroy();
	return;
  }
  var row = ds.getRow("Code", code);
  var gopage=ds.getItemByName(row, "Goto");
  if (gopage == "") {


      var str = "<ul class=\"card1_inner\" id=\"Menu_subMenuList\">";
      var flag = true;
      var firstcode = "";
      var count = 1;
      var row = ds.getRow("Code", code);
      var a = ds.childRowCount(row);
      for (var i = 0; i < ds.childRowCount(row); i++) {
          if (flag) {
              firstcode = ds.getChildItemByName(row, i, "Code");
              str += "<li class=\"current\" onclick=\"clickSubMenu('mainForm','" + ds.getChildItemByName(row, i, "Code") + "',this,'" + path + "')\"><a href=\"#\"  class=\"current\">" + ds.getChildItemByName(row, i, "MenuName") + "</a></li>";
              flag = false;
          }
          else {
              str += "<li onclick=\"clickSubMenu('mainForm','" + ds.getChildItemByName(row, i, "Code") + "',this,'" + path + "')\"><a href=\"#\" >" + ds.getChildItemByName(row, i, "MenuName") + "</a></li>";
          }
      }
      str += "</ul>";
      document.getElementById(showDiv).innerHTML = str;
      if (firstcode != "") {
          clickSubMenu('mainForm', firstcode, null, path);
      }
      if (obj) {
          var menuList = document.getElementById("Menu_menuList").childNodes;
          for (var i = 0; i < menuList.length; i++) {
              menuList[i].childNodes[0].className = "";
          }
          obj.childNodes[0].className = "current";
      }
  }
  else {
   
      window.location.href = gopage;
  }
	ds.destroy();	
}

//首页点击二级栏目，呈现首页头部页面
function clickSubMenu(showDiv,code,obj,path) {
	if (path == undefined) {path="";}
	if (code.indexOf("-sysm") != -1) {
		showPopWin('readme.aspx?code='+code,524,454,null);
		return;
    }
    if (code.indexOf("-ymtz") != -1) {
        var Newcode = code.substring(0, code.length - 5);
        window.location.href = "Bus/default.aspx?code=" + Newcode + "&subcode=" + code;
        return;
    }
	var ds = new XMLDatastore();
	ds.init();
	if (!ds.loadFile(path+"xml/MenuHtml.xml")) {
		alert("加载文件出错！");
		ds.destroy();
		return;
	}
	var str = "";
	for(var i=0;i<ds.rowCount();i++)
	{
		if (ds.getItemByName(i,"Code") == code) {
			str += ds.getItemXmlByName(i,"MenuHTML");
			break;
		}
	}
	document.getElementById(showDiv).innerHTML = str;
	if (obj) {
		var menuList = document.getElementById("Menu_subMenuList").childNodes;
		for (var i=0; i<menuList.length; i++) {
			menuList[i].className = "";
		}
		obj.className = "current";
	}
	if (C_setting.indexOf(",busService_2,") == -1) { //实时车辆信息
		if ($("mapBusLocation")) { //1
			$("mapBusLocation").style.display = 'none';
			$("lbmapBusLocation").style.display = 'none';
		}
		if ($("gjcx-cclx_moreSetting")) {
			$("gjcx-cclx_moreSetting").style.display = 'none';
		}
	}
	if (C_setting.indexOf(",trafficService_1,") == -1) {//实时路况服务
		if ($("mapRoadCondition")) { //2
			$("mapRoadCondition").style.display = 'none';
			$("lbmapRoadCondition").style.display = 'none';
		}
	}
	if (C_setting.indexOf(",driveService_1,") == -1 || C_setting.indexOf(",trafficService_2,") == -1) {//实况驾驶信息, 实时交通情况播报
		if ($("mapRoadEvents")) { //3
			$("mapRoadEvents").style.display = 'none';
			$("lbmapRoadEvents").style.display = 'none';
		}
	}
	if (C_setting.indexOf(",parkService_1,") == -1) {//基础停车场服务
		if ($("mapEndParks")) { //4
			$("mapEndParks").style.display = 'none';
			$("lbmapEndParks").style.display = 'none';
		}
	}
	if (C_setting.indexOf(",trafficService_2,") == -1) {// 实时交通情况播报
		if ($("mapAllEvents")) { //5
			$("mapAllEvents").style.display = 'none';
			$("lbmapAllEvents").style.display = 'none';
		}
	}
	
	if (C_setting.indexOf(",parkService_2,") == -1) {//动态车位信息
		if ($("tcccx_park_setting")) {
			$("tcccx_park_setting").style.display = "none";
		}
	}
	var url = "ajax/common.aspx?type=GetCityExample&code="+code+"&time="+new Date().getTime();
	var response = httpRequest("get",null,url);
	if (response != null) {
		var examples = response.split("|");
		if ($("StartExample")) {
			$("StartExample").innerHTML = examples[0];
		}
		if ($("EndExample")) {
			if (examples.length > 1) {
				$("EndExample").innerHTML = examples[1];
			}
		}
	}
	if (code == "ctpw-pwcx") { // 长途票务
		var current_time  =  new Date();
		$("StartDate").value = dateAdd(current_time,1);
		//调用查询的AJAX  	
		url = "ajax/ajax.aspx?type=GetAllCoachPlat&time="+new Date().getTime();        
		response = httpRequest("get",null,url);
		if (!ds.loadXML(response)) {
		   alert("加载文件出错！");
		   return false;
		}
		var StratPlace = $("StratPlace");
		for (var i=0; i<ds.rowCount(); i++) 
		{
			StratPlace.options.add(new Option(ds.getItemByName(i,"PlatName"),ds.getItemByName(i,"PlatID")));
		}
	}
	ds.destroy();
}

// 首页路况
function clickInfoMenu(showDiv,code,obj,path) {
	if (path == undefined) {path="";}
	if (code == "ctxx") {
		window.open("Bus/default.aspx?code=ctpw&subcode=ctpw-pwcx","","");
		return;
	}
	var ds = new XMLDatastore();
	ds.init();
	if (!ds.loadFile(path+"xml/InfoHtml.xml")) {
		alert("加载文件出错！");
		return;
	}
	var str = "";
	for(var i=0;i<ds.rowCount();i++)
	{
		if (ds.getItemByName(i,"Code") == code) {
			str += ds.getItemXmlByName(i,"MenuHTML");
			break;
		}
	}
	document.getElementById(showDiv).innerHTML = str;
	if (obj) {
		var menuList = document.getElementById("infoMenuList").childNodes;
		for (var i=0; i<menuList.length; i++) {
			menuList[i].className = "";
		}
		obj.className = "current";
	}
	updateInfoContent(code);
	ds.destroy();
}

//更新首页路况
function updateInfoContent(code,path) {
	if (path == undefined) {path="";}
	var ds = new XMLDatastore();
	ds.init();
	var url = "ajax/common.aspx?type=GetAttentionInfo&code="+code+"&time="+new Date().getTime();
	var response = httpRequest("get",null,url);
	if (!ds.loadXML(response)) {
		alert("加载文件出错！");
		ds.destroy();
		return false;
	}
	
	var gzDiduan = document.getElementById("gzDiduan");
	var flag = true;
	for(var i=0;i<ds.rowCount();i++)
	{
		gzDiduan.options[gzDiduan.options.length] = new Option(ds.getItemByName(i,"PoiName"),ds.getItemByName(i,"id")+"_"+ds.getItemByName(i,"PoiName"));
		if (flag) {
			flag = !flag;
			if (slider != null) {
				slider.destroy();
			}
			slider = new slideshow(code,ds.getItemByName(i,"id")+"_"+ds.getItemByName(i,"PoiName"));
			slider.play();
		}
	}
	if (ds.rowCount() == 0) {
		if (slider != null) {
			slider.destroy();
			slider.infoCode = code;
		}
	}
	
	ds.destroy();
}

// =====================================  首页信息路况中的下拉框中的内容改变
function updateAreaInfo(code,id,order) {
	if (slider != null) {
		slider.destroy();
	}
	if (order == undefined) order = "";
	$("areaInfoList").innerHTML = "<font color=red>正在加载...</font>";
	//alert("flybird 首页信息路况总的下拉框内容改变【pages.js的第353行】\r\n code is:"+code+"\r\n id is:"+id+"\r\n order is:" + order);
	slider = new slideshow(code, id, order);
	slider.play();
}

//二级页面显示一级栏目
function showMenuBus(showDiv,code,path) {
	if (path == undefined) {path="";}
	if (code == undefined) {code="";}
	var ds = new XMLDatastore();
	ds.init();
	if (!ds.loadFile(path + "xml/NewMenu.xml")) {
		alert("加载文件出错！");
		ds.destroy();
		return;
	}
	//==========================================
	
	var str = "<ul class=\"cardSecond\" id=\"Menu_menuList\">";
	var flag = true;
	var count = 1;
	var j = 0;
	var arr = new Array();    //排序
	for (var i = 0; i < ds.rowCount(); i++) {
	    arr[j] = new Array();
	    arr[j][0] = ds.getItemByName(i, "Sort");
	    arr[j][1] = i;
	    j++;
	}

	BubbleSort(arr);

	for (var i = 0; i < 6; i++) {  
			if (code == "") {
			    code = ds.getItemByName(arr[i][1], "Code");
			}
			if (ds.getItemByName(i,"Code") == code) {
				str += "<li class=\"card0"+(count++)+"\" id=\""+ds.getItemByName(arr[i][1],"Code")+"\" onclick=\"clickMenuBus('bar02','"+ds.getItemByName(arr[i][1],"Code")+"','"+path+"')\"><a href=\"#\" class=\"current\"></a></li>";
			}
			else {
				str += "<li class=\"card0"+(count++)+"\" id=\""+ds.getItemByName(arr[i][1],"Code")+"\" onclick=\"clickMenuBus('bar02','"+ds.getItemByName(arr[i][1],"Code")+"','"+path+"')\"><a href=\"#\"></a></li>";
			}
   }	
	str += "</ul>";
	document.getElementById(showDiv).innerHTML = str;
	if (code != "") {
		clickMenuBus('bar02',code,path);
	}	
	ds.destroy();
	//==========================================
}

//二级页面点击一级栏目,呈现二级目录
function clickMenuBus(showDiv,code,path) {
	
	if (path == undefined) {path="";}
	var ds = new XMLDatastore();
	ds.init();
	if (!ds.loadFile(path + "xml/NewMenu.xml")) {
		alert("加载文件出错！");
		ds.destroy();
		return;
	}
	var str = "<ul class=\"cardMenu\" id=\"Menu_subMenuList\">";
	var flag = true;
	var firstcode = "";	
	var row = ds.getRow("Code", code);
    var gopage=ds.getItemByName(row, "Goto");
    if (gopage == "") {
        var a = ds.childRowCount(row);
        for (var i = 0; i < ds.childRowCount(row); i++) {
            if (flag) {
                firstcode = ds.getChildItemByName(row, i, "Code");
                str += "<li class=\"current\" id=\"" + ds.getChildItemByName(row, i, "Code") + "\" onclick=\"clickSubMenuBus('mainForm','leftWrapper','" + ds.getChildItemByName(row, i, "Code") + "','" + path + "')\"><a href=\"#\">" + ds.getChildItemByName(row, i, "MenuName") + "</a></li>";
                flag = false;
            }
            else {
                str += "<li id=\"" + ds.getChildItemByName(row, i, "Code") + "\" onclick=\"clickSubMenuBus('mainForm','leftWrapper','" + ds.getChildItemByName(row, i, "Code") + "','" + path + "')\"><a href=\"#\">" + ds.getChildItemByName(row, i, "MenuName") + "</a></li>";
            }
        }
        str += "</ul>";
        document.getElementById(showDiv).innerHTML = str;
        if (firstcode != "") {
            clickSubMenuBus('mainForm', 'leftWrapper', firstcode, path);
        }

        if ($(code)) {
            var menuList = document.getElementById("Menu_menuList").childNodes;
            for (var i = 0; i < menuList.length; i++) {
                menuList[i].childNodes[0].className = "";
            }
            $(code).childNodes[0].className = "current";
        }
        else {
            var menuList = document.getElementById("Menu_menuList").childNodes;
            for (var i = 0; i < menuList.length; i++) {
                menuList[i].childNodes[0].className = "";
            }
            menuList[0].childNodes[0].className = "current";
        }
    }

    else {

        window.location.href = gopage;
    }
	ds.destroy();	
}

//二级页面点击二级栏目
function clickSubMenuBus(showDiv,showBodyDiv,code,path) {
	if (C_setting.indexOf(",busService_1,") == -1 && code == "gjcx-cclx") {//线路规划
		alert("该栏目已停用！");
		window.location.href = "../";
	}
	if (C_setting.indexOf(",busService_2,") == -1 && code == "gjcx-dzsk") { //实时车辆信息
		alert("该栏目已停用！");
		window.location.href = "../";
	}
	if (C_setting.indexOf(",busService_3,") == -1 && code == "gjcx-xlcx") { //公交基础服务信息
		alert("该栏目已停用！");
		window.location.href = "../";
	}
	if (C_setting.indexOf(",busService_4,") == -1 && code == "gjcx-czdt") { //出租地铁信息
		alert("该栏目已停用！");
		window.location.href = "../";
	}
	if (C_setting.indexOf(",trafficService_1,") == -1 && code == "csjtsk-lkcx") { //实时路况服务
		alert("该栏目已停用！");
		window.location.href = "../";
	}
	if (C_setting.indexOf(",trafficService_2,") == -1 && code == "csjtsk-jtsj") { //实时交通情况播报
		alert("该栏目已停用！");
		window.location.href = "../";
	}
	if (C_setting.indexOf(",roamService_1,") == -1 && code == "dtmy-zbss") { //分类地图信息
		alert("该栏目已停用！");
		window.location.href = "../";
	}
	
	if (code.indexOf("-sysm") != -1) {
		showPopWin('../readme.aspx?code='+code,524,454,null);
		return;
}
     
	if (path == undefined) {path="";}
	var ds = new XMLDatastore();
	ds.init();
	if (!ds.loadFile(path+"xml/MenuHtmlBus.xml")) {
		alert("加载文件出错！");
		ds.destroy();
		return;
	}
	var str = "";
	var strSearch="";
	var strbody = "";
	for(var i=0;i<ds.rowCount();i++)
	{
		if (ds.getItemByName(i,"Code") == code) {
			str += ds.getItemXmlByName(i,"MenuHTML");
			strSearch+=ds.getItemXmlByName(i,"MenuSearch");
			strbody += ds.getItemXmlByName(i,"MenuBodyHTML");
			break;
		}
	}
	document.getElementById(showDiv).innerHTML = str;  //显示头文件	
	//document.getElementById("ControlXianshi").innerHTML = strSearch; //显示地图上的查询地方
	var mapSettings = document.getElementsByName("mapSetting");
	for (var i=0; i<mapSettings.length; i++) {
		mapSettings[i].style.display = 'none';
		$("lb"+mapSettings[i].id).style.display = 'none';
	}
	if (strSearch.indexOf("mapBusLocation") != -1) {
		if (C_setting.indexOf(",busService_2,") != -1) { //实时车辆信息
		    $("mapBusLocation").style.display = 'none';
		    $("lbmapBusLocation").style.display = 'none';
		}
	}
	if (strSearch.indexOf("mapRoadCondition") != -1) {
		if (C_setting.indexOf(",trafficService_1,") != -1) {// 实时路况服务
		    $("mapRoadCondition").style.display = '';
		    $("lbmapRoadCondition").style.display = '';
		}
	}
	if (strSearch.indexOf("mapEndParks") != -1) {
		if (C_setting.indexOf(",parkService_1,") != -1) {//基础停车场服务
			$("mapEndParks").style.display = 'none';
			$("lbmapEndParks").style.display = 'none';
		}
	}
	if (strSearch.indexOf("mapRoadEvents") != -1) {
		if (C_setting.indexOf(",driveService_1,") != -1 && C_setting.indexOf(",trafficService_2,") != -1) {//实况驾驶信息, 实时交通情况播报
		    $("mapRoadEvents").style.display = 'none';
		    $("lbmapRoadEvents").style.display = 'none';
		}
	}
	if (strSearch.indexOf("mapAllEvents") != -1) {
		if (C_setting.indexOf(",trafficService_2,") != -1) {// 实时交通情况播报
		    $("mapAllEvents").style.display = 'none';
			$("lbmapAllEvents").style.display = 'none';
		}
	}
    
	document.getElementById(showBodyDiv).innerHTML = strbody;  //显示右侧的部分
	if (code == "ctpw-pwcx" || code == "ctpw-sysm") { // 长途票务
	    autofullMap(true, false, true);
		$("saveCtrl").style.display = 'none';
		$("myMap").style.display = 'none';
		$("scaleBar").style.display = 'none';
		$("ctpwResult").style.display = '';
		$("ctpwResult").innerHTML = '';
     }
     else if (code == "csjtsk-ymtz") {
        autofullMap(false, false, true);     
	    $("saveCtrl").style.display = 'none';
	    $("myMap").style.display = 'none';
	    $("scaleBar").style.display = 'none';
	    $("ctpwResult").style.display = '';
	    $("ctpwResult").innerHTML = '<iframe src="http://172.26.1.112/map/main.aspx?type=1" ID="Frame1"  name="iframe1" frameborder=“0”scrolling="yes"  height="100%" width="100%"><iframe>';
	}
	else {
	    autofullMap(true, true, false);
	    ClearHighLight();
		$("saveCtrl").style.display = '';
		$("myMap").style.display = '';
		$("scaleBar").style.display = '';
		$("ctpwResult").innerHTML = "";
		$("ctpwResult").style.display = 'none';
    }
	if (code == "ctpw-pwcx") { // 长途票务
		//document.getElementById("leftWrapper").innerHTML = strbody;  //显示左侧的部分
		var current_time  =  new Date();
		var strDate       =  current_time.getYear()    + "年";
		strDate          +=  current_time.getMonth()+1   + "月";
		strDate          +=  current_time.getDate()    + "日 ";
		if (current_time.getHours() < 10) {
			strDate          +=  "0"+ current_time.getHours()   + ":";
		}
		else {
			strDate          +=  current_time.getHours()   + ":";
		}
		if (current_time.getMinutes() < 10) {
			strDate          +=  "0"+current_time.getMinutes() + ":";
		}
		else {
			strDate          +=  current_time.getMinutes() + ":";
		}
		if (current_time.getSeconds() < 10) {
			strDate          +=  "0"+current_time.getSeconds();
		}
		else {
			strDate          +=  current_time.getSeconds();
		}
		$("NowTime").innerHTML = strDate;
		$("StartDate").value = dateAdd(current_time,1);
		//调用查询的AJAX  	
		var url = "../ajax/ajax.aspx?type=GetAllCoachPlat&time="+new Date().getTime();        
		var response = httpRequest("get",null,url);
		// DS初始化
		ds.init();
		if (!ds.loadXML(response)) {
		   alert("加载文件出错！");
		   return false;
		}
		var StratPlace = $("StratPlace");
		for (var i=0; i<ds.rowCount(); i++) 
		{
			StratPlace.options.add(new Option(ds.getItemByName(i,"PlatName"),ds.getItemByName(i,"PlatID")));
		}
		ds.destroy();
		$("header").style.height = "80px";
		SetFull();
    }
    else if (code == "csjtsk-ymtz") {
        $("header").style.height = "80px";
        SetFull();
    }
	else {	     
		if ($("header").offsetHeight < 100) {
			$("header").style.height = "115px";
			SetFull();			
		}
     }  
	
	if ($(code)) {
		var menuList = document.getElementById("Menu_subMenuList").childNodes;
		for (var i=0; i<menuList.length; i++) {
			menuList[i].className = "";
		}
		$(code).className = "current";
	}
	else {
		var menuList = document.getElementById("Menu_subMenuList").childNodes;
		for (var i=0; i<menuList.length; i++) {
			menuList[i].className = "";
		}
		menuList[0].className = "current";
	}
	if (code == "gjcx-cclx") {
		if (city == "guangzhou") {
			document.getElementById('gjcx_startPlace').value = document.getElementById('gjcx_endPlace').value = "例如：滨江路  景泰坑";
		}
		else if (city == "xian") {
			document.getElementById('gjcx_startPlace').value = document.getElementById('gjcx_endPlace').value = "例如：北环路 文化路 大雁塔";
		}
	}
	ds.destroy();
	//saveHistory();
	
}

//日期加法
function dateAdd(olddate,day) {
	var T = new Date();
	var t = Date.parse(olddate)+day*1000*3600*24;
	T.setTime(t);
	var year = T.getYear();
	var month = T.getMonth()+1; 
	var date = T.getDate(); 
	return year + "-" + month + "-" + date;
}
//  ============================ 获得用户查询的公交车辆
function showBusContent(carNum,path){
	if (path == undefined) {path="";}
	var ds = new XMLDatastore();
	ds.init();
	if (!ds.loadFile(path+"xml/Car.xml")) {
		alert("加载文件出错！");
		ds.destroy();
		return;
	}
	
	for(var i=0;i<ds.rowCount();i++)
	{
		if (ds.getItemByName(i,"carNum") == carNum) {
			$("carNum").innerHTML = ds.getItemByName(i,"carNum")+"  路公交车";
			$("carSummary").innerHTML = ds.getItemXmlByName(i,"carSummary");
			$("carContent").innerHTML = ds.getItemXmlByName(i,"carContent");
			break;
		}
	}
	ds.destroy();
}

//保存页面操作历史
var showMap = new Array(6);
function saveHistory(showMap1) {
	if (showMap1 == undefined) showMap1 = true;
	showMap = showMap1;
	if(h_index==5)
	{
		h_index=0;
	}else{
		h_index++;
	}
	h_list[h_index]=document.getElementById("headBody").innerHTML;
	h_list1[h_index]=document.getElementById("leftWrapper").innerHTML;
	showMap[h_index]=showMap1;
	$("urlHistory").src = "test.aspx?"+h_index;
}

//得到页面操作历史阶段
function getHisStory(curIndex)
{
	if(curIndex!=h_index)
	{
		if(h_list[curIndex])
		{
			h_index=curIndex;
			document.getElementById("headBody").innerHTML=h_list[curIndex];
			document.getElementById("leftWrapper").innerHTML=h_list1[curIndex];
			if (showMap[curIndex]) {
				$("saveCtrl").style.display = '';
				$("myMap").style.display = '';
				$("scaleBar").style.display = '';
				$("ctpwResult").style.display = 'none';
			}
			else {
				$("saveCtrl").style.display = 'none';
				$("myMap").style.display = 'none';
				$("scaleBar").style.display = 'none';
				$("ctpwResult").style.display = '';
			}
		}
	}
 }


