﻿var FrameMenuSty;
var FrameSrcString;
var TableStyle;

var indexImg="";
var iframeImg="";
function iframeUI()
{
    var root = window.location.href;
    root = root.substring(0,root.indexOf("/include"));
    var tagName = document.getElementsByTagName("img");
    for(var i=0;i<tagName.length;i++)
    {
         if(tagName[i].src.search(/\.aspx\?/)==-1)
        {
            var firstS = tagName[i].src.lastIndexOf("/")+1;
            var secondS = tagName[i].src.length;
            tagName[i].src = root + "/IMAGE/" +  tagName[i].src.substring(firstS,secondS);
        }
    }
}
function searchSelectChange(imgObj)
{
	if(FrameMenuSty == null)
	{
		FrameMenuSty = document.all.mapSImg;
		FrameSrcString = document.all.mapSImg.src = FrameMenuSty.src.substring(0, FrameMenuSty.src.lastIndexOf(".")-1) + "1" + FrameMenuSty.src.substring(FrameMenuSty.src.lastIndexOf("."), FrameMenuSty.src.length);
		TableStyle = document.all.mapS;
		FrameMenuSty = imgObj;
		FrameSrcString = imgObj.src;
		imgObj.src = imgObj.src.substring(0, imgObj.src.lastIndexOf(".")-1) + "3" + imgObj.src.substring(imgObj.src.lastIndexOf("."), imgObj.src.length);
	}
	else
	{
	    FrameMenuSty.src = FrameSrcString;
	    FrameSrcString = imgObj.src;
	    imgObj.src = imgObj.src.substring(0, imgObj.src.lastIndexOf(".")-1) + "3" + imgObj.src.substring(imgObj.src.lastIndexOf("."), imgObj.src.length);
	    FrameMenuSty = imgObj;
	}
	TableStyle.style.display = "none";
	var tempid = getTableName(imgObj.id);
	document.getElementById(tempid).style.display = "";
	TableStyle = document.getElementById(tempid);	
}
function getTableName(imgName)
{
	var tableName;
	tableName = imgName.substring(0,imgName.indexOf("S")+1);
	return tableName;
}
//选者不同的搜索的内容
function selectchange()
{
	if(document.all.busselect.value==1)
	{
		document.all.p2pSearchTab.style.display="";
		document.all.busLineSearchTab.style.display="none";
		document.all.busStationSearchTab.style.display="none";
	}
	if(document.all.busselect.value==2)
	{
		document.all.p2pSearchTab.style.display="none";
		document.all.busLineSearchTab.style.display="";
		document.all.busStationSearchTab.style.display="none";
	}

	if(document.all.busselect.value==3)
	{
		document.all.p2pSearchTab.style.display="none";
		document.all.busLineSearchTab.style.display="none";
		document.all.busStationSearchTab.style.display="";
	}
}

function ereaFocusForInput1()
{
	if (document.all.areaSearchTb1.value == '关键字,如"物美大卖场"') 
	{
		document.all.areaSearchTb1.value = "";
	}
	
}

function ereaBlurForInput1()
{
	if (document.all.areaSearchTb1.value == "") 
	{
		document.all.areaSearchTb1.value = '关键字,如"物美大卖场"';
	}
}

function ereaFocusForInput2()
{
	if (document.all.areaSearchTb2.value == '区域,如"4号大街"') 
	{
		document.all.areaSearchTb2.value = "";
	}
	
}

function ereaBlurForInput2()
{
	if (document.all.areaSearchTb2.value == "") 
	{
		document.all.areaSearchTb2.value = '区域,如"4号大街"';
	}
}


function mapSonfoucs()
{
	if (document.all.mapSearchTb.value == '建筑或企业,如\"格莱美KTV\"') 
	{
		document.all.mapSearchTb.value = "";
	}
	
}

function mapSonblur()
{
	if (document.all.mapSearchTb.value == "") 
	{
		document.all.mapSearchTb.value = '建筑或企业,如\"格莱美KTV\"';
	}
}

function STSonfoucs()
{
	if (document.all.firstStationText.value == "起点站") 
	{
		document.all.firstStationText.value = "";
	}
	
}

function STSSonblur()
{
	if (document.all.firstStationText.value == "") 
	{
		document.all.firstStationText.value = "起点站";
	}
}

function STSonfoucs1()
{
	if (document.all.secondStationText.value == "终点站") 
	{
		document.all.secondStationText.value = "";
	}
	
}

function STSSonblur1()
{
	if (document.all.secondStationText.value == "") 
	{
		document.all.secondStationText.value = "终点站";
	}
}

function BusLineonfoucs()
{
	if (document.all.busLineNum.value == '路线,如"1"') 
	{
		document.all.busLineNum.value = "";
	}
	
}

function BusLineonblur()
{
	if (document.all.busLineNum.value == "") 
	{
		document.all.busLineNum.value = '路线,如"1"';
	}
}


