﻿

//选择城市
function setCity(obj)
{
	var strsel = obj.options[obj.selectedIndex].text;
	if(strsel!="") 
	{ 
	    if(obj.id=="selectOriginCity")
	    {
	        $('txtOriginCity').value=strsel;
	    }
	    else
	    {
	        $('txtDestinationCity').value=strsel;
	    }
	} 
}


//查询
function queryResult()
{
   
    var OriginCity=$('txtOriginCity').value;
    var DestinationCity=$('txtDestinationCity').value;
    var selectTime=$('PTPdate').value;
    var tr=$('selectTime').options[$('selectTime').selectedIndex].value;
    
    if(OriginCity.Trim() == null || OriginCity.Trim() == "")
	{
		alert("请选择出发城市！");
		return false;
	}
	if(DestinationCity.Trim() == null || DestinationCity.Trim() == "")
	{
		alert("请选择到达城市！");
		return false;
	}
	if(DestinationCity.Trim() == OriginCity.Trim())
	{
		alert("出发城市与到达城市不能一样！");
		return false;
	}
	
	if(selectTime.Trim() == null || selectTime.Trim() == "")
	{
		alert("请输入日期！");
		return false;
	}
	

	
	
    var queryString = StringFormat("oc=%S&dc=%S&st=%S&tr=%S",OriginCity,DestinationCity,selectTime,tr);
     //parent.location='/timetable/search_result.aspx?'+queryString;
     window.open('/timetable/search_result.aspx?'+queryString);
     
     
    //定义弹出窗口
     //opopup=window.createPopup();     
    // var   bHtml='';     
     //bHtml+='<div id="progressBar"  align="center"><table width=100% height=100% cellpadding="5" cellspacing="1" bgColor="D93A27" class=exp1><tr><td bgColor=ffffff align=center class=exp1><img src="/images/loading.gif" align="absmiddle">&nbsp;&nbsp;<font   color="D93A27" size="2"><b>系统正在查询中，请稍候...</b></font></td></tr></table></div>';   
    // opopup.document.body.innerHTML=bHtml;   
    // opopup.show(0,0,320,80,document.body); 

    
}