﻿// validation on requested url -- start
     var flt_timing_inter;
     var flt_timing_domest_arr;
     var flt_timing_domest_dep;
     var flt_type="I";
     var flt_way="A";     
      
     function GetFIDSFName()
     {
     $.ajax({     type: "GET",
              url: "get-Fids-FlightInfo.aspx",
              data: "FltType="+flt_type+"&FltWay="+flt_way+"&rn=" + Math.random(),dataType:"text",
              success: function(response)
              {
                 //$("#flArrTime").html(response);
                                   $("#flArrTime li").remove();
                                   $("ul#flArrTime").append(response);
                                   $('#flArrTime').innerfade({
			                        animationtype: 'fade',
			                        speed: 500,
			                        timeout: 3000,
			                        type: 'sequence',
			                        containerheight: '1em'  
			                         });               
               }
             });
     }
     
     //postnumber

  // validation on requested url -- end
  

        $(document).ready(function() {
        GetFIDSFName(); 	        	
           
            //for flight timing tab content
		     hideFlightInfoTab();
            $("#live-fligh-arrival-on").show();
            $("#imgFInfoFT").attr("src","/images/live-fligh-arrival-on.gif");
            document.getElementById('flight1_rblArrFlType_0').checked=true;
            document.getElementById('flight1_rblDepFlType_0').checked=true;
            
    
		}); 
		
		// tab control
		 function openFlightInfoTab(id)
            {
                hideFlightInfoTab();
              $("#"+id).fadeIn(500);
             $("#imgFInfoFT").attr("src","/images/"+id+".gif");
             if(id=='live-fligh-arrival-on')
             {
             document.getElementById('flight1_rblArrFlType_0').checked=true;
              getFlInfoTime('a',1);
             }
             else
             {
             document.getElementById('flight1_rblDepFlType_0').checked=true;
             getFlInfoTime('b',1);}
             }
            
            function hideFlightInfoTab()
            {
                $("#live-fligh-arrival-on").hide();
                $("#live-fligh-departure-on").hide();
            }	
            
		function getFlInfoTime(mode,type)
		{
            if(mode=='a')
            {
                flt_way="A";
            }
            else
            {
                flt_way="D";
            }
            
	        if(type==1) //inter
	        {    
	            flt_type="I";
	        }
	        if(type==2)
	        {
	            flt_type="D";
	        }     
	        //alert(flt_type+flt_way);
		 $.ajax({
             type: "get",
             url: "get-Fids-FlightInfo.aspx" ,
             data: "FltType="+flt_type+"&FltWay="+flt_way+"&rn=" + Math.random(),dataType:"text",
              success: function(response) {
                          if(mode=='a') // for type arrival
                          {
                            if(type==1) // international
                            {
                                   $("#flArrTime li").remove();
                                   $("ul#flArrTime").append(response);
                                   $('#flArrTime').innerfade({
			                        animationtype: 'fade',
			                        speed: 800,
			                        timeout: 3000,
			                        type: 'sequence',
			                        containerheight: '1em'
		                        });
		                     }
		                     else // domestic
		                     {
                                   $("#flArrTime li").remove();
                                   $("ul#flArrTime").append(response);
                                   $('#flArrTime').innerfade({
			                        animationtype: 'fade',
			                        speed: 800,
			                        timeout: 3000,
			                        type: 'sequence',
			                        containerheight: '1em'
		                        });
		                     }
			              }
			              else // for type departure
			              {
			                 if(type==1) // international
                            {
                                   $("#flDeptTime li").remove();
                                   $("ul#flDeptTime").append(response);
                                   $('#flDeptTime').innerfade({
			                        animationtype: 'fade',
			                        speed: 500,
			                        timeout: 3000,
			                        type: 'sequence',
			                        containerheight: '1em'
		                        });
		                     }
		                     else // domestic
		                     {
                                   $("#flDeptTime li").remove();
                                   $("ul#flDeptTime").append(response);
                                   $('#flDeptTime').innerfade({
			                        animationtype: 'fade',
			                        speed: 500,
			                        timeout: 3000,
			                        type: 'sequence',
			                        containerheight: '1em'
		                        });
		                     }  
			              
			            }
               }
            });          
		}
		function callFlInfoArrDep(mode,type)
		{		
            getFlInfoTime(mode,type);
           
		}
		
		
		// add search to cookie
		function findFlightAll(mode)
        {
        var stype;
        if(mode=='a')
        {
        flt_way="A";
            if(document.getElementById('flight1_rblArrFlType_0').checked)
             {
             stype=1;
             flt_type="I";
             }
            else
            {
             stype=2;
             flt_type="D";
             }     
             //sflno=$('#flight1_txtArrFlightNo').val();
             //sdest=$('#flight1_txtArrFlightFrom').val(); 
        }
        else
        {
        flt_way="D";
                if(document.getElementById('flight1_rblDepFlType_0').checked)
                {
                 stype=1;
                 flt_type="I";
                 }
                else
                {
                 stype=2;
                 flt_type="D";
                 }     
                 //sflno=$('#flight1_txtDepFlightNo').val();
                 //sdest=$('#flight1_txtDepFlightFrom').val(); 

        }    
            
        //location.href="liveflight-information.aspx?stype="+flt_type+"&smode="+flt_way+"&sflno="+sflno+"&sdest="+sdest;

        }