function busStationonfoucs()
{
	if (document.all.busStationName.value == '站点名,如"大学路北口"') 
	{
		document.all.busStationName.value = "";
	}
	
}

function busStationonblur()
{
	if (document.all.busStationName.value == "") 
	{
		document.all.busStationName.value = '站点名,如"大学路北口"';
	}
}

var dialogSta;
var diaWidth;
var disTop;


function showSearchTable()
{
    document.getElementById("defaultLeft2").style.display="block";
    document.getElementById("defaultLeft1").style.display="none";
}
//地图搜索
function mapSearch()
{
//	imgBack1();
	if (document.all.mapSearchTb.value == '建筑或企业,如"格莱美KTV"' || document.all.mapSearchTb.value =="")
	{
		alert("请输入搜索关键字,再点搜索");
		return;
	}
	showSearchTable();
    document.getElementById('showIframe').src = "Include/Search/MapSearch.aspx?name=" + escape(document.all.mapSearchTb.value);
}
function STSBusStationShow()
{
//    imgBack1();
	if (document.all.firstStationText.value == "起点站"||document.all.secondStationText.value == "终点站" || document.all.firstStationText.value == ""||document.all.secondStationText.value == ""){
		alert("请输入全部搜索关键字,再点搜索");
		return;
	}
	showSearchTable();
	document.getElementById('showIframe').src = "Include/Search/StationToStationBusSearch.aspx?first="+escape(document.all.firstStationText.value)+"&end="+escape(document.all.secondStationText.value);
}
function busLineSearch()
{
//	imgBack1();
	if (document.all.busLineNum.value == '路线,如"1"'||document.all.busLineNum.value == ""){
		alert("请输入搜索关键字,再点搜索");
		return;
	}
	if (document.all.busLineNum.value.charCodeAt() < 48 || document.all.busLineNum.value.charCodeAt() > 57)
	{
		alert("请输入正确有效的数字.");
		return;
	}
	showSearchTable();
	document.getElementById('showIframe').src  = "Include/Search/SelectBusLine.aspx?line="+escape(document.all.busLineNum.value);
}
function busNameSearch()
{
//    imgBack1();
	if (document.all.busStationName.value == '站点名,如"大学路北口"'|| document.all.busStationName.value ==""){
			alert("请输入搜索关键字,再点搜索");
			return;
		}
		showSearchTable();
     document.getElementById('showIframe').src = "Include/Search/BusStationSearch.aspx?busname="+escape(document.all.busStationName.value);
}
function areaSearch()
{
//	imgBack1();
	if ((document.all.areaSearchTb1.value == '关键字,如"物美大卖场"' || document.all.areaSearchTb1.value == "") && (document.all.areaSearchTb2.value == '区域,如"4号大街"' || document.all.areaSearchTb2.value == ""))
	{
		alert("请输入关键字,再点搜索");
		return;
	}
	XSMap._Default.areaSearch(document.all.areaSearchTb1.value,document.all.areaSearchTb2.value);
	showSearchTable();
	frames('showFrame').location.href = "include/Search/areaSearch.aspx";
	
}
//var theImg="";
function toolBarMouseOver(imgObj)
{
   	if(imgObj.src.substring(imgObj.src.lastIndexOf("."), imgObj.src.lastIndexOf(".")-1) == "1")
	{
		imgObj.src = imgObj.src.substring(0, imgObj.src.lastIndexOf(".")-1) + "2" + imgObj.src.substring(imgObj.src.lastIndexOf("."), imgObj.src.length);
	}
}
function toolBarMouseOut(imgObj)
{
	if(imgObj.src.substring(imgObj.src.lastIndexOf("."), imgObj.src.lastIndexOf(".")-1) == "2")
	{
		imgObj.src = imgObj.src.substring(0, imgObj.src.lastIndexOf(".")-1) + "1" + imgObj.src.substring(imgObj.src.lastIndexOf("."), imgObj.src.length);
	}
} 
//function toolBarClick(imgObj){
//    if(theImg.search(/3/)!=-1){
//        
//    }
//}
//function initImg(){
//    var img = document.getElementById("toolMenuDiv");
//    for(var i=0;i<img.children.length;i++){
//        var child = img.children[i].src;
//        child = child.replace("2"."1");
//        child = child.replace("3"."1");
//        img.children[i].src = child;
//    }
//}
var FrameMenuSty1;
var FrameSrcString1;
function FrameMenuChange(imgObj)
{
	if(imgObj.src.substring(imgObj.src.lastIndexOf(".")-1, imgObj.src.lastIndexOf(".")) != "3")
	{
		imgObj.src = imgObj.src.substring(0, imgObj.src.lastIndexOf(".")-1) + "3" + imgObj.src.substring(imgObj.src.lastIndexOf("."), imgObj.src.length);
	}
	setImgSta(imgObj.id);
	document.getElementById('showIframe').src = GetFramSrc(imgObj.id);
}

