function pnrsubmit()
{
        var pnr = document.ret_pnr.rloc.value;
        var pnrlen = document.ret_pnr.rloc.value.length;
         
         if (pnr == '')
                {
                        alert("Please Enter PNR to retrieve Itnirary");
                        document.ret_pnr.rloc.focus();
                        return false;   
                }
                
                if ((pnr != '') && (pnrlen < 6))
                
                {
                        alert("Please Enter 6 Digit PNR to retrieve Itnirary");
                        document.ret_pnr.rloc.focus();
                        return false;   
                }
                
                        
}


var formAlreadySubmitted = false;
function onDateChange(year, month, day, event)
        {
                var departing = parseDate(document.flights.dep_dt.value);
                var returning = parseDate(document.flights.ret_dt.value);
                if (departing > returning) {
                    document.flights.ret_dt.value = addDays(departing,7);
                 
                }
        }

                function depart_date_changed()
        {
            var departing = pick.dep_dt.valueAsDate();
            var returning = pick.ret_dt.valueAsDate();

            if (departing > returning) {
                var returnDateParts = addDays(departing,7);
                pick.dep_dt.setFromCanonical(returnDateParts);
                
            }
        }

      function clearHelpText(field) {
        if (field.value.length > 0 && field.value.indexOf(' start') == 0) {
            field.className = 'searchbox';
            field.value = '';
        }
      }

       function airportfocus(id,code,regioncode)
      {               
         d_d_air(id, code, regioncode, "air", 30, 180);
      }
      
      
       function airlinefocus(id,code)
      {               
         d_d_air(id, code, "airline", 30, 180);
      }


   function flightsubmit()
	
    {
	
	

        if (formAlreadySubmitted) {
            return false;
        }
       
       
    //   document.flights.origin.style.border="1px solid #c0c0c0";
		//	 document.flights.destination.style.border="1px solid #c0c0c0";
	     //document.flights.dep_date.style.border="1px solid #c0c0c0";
	     ///document.flights.ret_date.style.border="1px solid #c0c0c0";
	       
     
        
       var adutl=document.flights.travelers.value;
         var child=document.flights.travelerschd.value;
             var infant=document.flights.travelersinf.value;
			 
             adutl=parseInt(adutl,10);
         	 child=parseInt(child,10);
        	 infant=parseInt(infant,10);
       
             var total=adutl + child;

			var oneway = document.flights.oneway[1].checked;
	   
             
			
        if ((document.flights.origin.value.length < 1) || (document.flights.origin.value == "Please Enter Depart City or Airport")) 
        				
						
        		{
        		document.flights.origin.style.border="1px solid #FF0000";
            //alert("Please check and re-enter a valid \'Departure City\' or \'Airport Code\'.\n\nExample:\n For Los Angeles City Airport Code LAX\nFor New York City Airport Code JFK\n\nPlease Enter first 3 characters of City Name, Airport Name or Airport Code and Select from the List.");
            alert("Please Check and Provide a Valid \'Departure (Origin) City\' or \'Airport Code\'.\nEnter First 3 letters of the City, Airport name or Airport code than select from Drop-Down menu.\n\nExample: For Los Angeles City  Airport code is LAX");
            document.flights.origin.focus();
            return false;
        		}
            
       
            
            
            else if ((document.flights.destination.value.length < 1) || (document.flights.destination.value == "Please Enter Arrival City or Airport"))
            {
            document.flights.destination.style.border="1px solid #FF0000";
           	//alert("Please check and re-enter a valid \'Arrival City\' or \'Airport Code\'.\n\nExample:\n For Los Angeles City Airport Code LAX\nFor New York City Airport Code JFK\n\nPlease Enter first 3 characters of City Name, Airport Name or Airport Code and Select from the List.");
           	alert("Please Check and Provide a Valid \'Arrival (Destination) City\' or \'Airport Code\'.\nEnter First 3 letters of the City, Airport name or Airport code then select from Drop-Down menu.\n\nExample: For Atlanta City  Airport code is ATL");
            document.flights.destination.focus();
			
			
			
			
            return false;
            } 
            
           
            
    
        else if (document.flights.dep_date.value == '') 
        	{
        		document.flights.dep_date.style.border="1px solid #FF0000";
            alert("Please click on Calendar Select to the \'Departure Date\'");
            document.flights.dep_date.focus();
			chbg();
            return false;
        	} 
        
        else if (!oneway && document.flights.ret_date.value == '') 
        	
        	{
        		document.flights.ret_date.style.border="1px solid #FF0000";
            alert("Please click on Calander Select to the \'Return Date\'.\n\nIf you like to Purchase One Way Flight, Please select \'One  Way\' Option above and Proceed.");
            document.flights.ret_date.focus();
			chbg1();

            return false;
        	} 
        	
        else if (document.flights.origincode.value == document.flights.destcode.value)
        	{
        		document.flights.destination.style.border="1px solid #FF0000";
            alert("\'Departure City\' and \'Arrival City\' cannot be same, Please veriify and re-enter.");
            document.flights.destination.focus();
            return false;
        	}
        
        else if (document.flights.travelers.value == 0) {
            alert("Please Select number of Passengers Travelling from Drop-Down Menu.");
            document.flights.travelers.focus();
            return false;
            }
            
       else if (document.flights.origincode.value.length < 1)  {
						document.flights.origin.style.border="1px solid #FF0000";       	
            alert("Please Verify and Reenter Valid \'Deparure Airport\'.");
            document.flights.origin.focus();
            return false;
            }  
            
       else if (document.flights.destcode.value.length < 1) 
       			{      			
       			document.flights.destination.style.border="1px solid #FF0000";       	
            alert("Please Verify and Reenter Valid \'Arrival Airport\'.");
            document.flights.destination.focus();
            return false;
            }    
            
            
             
             
             else if (total>6)
    {
  
      alert ("We can Book maximum Six Seat including Children in one booking. \n\nIf you have more than Six Passengers Please make separate Booking.");
      document.flights.travelers.focus();
      return false;
     
    }
    
    
    else if (infant>adutl)
    {
  
      alert ( "Number of Infants can not be more than Number of Adults"  );
      document.flights.travelersinf.focus();
      return false;
    }
            
    else 
    {
    	document.getElementById('fdimgbutton').style.display = 'none';
      document.getElementById('fdimgbuttondown').style.display = 'inline';
    	var departing = null;
      var returning = null;
      formAlreadySubmitted = true;
	  load_pop_power();     
      return true;
           
    }

    }


