//在航班查询提交之前验证日期
function BeforeSeachFlight()
{
    var cfld = new Date();
	var StrCfld = cfld.getYear() + "-" + (cfld.getMonth()+1) + "-" + cfld.getDate();
    var prefixId="C_Flight1_";
    var prefixName="C_Flight1:";
    var tmpstart=prefixId+'txtStartDate';
    
	var objOrgCity = $(prefixId+'ddlOrgCity');
    var objDesCity = $(prefixId+'ddlDesCity');
    var objStartDate = $(prefixId+'txtStartDate'); 
    var objaircom=$(prefixId+'ddlAirCompany'); 
    if($(prefixId+'hidcom')!=null) 
    {
         $(prefixId+'hidcom').value=objaircom.options[objaircom.selectedIndex].value;
    }  
    
    //单程Check

         if(objOrgCity.value.replace(new RegExp("(^[\\s]*)|([\\s]*$)", "g"), "")=="" || objOrgCity.value=="拼音输入/单击选择")
        {
            alert("请选择出发城市!");
            objOrgCity.focus();
            return false;
        }
	   
       if(objDesCity.value.replace(new RegExp("(^[\\s]*)|([\\s]*$)", "g"), "")=="" || objDesCity.value =="拼音输入/单击选择")
        {
            alert("请选择到达城市!");
            objDesCity.focus();
            return false;
        }   
					
        if (objOrgCity.value.Trim() == objDesCity.value.Trim())
        {
            alert("您的出发和抵达城市不能相同，请重新选择！");
            objDesCity.focus();
            return false;
        }
        if (objStartDate.value.split('周')[0].Trim()=="" || objStartDate.value.split('周')[0].Trim()=="yyyy-MM-dd")
        {
            alert("请选择出发日期！");
	         event.cancelBubble=true;
            ddCalendar(tmpstart,false,tmpstart,'','',StrCfld,'','','','','text','')  ;
	        return false;  
        }  
        if (!reg.ValidDate( objStartDate.value.split('周')[0].Trim()))
        {
	        alert("您的出发日期选择错误，请重新选择！");
	        event.cancelBubble=true;
            ddCalendar(tmpstart,false,tmpstart,'','',StrCfld,'','','','','text','');  
	        return false;
        }
    return true;			
}

function btnFlightQuery()
{
 var prefixId="C_Flight1_";
 var prefixName="C_Flight1:";
 var startcity = document.getElementById(prefixId+"ddlOrgCity").value;
 var endcity = document.getElementById(prefixId+"ddlDesCity").value;
 getThreeWordByCity("txtstartport",startcity);
 getThreeWordByCity("txtendport",endcity);
  if(BeforeSeachFlight())
 {
     document.getElementById(prefixId+"btnrealQuery").click();
 }

}