function setImgSta(srcStr)
{
	switch(srcStr)
	{
//		case "threeGovImg":
//			document.all.threeSevImg.src = "image/threeSev1.gif";
//			document.all.threeMesImg.src = "image/留言1.gif";
//			break;
		case "threeSevImg":
//			document.all.threeGovImg.src = "image/threeGov1.gif";
			document.all.threeMesImg.src = "image/留言1.gif";
			break;
		case "threeMesImg": 
		    document.all.threeSevImg.src = "image/threeSev1.gif";
//		    document.all.threeGovImg.src = "image/threeGov1.gif";
		    break;
		default:
			break;
	}
	return srcStr;	
}
function GetFramSrc(srcStr)
{
	switch(srcStr)
	{
		case "11":
			srcStr = "include/intro.aspx";
			break;
		case "threeGovImg":
			srcStr = "include/3dzhengwu.aspx";
			break;
		case "threeSevImg":
			srcStr = "include/threeSever.aspx";
			break;
		case "threeMesImg":
		    srcStr = "include/mesboard.aspx";
		    break;
		default:
			srcStr = "include/intro.aspx";
			break;
	}
	return srcStr;	
}
function hiddenIframe()
{
    document.getElementById("arrowup_div").style.display = "none";
    document.getElementById("indexTitle").style.display = "none";
    document.getElementById("arrow_div").style.display = "block";
    document.getElementById("showIframe").style.display = "none";  
}
function showIframe(){
    document.getElementById("arrowup_div").style.display = "block";
    document.getElementById("indexTitle").style.display = "block";
    document.getElementById("arrow_div").style.display = "none";
    document.getElementById("showIframe").style.display = "block";
}

function houseSonfoucs()
{
	if (document.getElementById("houseSearchTb").value == '建筑名称,如\"中国工商银行\"') 
	{
		document.getElementById("houseSearchTb").value = "";
	}
	
}

function houseSonblur()
{
	if (document.getElementById("houseSearchTb").value == "") 
	{
		document.getElementById("houseSearchTb").value = '建筑名称,如\"中国工商银行\"';
	}
}
function houseSearch(){

    if (document.getElementById("houseSearchTb").value == '建筑或企业,如\"中国工商银行\"' || document.getElementById("houseSearchTb").value =="")
	{
		alert("请输入搜索关键字,再点搜索");
		return;
	}
	showSearchTable();
   document.getElementById('showIframe').src  = "Include/Search/FloorSearch.aspx?floorname=" +escape(document.getElementById("houseSearchTb").value);
	
}

function speak()
{
  document.getElementById('threeMesImg').src="image/search_2.gif";
  document.getElementById("threeSevImg").src="image/threeSev1.gif";
}



//工交搜索
var   objbeforeItem1=null;						
var   objbeforeItembackgroundColor1=null;		
function   ItemDown1(obj)   
{   
	if(objbeforeItem1)							
	{   
		objbeforeItem1.style.backgroundColor=objbeforeItembackgroundColor1;		
	}  
	objbeforeItembackgroundColor1=obj.style.backgroundColor;					
	obj.style.backgroundColor="#FFC364";	 						
	objbeforeItem1=obj;															
}

var   objbeforeItem2=null;   
var   objbeforeItembackgroundColor2=null; 
function  ItemDown2(obj)   
{   
	if(objbeforeItem2)   
	{   
		objbeforeItem2.style.backgroundColor=objbeforeItembackgroundColor2;   
	}  
	objbeforeItembackgroundColor2=obj.style.backgroundColor;   
	obj.style.backgroundColor="#FFC364";   
	objbeforeItem2=obj;   
}

var SearchSign;
var BeginStation = null;					
var EndStation = null;						

function showSearch1(BeginStationString1)
{
	BeginStation=BeginStationString1;
	//XSMap.include.StationToStationBusSearch.GetBeginStation(BeginStationString1);
}

function showSearch5(EndStationString1)
{
	
   EndStation=EndStationString1;
   //XSMap.include.StationToStationBusSearch.GetEndStation(EndStationString1);
}

function STSTostep2()
{
	if (BeginStation == EndStation) 
	{
		alert("选择错误:起点站和终点站相同了!");
		return;
	}
	if (BeginStation != null && EndStation != null) 
	{
    	parent.document.getElementById('showIframe').src = "Include/Search/TowSearch.aspx?first="+escape(BeginStation)+"&end="+escape(EndStation);
		BeginStation = null;
		EndStation = null;
	}
	else
	{
		if (BeginStation == null && EndStation != null) {
		alert("请选择起点站");
		}
		else
			if (BeginStation != null && EndStation == null) 
			{
			alert("请选择终点站");
			}
			else{
			alert("请选择起点站和终点站");
			}			
	}
	
}
