﻿// JScript 文件


 function ReTOrF(id,obj)
      { var bool=true;
         if(id=="0") 
           {  
                var   province=document.getElementById("SlGoToFromCity");   
                var   pindex   = province.selectedIndex;   
                var   pValue   = province.options[pindex].value;   
                var   pText    = province.options[pindex].innerText;   
                if(pValue=="0")
                  {                 
                     bool=false;
                  }
               var   DisCode=document.getElementById("SlGoToCity");   
               var   Dindex   =   DisCode.selectedIndex;   
               var   DValue   =   DisCode.options[Dindex].value;  
               if(DValue=="0")
                  {                 
                     bool=false;
                  }           
               var txtGoto=document.getElementById("GoToTime").value;
               if(txtGoto=="" || txtGoto==null || txtGoto=="请选择时间...")
               {bool=false;}
          }     
          if(!bool)
          {
              PromptEx.alert('请选择城市和时间！',280,120,'友情提示',null,null,null);
          }
          else
          {document.getElementById(obj).click();}
          
       }
       
  var objtr;  
  var objdiv;    
function showmore(wh,btn)
{        
	var obj0=document.getElementById(wh);
	var obj1=document.getElementById(btn);
	if(objtr!=null && objdiv!=null && objtr!=obj0 && objdiv!=obj1)
    {
       objtr.style.display="none";
	   objdiv.innerHTML="<a href='javascript:'>[详情]</a>";
    }
	if(obj0.style.display=="none")
		{
			obj0.style.display="block";
			obj1.innerHTML="<a href='javascript:'>[隐藏]</a>";
	    }
	else
		{
			obj0.style.display="none";
			obj1.innerHTML="<a href='javascript:'>[详情]</a>";
		}
	objtr=obj0;
	objdiv=obj1;
}

String.prototype.Trim = function() {  
  var m = this.match(/^\s*(\S+(\s+\S+)*)\s*$/);  
  return (m == null) ? "" : m[1];  
}

String.prototype.isMobile = function() {  
  return (/^(?:13\d|15\d|18\d)-?\d{5}(\d{3}|\*{3})$/.test(this.Trim()));  
} 

String.prototype.isTel = function()
{
    //"兼容格式: 国家代码(2到3位)-区号(2到3位)-电话号码(7到8位)-分机号(3位)"
    //return (/^(([0\+]\d{2,3}-)?(0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/.test(this.Trim()));
    return (/^(([0\+]\d{2,3}-)?(0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/.test(this.Trim()));
}

function chkForm(obj) {  
       // var obj=document.getElementById(id)
        if (obj.value.isMobile()||obj.value.isTel())  {  
            obj.value = obj.value.Trim();
        } 
        else { 
            obj.value="";
            PromptEx.alert("请输入正确的手机号码或电话号码例如:13916752109或023-3614072",280,120,'友情提示',null,null,null);        
        }          
    
}

function isdate(obj){
   var result=obj.value.match(/^(\d{4})(-|\/)(\d{1,2})\2(\d{1,2})$/);
   if(result==null && obj.value!=null && obj.value!="") 
   {PromptEx.alert("请选择日期，或是输入正确的日期，如：2009-09-03！",280,120,'友情提示',null,null,null);}
}
function isdatetime(obj)
{
    var result=obj.value.match(/^(\d{4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/);
     if(result==null && obj.value!=null && obj.value!="") 
   {PromptEx.alert("请选择日期，或是输入正确的日期，如：2009-09-03 16:56:32！",280,120,'友情提示',null,null,null);}
}
function isCertificate(obj)
{
    var result=obj.value.match(/^(\w*)$/);
     if(result==null) 
   {PromptEx.alert("请输入有效证件码！",280,120,'友情提示',null,null,null);}
}

 function AddT()
       {
        var tb=document.getElementById("JpDataDisplay");
        var row=tb.insertRow(); 
        var rd=row.insertCell();
        //alert(tb.id);
        rd.colSpan = tb.cells.length;
        rd.innerText = "没有您所需要的机票信息！";
       } 
function AddTError(strInfo)
       {
        var tb=document.getElementById("JpDataDisplay");
        var row=tb.insertRow(); 
        var rd=row.insertCell();
        //alert(tb.id);
        rd.colSpan = tb.cells.length;
        rd.innerText = strInfo;
       } 
function GoToClick(id,obj,strCity)
{
  document.getElementById(id).value=strCity;
  document.getElementById(obj).click();
}

function setHiddenCol(obj,oTableMan,iColMan1,iColMan2,oTableChild,iColChild1,iColChild2)
{
         var oTable=document.getElementById(oTableMan);
         var oTable1=document.getElementById(oTableChild); 
         var oTable2=document.all(oTableChild); 
        if(obj.checked==true)
            { 
                    for (i=0;i < oTable.rows.length ; i++)
                    { 
                            if( oTable.rows[i].cells.length>=iColMan2)
                            {
                                oTable.rows[i].cells[iColMan1].style.display = "block";
                                oTable.rows[i].cells[iColMan2].style.display = "block";
                            }
                   }
//                if(oTable1!=null)
//               { 
//                    for (i=0;i < oTable1.rows.length ; i++)
//                    {
//                        oTable1.rows[i].cells[iColChild1].style.display = "block";
//                        oTable1.rows[i].cells[iColChild2].style.display = "block";
//                    } 
//               } 
               if(oTable2!=null)
                {
                      if(!oTable2.length)
                          {
                                    for (j=0;j< oTable2.rows.length ; j++)
                                        {
                                            oTable2.rows[j].cells[iColChild1].style.display = "block";
                                            oTable2.rows[j].cells[iColChild2].style.display = "block";
                                        } 
                          }
                       else
                         {   
                                 for(i=0;i<oTable2.length;i++)
                                   {
                                       var oTable3= oTable2[i];
                                           for (j=0;j< oTable3.rows.length ; j++)
                                            {
                                                oTable3.rows[j].cells[iColChild1].style.display = "block";
                                                oTable3.rows[j].cells[iColChild2].style.display = "block";
                                            } 
                                  } 
                        } 
                }
            }
        else
             {
                       for (i=0;i < oTable.rows.length ; i++)
                        {
                            if( oTable.rows[i].cells.length>=iColMan2)
                               {
                                  oTable.rows[i].cells[iColMan1].style.display = "none";
                                  oTable.rows[i].cells[iColMan2].style.display = "none";
                              }
                        }
//                     if(oTable1!=null)
//                   { 
//                         for (i=0;i < oTable1.rows.length ; i++)
//                        {
//                             oTable1.rows[i].cells[iColChild1].style.display  = "none";
//                             oTable1.rows[i].cells[iColChild2].style.display = "none";
//                        } 
//                   }
                    if(oTable2!=null)
                    {
                       if(!oTable2.length)
                         {
                                     for (j=0;j< oTable2.rows.length ; j++)
                                            {
                                                oTable2.rows[j].cells[iColChild1].style.display = "none";
                                                oTable2.rows[j].cells[iColChild2].style.display = "none";
                                            } 
                         }
                       else
                         {  
                                 for(i=0;i<oTable2.length;i++)
                                   {
                                       var oTable3= oTable2[i];
                                           for (j=0;j< oTable3.rows.length ; j++)
                                            {
                                                oTable3.rows[j].cells[iColChild1].style.display = "none";
                                                oTable3.rows[j].cells[iColChild2].style.display = "none";
                                           } 
                                  }
                         }
                   }


            } 
            
}