﻿
// redirects to radixx pages by passing querystring parameters

var booktype;
var PromoCode="WBDPOPR";
function redirect(booktype) {
    
    if (booktype == "home") {


        
        var origin = document.getElementById("cmbOriginHome").value;
        var destn = document.getElementById("cmbDestHome").value;
        
        var depday = document.getElementById("cmbdayout").value;
        var depmon = document.getElementById("cmbmonout").value.substring(2,0);
        var depyear = document.getElementById("cmbmonout").value.substring(2);
        
        var retday = document.getElementById("cmbdayret").value;
        var retmon = document.getElementById("cmbmonret").value.substring(2,0);
        var retyear = document.getElementById("cmbmonret").value.substring(2);
        
        var adults = document.getElementById("cmbAdults").value;
        var children = document.getElementById("cmbChild").value;
        var infants = document.getElementById("cmbInfants").value;
        var oneway = document.getElementById("oneway");
        var rndtrip = document.getElementById("rndtrip");
        //var byFlight = document.getElementById("byFlight");
        //var byBestFare = document.getElementById("byBestFare");

        if (oneway.checked == true) {
            var triptype = "rOneWay";
        }
        else if (rndtrip.checked == true) {
            triptype = "rRoundTrip";
        }

        var now_date = new Date();
        var day = now_date.getDate().toString();
        var month = now_date.getMonth()
        month = month + 1;
        var strday = day.toString();
        var strmonth = month.toString();
        var year = now_date.getFullYear().toString();

        if (strday.length == 1)
        strday = "0" + strday;
    
        if (strmonth.length == 1)
        strmonth = "0" + strmonth;


        if (origin == "" || destn == "" ) {

            alert("Invalid source or destination ");
            return;
        
        }
        
     
            if (depday < strday &&  depmon <= strmonth && depyear <= year   ) 

        {
        




           alert("Invalid date");
           return;
        
        
         }
         
         
         if (rndtrip.checked == true)
         
          {
          
          
              if ( retday < strday &&  retmon <= strmonth && retyear <= year) 
        {

           alert("Invalid date");
           return;
        
        
         }
                  if(retday < depday && retmon<depmon && retyear<depyear)
    {
        alert("Return date should not be less than Departure date");   //return date less than departure date
        return;
    }
        }

   


        
//        if (depmon < strmonth || depyear < year) 
//        {

//            alert("Invalid date");
//            return;
//        }

        
        if(adults == "0" && children == "0" && infants == "0")
        {
            alert("Invalid number of passengers.");
            return false;
        }
         var a="false";
        
        
        
        if(depday == 16 && depmon==08 && depyear==2011 || retday == 16 && retmon==08 && retyear==2011 )
        {
        
            if(triptype == "rOneWay")
                 {
                 if(origin=="BLR" && destn=="BOM" || origin=="BOM" && destn=="NDC" || origin=="COK" && destn=="BOM" || origin=="DEL" && destn=="IXB" || origin=="DEL" && destn=="IXC" || origin=="DEL" && destn=="PAT" || origin=="IXB" && destn=="GAU" || origin=="NAG" && destn=="NDC" || origin=="SXR" && destn=="IXJ" )
                 {
                 a="true"
                 }
        
             
                 }
                 
                   else
                 {
                 if(origin=="BLR" && destn=="BOM" || origin=="BOM" && destn=="NDC" || origin=="COK" && destn=="BOM" || origin=="DEL" && destn=="IXB" || origin=="DEL" && destn=="IXC" || origin=="DEL" && destn=="PAT" || origin=="IXB" && destn=="GAU" || origin=="NAG" && destn=="NDC" || origin=="SXR" && destn=="IXJ" )
                 {
                 a="true"
                 }
                if(destn=="BLR" && origin=="BOM" || destn=="BOM" && origin=="NDC" || destn=="COK" && origin=="BOM" || destn=="DEL" && origin=="IXB" || destn=="DEL" && origin=="IXC" || destn=="DEL" && origin=="PAT" || destn=="IXB" && origin=="GAU" || destn=="NAG" && origin=="NDC" || destn=="SXR" && origin=="IXJ" )
                 {
                 a="true"
                 }
             
                 }
                 
                 
        
        }
        
        //17 Aug 2011
        
          if(depday == 17 && depmon==08 && depyear==2011 || retday == 17 && retmon==08 && retyear==2011 )
        {
        
            if(triptype == "rOneWay")
                 {
                 if(origin=="AMD" && destn=="DEL" || origin=="BOM" && destn=="AMD" || origin=="BOM" && destn=="DEL" || origin=="BOM" && destn=="GOI" || origin=="BOM" && destn=="JAI" || origin=="DEL" && destn=="AMD" || origin=="DEL" && destn=="GAU" || origin=="DEL" && destn=="IXC" || origin=="DEL" && destn=="PAT" || origin=="DEL" && destn=="SXR" || origin=="GAU" && destn=="IXB" || origin=="IXC" && destn=="BOM"  || origin=="SXR" && destn=="IXJ")
                 {
                 a="true"
                 }
        
             
                 }
                 
                   else
                 {
                    if(origin=="AMD" && destn=="DEL" || origin=="BOM" && destn=="AMD" || origin=="BOM" && destn=="DEL" || origin=="BOM" && destn=="GOI" || origin=="BOM" && destn=="JAI" || origin=="DEL" && destn=="AMD" || origin=="DEL" && destn=="GAU" || origin=="DEL" && destn=="IXC" || origin=="DEL" && destn=="PAT" || origin=="DEL" && destn=="SXR" || origin=="GAU" && destn=="IXB" || origin=="IXC" && destn=="BOM"  || origin=="SXR" && destn=="IXJ")
                 {
                 a="true"
                 }
                   if(destn=="AMD" && origin=="DEL" || destn=="BOM" && origin=="AMD" || destn=="BOM" && origin=="DEL" || destn=="BOM" && origin=="GOI" || destn=="BOM" && origin=="JAI" || destn=="DEL" && origin=="AMD" || destn=="DEL" && origin=="GAU" || destn=="DEL" && origin=="IXC" || destn=="DEL" && origin=="PAT" || destn=="DEL" && origin=="SXR" || destn=="GAU" && origin=="IXB" || destn=="IXC" && origin=="BOM"  || destn=="SXR" && origin=="IXJ")
                 {
                 a="true"
                 }
             
                 }
                 
                 
        
        }
        
        
        
        //18Aug 2011
        
          if(depday == 18 && depmon==08 && depyear==2011 || retday == 18 && retmon==08 && retyear==2011 )
        {
        
            if(triptype == "rOneWay")
                 {
                 if(origin=="BLR" && destn=="BOM" || origin=="BLR" && destn=="DEL" || origin=="BOM" && destn=="AMD" || origin=="BOM" && destn=="DEL" || origin=="BOM" && destn=="NDC" || origin=="DEL" && destn=="BLR" || origin=="DEL" && destn=="BOM" || origin=="DEL" && destn=="IXB" || origin=="DEL" && destn=="IXC" || origin=="DEL" && destn=="LKO" || origin=="DEL" && destn=="NAG" || origin=="DEL" && destn=="PAT"  || origin=="GAU" && destn=="DEL" || origin=="IXB" && destn=="GAU" || origin=="IXC" && destn=="BOM"  || origin=="JAI" && destn=="BOM" || origin=="LKO" && destn=="DEL" || origin=="NAG" && destn=="DEL"  || origin=="NAG" && destn=="NDC" || origin=="NDC" && destn=="BOM" || origin=="NDC" && destn=="NAG"  || origin=="PAT" && destn=="DEL"  || origin=="SXR" && destn=="IXJ")
                 {
                 a="true"
                 }
        
             
                 }
                 
                   else
                 {
                   if(origin=="BLR" && destn=="BOM" || origin=="BLR" && destn=="DEL" || origin=="BOM" && destn=="AMD" || origin=="BOM" && destn=="DEL" || origin=="BOM" && destn=="NDC" || origin=="DEL" && destn=="BLR" || origin=="DEL" && destn=="BOM" || origin=="DEL" && destn=="IXB" || origin=="DEL" && destn=="IXC" || origin=="DEL" && destn=="LKO" || origin=="DEL" && destn=="NAG" || origin=="DEL" && destn=="PAT"  || origin=="GAU" && destn=="DEL" || origin=="IXB" && destn=="GAU" || origin=="IXC" && destn=="BOM"  || origin=="JAI" && destn=="BOM" || origin=="LKO" && destn=="DEL" || origin=="NAG" && destn=="DEL"  || origin=="NAG" && destn=="NDC" || origin=="NDC" && destn=="BOM" || origin=="NDC" && destn=="NAG"  || origin=="PAT" && destn=="DEL"  || origin=="SXR" && destn=="IXJ")
                 {
                 a="true"
                 }
                   if(destn=="BLR" && origin=="BOM" || destn=="BLR" && origin=="DEL" || destn=="BOM" && origin=="AMD" || destn=="BOM" && origin=="DEL" || destn=="BOM" && origin=="NDC" || destn=="DEL" && origin=="BLR" || destn=="DEL" && origin=="BOM" || destn=="DEL" && origin=="IXB" || destn=="DEL" && origin=="IXC" || destn=="DEL" && origin=="LKO" || destn=="DEL" && origin=="NAG" || destn=="DEL" && origin=="PAT"  || destn=="GAU" && origin=="DEL" || destn=="IXB" && origin=="GAU" || destn=="IXC" && origin=="BOM"  || destn=="JAI" && origin=="BOM" || destn=="LKO" && origin=="DEL" || destn=="NAG" && origin=="DEL"  || destn=="NAG" && origin=="NDC" || destn=="NDC" && origin=="BOM" || destn=="NDC" && origin=="NAG"  || destn=="PAT" && origin=="DEL"  || destn=="SXR" && origin=="IXJ")
                 {
                 a="true"
                 }
             
                 }
                 
                 
        
        }
        
        
        
         
        //19Aug 2011
        
          if(depday == 19 && depmon==08 && depyear==2011 || retday == 19 && retmon==08 && retyear==2011 )
        {
        
            if(triptype == "rOneWay")
                 {
                 if(origin=="BLR" && destn=="PNQ" || origin=="BOM" && destn=="AMD" || origin=="DEL" && destn=="AMD" || origin=="DEL" && destn=="GAU" || origin=="DEL" && destn=="IXC" || origin=="DEL" && destn=="LKO" || origin=="DEL" && destn=="PAT" || origin=="GAU" && destn=="IXB" || origin=="GOI" && destn=="BOM" || origin=="IXB" && destn=="DEL" || origin=="IXC" && destn=="BOM" || origin=="JAI" && destn=="BOM"  || origin=="LKO" && destn=="DEL" || origin=="PAT" && destn=="DEL" || origin=="PNQ" && destn=="BLR"  || origin=="SXR" && destn=="DEL" || origin=="SXR" && destn=="IXJ" )
                 {
                 a="true"
                 }
        
             
                 }
                 
                   else
                 {
                     if(origin=="BLR" && destn=="PNQ" || origin=="BOM" && destn=="AMD" || origin=="DEL" && destn=="AMD" || origin=="DEL" && destn=="GAU" || origin=="DEL" && destn=="IXC" || origin=="DEL" && destn=="LKO" || origin=="DEL" && destn=="PAT" || origin=="GAU" && destn=="IXB" || origin=="GOI" && destn=="BOM" || origin=="IXB" && destn=="DEL" || origin=="IXC" && destn=="BOM" || origin=="JAI" && destn=="BOM"  || origin=="LKO" && destn=="DEL" || origin=="PAT" && destn=="DEL" || origin=="PNQ" && destn=="BLR"  || origin=="SXR" && destn=="DEL" || origin=="SXR" && destn=="IXJ" )
                 {
                 a="true"
                 }
                    if(destn=="BLR" && origin=="PNQ" || destn=="BOM" && origin=="AMD" || destn=="DEL" && origin=="AMD" || destn=="DEL" && origin=="GAU" || destn=="DEL" && origin=="IXC" || destn=="DEL" && origin=="LKO" || destn=="DEL" && origin=="PAT" || destn=="GAU" && origin=="IXB" || destn=="GOI" && origin=="BOM" || destn=="IXB" && origin=="DEL" || destn=="IXC" && origin=="BOM" || destn=="JAI" && origin=="BOM"  || destn=="LKO" && origin=="DEL" || destn=="PAT" && origin=="DEL" || destn=="PNQ" && origin=="BLR"  || destn=="SXR" && origin=="DEL" || destn=="SXR" && origin=="IXJ" )
                 {
                 a="true"
                 }
             
                 }
                 
                 
        
        }
        
        
           //20Aug 2011
        
          if(depday == 20 && depmon==08 && depyear==2011 || retday == 20 && retmon==08 && retyear==2011 )
        {
        
            if(triptype == "rOneWay")
                 {
                 if(origin=="AMD" && destn=="BOM" || origin=="AMD" && destn=="DEL" || origin=="BLR" && destn=="DEL" || origin=="BOM" && destn=="AMD" || origin=="BOM" && destn=="DEL" || origin=="BOM" && destn=="JAI" || origin=="DEL" && destn=="AMD" || origin=="DEL" && destn=="BLR" || origin=="DEL" && destn=="BOM" || origin=="DEL" && destn=="IXC" || origin=="DEL" && destn=="LKO" || origin=="DEL" && destn=="PAT"  || origin=="GAU" && destn=="DEL" || origin=="IXB" && destn=="GAU" || origin=="IXJ" && destn=="SXR"  || origin=="LKO" && destn=="DEL" || origin=="PAT" && destn=="DEL" || origin=="PNQ" && destn=="DEL" || origin=="SXR" && destn=="IXJ" )
                 {
                 a="true"
                 }
        
             
                 }
                 
                   else
                 {
                         if(origin=="AMD" && destn=="BOM" || origin=="AMD" && destn=="DEL" || origin=="BLR" && destn=="DEL" || origin=="BOM" && destn=="AMD" || origin=="BOM" && destn=="DEL" || origin=="BOM" && destn=="JAI" || origin=="DEL" && destn=="AMD" || origin=="DEL" && destn=="BLR" || origin=="DEL" && destn=="BOM" || origin=="DEL" && destn=="IXC" || origin=="DEL" && destn=="LKO" || origin=="DEL" && destn=="PAT"  || origin=="GAU" && destn=="DEL" || origin=="IXB" && destn=="GAU" || origin=="IXJ" && destn=="SXR"  || origin=="LKO" && destn=="DEL" || origin=="PAT" && destn=="DEL" || origin=="PNQ" && destn=="DEL" || origin=="SXR" && destn=="IXJ" )
                 {
                 a="true"
                 }
                        if(destn=="AMD" && origin=="BOM" || destn=="AMD" && origin=="DEL" || destn=="BLR" && origin=="DEL" || destn=="BOM" && origin=="AMD" || destn=="BOM" && origin=="DEL" || destn=="BOM" && origin=="JAI" || destn=="DEL" && origin=="AMD" || destn=="DEL" && origin=="BLR" || destn=="DEL" && origin=="BOM" || destn=="DEL" && origin=="IXC" || destn=="DEL" && origin=="LKO" || destn=="DEL" && origin=="PAT"  || destn=="GAU" && origin=="DEL" || destn=="IXB" && origin=="GAU" || destn=="IXJ" && origin=="SXR"  || destn=="LKO" && origin=="DEL" || destn=="PAT" && origin=="DEL" || destn=="PNQ" && origin=="DEL" || destn=="SXR" && origin=="IXJ" )
                 {
                 a="true"
                 }
             
                 }
                 
                 
        
        }
        
        
        
        
        if( a=="true")
        {
          window.location = "http://goair.booksecure.net/avail.aspx?triptype=" + triptype + "&origin=" + origin + "&dest=" + destn + "&depday=" + depday + "&depmon=" + depmon + "&depyear=" + depyear + "&retday=" + retday + "&retmon=" + retmon + "&retyear=" + retyear + "&adults=" + adults + "&Children=" + children + "&infants=" + infants + "&PromoCode="+PromoCode+"&seniors=0&subwebfaretype=1&isavailforpackages=False";
        }
        else
        {
        
        window.location = "http://goair.booksecure.net/avail.aspx?triptype=" + triptype + "&origin=" + origin + "&dest=" + destn + "&depday=" + depday + "&depmon=" + depmon + "&depyear=" + depyear + "&retday=" + retday + "&retmon=" + retmon + "&retyear=" + retyear + "&adults=" + adults + "&Children=" + children + "&infants=" + infants + "&seniors=0&subwebfaretype=1&isavailforpackages=False";
        
        }
        
         
//        if (byFlight.checked == true) {

            // Redirection URL changed on 03/03/2011
         //   window.location = "http://goair.booksecure.net/avail.aspx?triptype=" + triptype + "&origin=" + origin + "&dest=" + destn + "&depday=" + depday + "&depmon=" + depmon + "&depyear=" + depyear + "&retday=" + retday + "&retmon=" + retmon + "&retyear=" + retyear + "&adults=" + adults + "&Children=" + children + "&infants=" + infants + "&seniors=0&subwebfaretype=1&isavailforpackages=False";

//            return false;
//        }

//        else if (byBestFare.checked == true) {
//        window.location = "http://uat.radixx.com/goair/webshopper.aspx?triptype=" + triptype + "&origin=" + origin + "&dest=" + destn + "&depday=" + depday + "&depmon=" + depmon + "&depyear=" + depyear + "&retday=" + retday + "&retmon=" + retmon + "&retyear=" + retyear + "&adults=" + adults + "&Children=" + children + "&infants=" + infants + "&seniors=0&subwebfaretype=1";

//            return false;
//        }
    }

    if (booktype == "minibook") {

        var origin = document.getElementById("cmbOriginHome").value;
        var destn = document.getElementById("cmbDestHome").value;

        var depday = document.getElementById("cmbdayout").value;
        var depmon = document.getElementById("cmbmonout").value.substring(2,0);
        var depyear = document.getElementById("cmbmonout").value.substring(2);

        var retday = document.getElementById("cmbdayret").value;
        var retmon = document.getElementById("cmbmonret").value.substring(2,0);
        var retyear = document.getElementById("cmbmonret").value.substring(2);

        var adults = document.getElementById("cmbAdults").value;
        var children = document.getElementById("cmbChild").value;
        var infants = document.getElementById("cmbInfants").value;
        
        var oneway = document.getElementById("oneway");
        var rndtrip = document.getElementById("rndtrip");

        if (oneway.checked == true) {
            var triptype = "rOneWay";
        }
        else if (rndtrip.checked == true) {
        triptype = "rRoundTrip";
        }


        var now_date = new Date();
        var day = now_date.getDate().toString();
        var month = now_date.getMonth()
        month = month + 1;
        var strday = day.toString();
        var strmonth = month.toString();
        var year = now_date.getFullYear().toString();

        if (strday.length == 1)
            strday = "0" + strday;

        if (strmonth.length == 1)
            strmonth = "0" + strmonth;


        if (origin == "" || destn == "") {

            alert("Invalid source or destination ");
            return;

        }
        
        
           if (depday < strday &&  depmon <= strmonth && depyear <= year   ) 
        {

           alert("Invalid date");
           return;
        
        
         }
         
         
         if (rndtrip.checked == true)
         
          {
          
          
              if ( retday < strday &&  retmon <= strmonth && retyear <= year) 
        {

           alert("Invalid date");
           return;
        
        
         }
                     if(retday < depday && retmon<depmon && retyear<depyear)
    {
        alert("Return date should not be less than Departure date");   //return date less than departure date
        return;
    }
        }




//        if (depmon < strmonth || depyear < year) 
//        {

//            alert("Invalid date");
//            return;
//        }
        
         if(adults == "0" && children == "0" && infants == "0")
        {
            alert("Invalid number of passengers.");
            return false;
        }
        


        // Redirection URL changed on 03/03/2011
        var a="false";
        
        
        
        if(depday == 16 && depmon==08 && depyear==2011 || retday == 16 && retmon==08 && retyear==2011 )
        {
        
            if(triptype == "rOneWay")
                 {
                 if(origin=="BLR" && destn=="BOM" || origin=="BOM" && destn=="NDC" || origin=="COK" && destn=="BOM" || origin=="DEL" && destn=="IXB" || origin=="DEL" && destn=="IXC" || origin=="DEL" && destn=="PAT" || origin=="IXB" && destn=="GAU" || origin=="NAG" && destn=="NDC" || origin=="SXR" && destn=="IXJ" )
                 {
                 a="true"
                 }
        
             
                 }
                 
                   else
                 {
                 if(origin=="BLR" && destn=="BOM" || origin=="BOM" && destn=="NDC" || origin=="COK" && destn=="BOM" || origin=="DEL" && destn=="IXB" || origin=="DEL" && destn=="IXC" || origin=="DEL" && destn=="PAT" || origin=="IXB" && destn=="GAU" || origin=="NAG" && destn=="NDC" || origin=="SXR" && destn=="IXJ" )
                 {
                 a="true"
                 }
                if(destn=="BLR" && origin=="BOM" || destn=="BOM" && origin=="NDC" || destn=="COK" && origin=="BOM" || destn=="DEL" && origin=="IXB" || destn=="DEL" && origin=="IXC" || destn=="DEL" && origin=="PAT" || destn=="IXB" && origin=="GAU" || destn=="NAG" && origin=="NDC" || destn=="SXR" && origin=="IXJ" )
                 {
                 a="true"
                 }
             
                 }
                 
                 
        
        }
        
        //17 Aug 2011
        
          if(depday == 17 && depmon==08 && depyear==2011 || retday == 17 && retmon==08 && retyear==2011 )
        {
        
            if(triptype == "rOneWay")
                 {
                 if(origin=="AMD" && destn=="DEL" || origin=="BOM" && destn=="AMD" || origin=="BOM" && destn=="DEL" || origin=="BOM" && destn=="GOI" || origin=="BOM" && destn=="JAI" || origin=="DEL" && destn=="AMD" || origin=="DEL" && destn=="GAU" || origin=="DEL" && destn=="IXC" || origin=="DEL" && destn=="PAT" || origin=="DEL" && destn=="SXR" || origin=="GAU" && destn=="IXB" || origin=="IXC" && destn=="BOM"  || origin=="SXR" && destn=="IXJ")
                 {
                 a="true"
                 }
        
             
                 }
                 
                   else
                 {
                    if(origin=="AMD" && destn=="DEL" || origin=="BOM" && destn=="AMD" || origin=="BOM" && destn=="DEL" || origin=="BOM" && destn=="GOI" || origin=="BOM" && destn=="JAI" || origin=="DEL" && destn=="AMD" || origin=="DEL" && destn=="GAU" || origin=="DEL" && destn=="IXC" || origin=="DEL" && destn=="PAT" || origin=="DEL" && destn=="SXR" || origin=="GAU" && destn=="IXB" || origin=="IXC" && destn=="BOM"  || origin=="SXR" && destn=="IXJ")
                 {
                 a="true"
                 }
                   if(destn=="AMD" && origin=="DEL" || destn=="BOM" && origin=="AMD" || destn=="BOM" && origin=="DEL" || destn=="BOM" && origin=="GOI" || destn=="BOM" && origin=="JAI" || destn=="DEL" && origin=="AMD" || destn=="DEL" && origin=="GAU" || destn=="DEL" && origin=="IXC" || destn=="DEL" && origin=="PAT" || destn=="DEL" && origin=="SXR" || destn=="GAU" && origin=="IXB" || destn=="IXC" && origin=="BOM"  || destn=="SXR" && origin=="IXJ")
                 {
                 a="true"
                 }
             
                 }
                 
                 
        
        }
        
        
        
        //18Aug 2011
        
          if(depday == 18 && depmon==08 && depyear==2011 || retday == 18 && retmon==08 && retyear==2011 )
        {
        
            if(triptype == "rOneWay")
                 {
                 if(origin=="BLR" && destn=="BOM" || origin=="BLR" && destn=="DEL" || origin=="BOM" && destn=="AMD" || origin=="BOM" && destn=="DEL" || origin=="BOM" && destn=="NDC" || origin=="DEL" && destn=="BLR" || origin=="DEL" && destn=="BOM" || origin=="DEL" && destn=="IXB" || origin=="DEL" && destn=="IXC" || origin=="DEL" && destn=="LKO" || origin=="DEL" && destn=="NAG" || origin=="DEL" && destn=="PAT"  || origin=="GAU" && destn=="DEL" || origin=="IXB" && destn=="GAU" || origin=="IXC" && destn=="BOM"  || origin=="JAI" && destn=="BOM" || origin=="LKO" && destn=="DEL" || origin=="NAG" && destn=="DEL"  || origin=="NAG" && destn=="NDC" || origin=="NDC" && destn=="BOM" || origin=="NDC" && destn=="NAG"  || origin=="PAT" && destn=="DEL"  || origin=="SXR" && destn=="IXJ")
                 {
                 a="true"
                 }
        
             
                 }
                 
                   else
                 {
                   if(origin=="BLR" && destn=="BOM" || origin=="BLR" && destn=="DEL" || origin=="BOM" && destn=="AMD" || origin=="BOM" && destn=="DEL" || origin=="BOM" && destn=="NDC" || origin=="DEL" && destn=="BLR" || origin=="DEL" && destn=="BOM" || origin=="DEL" && destn=="IXB" || origin=="DEL" && destn=="IXC" || origin=="DEL" && destn=="LKO" || origin=="DEL" && destn=="NAG" || origin=="DEL" && destn=="PAT"  || origin=="GAU" && destn=="DEL" || origin=="IXB" && destn=="GAU" || origin=="IXC" && destn=="BOM"  || origin=="JAI" && destn=="BOM" || origin=="LKO" && destn=="DEL" || origin=="NAG" && destn=="DEL"  || origin=="NAG" && destn=="NDC" || origin=="NDC" && destn=="BOM" || origin=="NDC" && destn=="NAG"  || origin=="PAT" && destn=="DEL"  || origin=="SXR" && destn=="IXJ")
                 {
                 a="true"
                 }
                   if(destn=="BLR" && origin=="BOM" || destn=="BLR" && origin=="DEL" || destn=="BOM" && origin=="AMD" || destn=="BOM" && origin=="DEL" || destn=="BOM" && origin=="NDC" || destn=="DEL" && origin=="BLR" || destn=="DEL" && origin=="BOM" || destn=="DEL" && origin=="IXB" || destn=="DEL" && origin=="IXC" || destn=="DEL" && origin=="LKO" || destn=="DEL" && origin=="NAG" || destn=="DEL" && origin=="PAT"  || destn=="GAU" && origin=="DEL" || destn=="IXB" && origin=="GAU" || destn=="IXC" && origin=="BOM"  || destn=="JAI" && origin=="BOM" || destn=="LKO" && origin=="DEL" || destn=="NAG" && origin=="DEL"  || destn=="NAG" && origin=="NDC" || destn=="NDC" && origin=="BOM" || destn=="NDC" && origin=="NAG"  || destn=="PAT" && origin=="DEL"  || destn=="SXR" && origin=="IXJ")
                 {
                 a="true"
                 }
             
                 }
                 
                 
        
        }
        
        
        
         
        //19Aug 2011
        
          if(depday == 19 && depmon==08 && depyear==2011 || retday == 19 && retmon==08 && retyear==2011 )
        {
        
            if(triptype == "rOneWay")
                 {
                 if(origin=="BLR" && destn=="PNQ" || origin=="BOM" && destn=="AMD" || origin=="DEL" && destn=="AMD" || origin=="DEL" && destn=="GAU" || origin=="DEL" && destn=="IXC" || origin=="DEL" && destn=="LKO" || origin=="DEL" && destn=="PAT" || origin=="GAU" && destn=="IXB" || origin=="GOI" && destn=="BOM" || origin=="IXB" && destn=="DEL" || origin=="IXC" && destn=="BOM" || origin=="JAI" && destn=="BOM"  || origin=="LKO" && destn=="DEL" || origin=="PAT" && destn=="DEL" || origin=="PNQ" && destn=="BLR"  || origin=="SXR" && destn=="DEL" || origin=="SXR" && destn=="IXJ" )
                 {
                 a="true"
                 }
        
             
                 }
                 
                   else
                 {
                     if(origin=="BLR" && destn=="PNQ" || origin=="BOM" && destn=="AMD" || origin=="DEL" && destn=="AMD" || origin=="DEL" && destn=="GAU" || origin=="DEL" && destn=="IXC" || origin=="DEL" && destn=="LKO" || origin=="DEL" && destn=="PAT" || origin=="GAU" && destn=="IXB" || origin=="GOI" && destn=="BOM" || origin=="IXB" && destn=="DEL" || origin=="IXC" && destn=="BOM" || origin=="JAI" && destn=="BOM"  || origin=="LKO" && destn=="DEL" || origin=="PAT" && destn=="DEL" || origin=="PNQ" && destn=="BLR"  || origin=="SXR" && destn=="DEL" || origin=="SXR" && destn=="IXJ" )
                 {
                 a="true"
                 }
                    if(destn=="BLR" && origin=="PNQ" || destn=="BOM" && origin=="AMD" || destn=="DEL" && origin=="AMD" || destn=="DEL" && origin=="GAU" || destn=="DEL" && origin=="IXC" || destn=="DEL" && origin=="LKO" || destn=="DEL" && origin=="PAT" || destn=="GAU" && origin=="IXB" || destn=="GOI" && origin=="BOM" || destn=="IXB" && origin=="DEL" || destn=="IXC" && origin=="BOM" || destn=="JAI" && origin=="BOM"  || destn=="LKO" && origin=="DEL" || destn=="PAT" && origin=="DEL" || destn=="PNQ" && origin=="BLR"  || destn=="SXR" && origin=="DEL" || destn=="SXR" && origin=="IXJ" )
                 {
                 a="true"
                 }
             
                 }
                 
                 
        
        }
        
        
           //20Aug 2011
        
          if(depday == 20 && depmon==08 && depyear==2011 || retday == 20 && retmon==08 && retyear==2011 )
        {
        
            if(triptype == "rOneWay")
                 {
                 if(origin=="AMD" && destn=="BOM" || origin=="AMD" && destn=="DEL" || origin=="BLR" && destn=="DEL" || origin=="BOM" && destn=="AMD" || origin=="BOM" && destn=="DEL" || origin=="BOM" && destn=="JAI" || origin=="DEL" && destn=="AMD" || origin=="DEL" && destn=="BLR" || origin=="DEL" && destn=="BOM" || origin=="DEL" && destn=="IXC" || origin=="DEL" && destn=="LKO" || origin=="DEL" && destn=="PAT"  || origin=="GAU" && destn=="DEL" || origin=="IXB" && destn=="GAU" || origin=="IXJ" && destn=="SXR"  || origin=="LKO" && destn=="DEL" || origin=="PAT" && destn=="DEL" || origin=="PNQ" && destn=="DEL" || origin=="SXR" && destn=="IXJ" )
                 {
                 a="true"
                 }
        
             
                 }
                 
                   else
                 {
                         if(origin=="AMD" && destn=="BOM" || origin=="AMD" && destn=="DEL" || origin=="BLR" && destn=="DEL" || origin=="BOM" && destn=="AMD" || origin=="BOM" && destn=="DEL" || origin=="BOM" && destn=="JAI" || origin=="DEL" && destn=="AMD" || origin=="DEL" && destn=="BLR" || origin=="DEL" && destn=="BOM" || origin=="DEL" && destn=="IXC" || origin=="DEL" && destn=="LKO" || origin=="DEL" && destn=="PAT"  || origin=="GAU" && destn=="DEL" || origin=="IXB" && destn=="GAU" || origin=="IXJ" && destn=="SXR"  || origin=="LKO" && destn=="DEL" || origin=="PAT" && destn=="DEL" || origin=="PNQ" && destn=="DEL" || origin=="SXR" && destn=="IXJ" )
                 {
                 a="true"
                 }
                        if(destn=="AMD" && origin=="BOM" || destn=="AMD" && origin=="DEL" || destn=="BLR" && origin=="DEL" || destn=="BOM" && origin=="AMD" || destn=="BOM" && origin=="DEL" || destn=="BOM" && origin=="JAI" || destn=="DEL" && origin=="AMD" || destn=="DEL" && origin=="BLR" || destn=="DEL" && origin=="BOM" || destn=="DEL" && origin=="IXC" || destn=="DEL" && origin=="LKO" || destn=="DEL" && origin=="PAT"  || destn=="GAU" && origin=="DEL" || destn=="IXB" && origin=="GAU" || destn=="IXJ" && origin=="SXR"  || destn=="LKO" && origin=="DEL" || destn=="PAT" && origin=="DEL" || destn=="PNQ" && origin=="DEL" || destn=="SXR" && origin=="IXJ" )
                 {
                 a="true"
                 }
             
                 }
                 
                 
        
        }
        
        
        
        
        if( a=="true")
        {
          window.location = "http://goair.booksecure.net/avail.aspx?triptype=" + triptype + "&origin=" + origin + "&dest=" + destn + "&depday=" + depday + "&depmon=" + depmon + "&depyear=" + depyear + "&retday=" + retday + "&retmon=" + retmon + "&retyear=" + retyear + "&adults=" + adults + "&Children=" + children + "&infants=" + infants + "&PromoCode="+PromoCode+"&seniors=0&subwebfaretype=1&isavailforpackages=False";
        }
        else
        {
        
        window.location = "http://goair.booksecure.net/avail.aspx?triptype=" + triptype + "&origin=" + origin + "&dest=" + destn + "&depday=" + depday + "&depmon=" + depmon + "&depyear=" + depyear + "&retday=" + retday + "&retmon=" + retmon + "&retyear=" + retyear + "&adults=" + adults + "&Children=" + children + "&infants=" + infants + "&seniors=0&subwebfaretype=1&isavailforpackages=False";
        
        }
        
        
        
        

        return false;
        
    }

    if (booktype == "criteria") {

        
        var origin = document.getElementById("cmbOriginHome").value;
        var destn = document.getElementById("cmbDestHome").value;
        
        var depday = document.getElementById("cmbdayout").value;
        var depmon = document.getElementById("cmbmonout").value.substring(2,0);
        var depyear = document.getElementById("cmbmonout").value.substring(2);
        
        var retday = document.getElementById("cmbdayret").value;
        var retmon = document.getElementById("cmbmonret").value.substring(2,0);
        var retyear = document.getElementById("cmbmonret").value.substring(2);
        
        var adults = document.getElementById("cmbAdults").value;
        var children = document.getElementById("cmbChild").value;
        var infants = document.getElementById("cmbInfants").value;
        
        var oneway = document.getElementById("oneway");
        var rndtrip = document.getElementById("rndtrip");

        if (oneway.checked == true) {
            var triptype = "rOneWay";
        }
        else if (rndtrip.checked == true) {
            triptype = "rRoundTrip";
        }


        var now_date = new Date();
        var day = now_date.getDate().toString();
        var month = now_date.getMonth()
        month = month + 1;
        var strday = day.toString();
        var strmonth = month.toString();
        var year = now_date.getFullYear().toString();

        if (strday.length == 1)
            strday = "0" + strday;

        if (strmonth.length == 1)
            strmonth = "0" + strmonth;


        if (origin == "" || destn == "") {

            alert("Invalid source or destination ");
            return;

        }
        
        
           if (depday < strday &&  depmon <= strmonth && depyear <= year   ) 
        {

           alert("Invalid date");
           return;
        
        
         }
         
         
         if (rndtrip.checked == true)
         
          {
          
          
              if ( retday < strday &&  retmon <= strmonth && retyear <= year) 
        {

           alert("Invalid date");
           return;
        
        
         }
                     if(retday < depday && retmon<depmon && retyear<depyear)
    {
        alert("Return date should not be less than Departure date");   //return date less than departure date
        return;
    }
        }


//        if (depmon < strmonth || depyear < year) {

//            alert("Invalid date");
//            return;
//        }
        
         if(adults == "0" && children == "0" && infants == "0")
        {
            alert("Invalid number of passengers.");
            return false;
        }
        

        // Redirection URL changed on 03/03/2011
        window.location = "http://goair.booksecure.net/webshopper.aspx?triptype=" + triptype + "&origin=" + origin + "&dest=" + destn + "&depday=" + depday + "&depmon=" + depmon + "&depyear=" + depyear + "&retday=" + retday + "&retmon=" + retmon + "&retyear=" + retyear + "&adults=" + adults + "&Children=" + children + "&infants=" + infants + "&seniors=0&subwebfaretype=1";

        return false;
    }
    
    
    
     if (booktype == "bestfarescriteria") {

        
        
 
            
            
        
          
            
            
            
        var origin = document.getElementById("cmbOriginHome").value;
        var destn = document.getElementById("cmbDestHome").value;
        
        var depday = document.getElementById("cmbdayout").value;
        var depmon = document.getElementById("cmbmonout").value.substring(2,0);
        var depyear = document.getElementById("cmbmonout").value.substring(2);
        
        var retday = document.getElementById("cmbdayret").value;
        var retmon = document.getElementById("cmbmonret").value.substring(2,0);
        var retyear = document.getElementById("cmbmonret").value.substring(2);
        
        var adults = document.getElementById("cmbAdults").value;
        var children = document.getElementById("cmbChild").value;
        var infants = document.getElementById("cmbInfants").value;
        
        var oneway = document.getElementById("oneway");
        var rndtrip = document.getElementById("rndtrip");

        if (oneway.checked == true) {
            var triptype = "rOneWay";
        }
        else if (rndtrip.checked == true) {
            triptype = "rRoundTrip";
        }


        var now_date = new Date();
        var day = now_date.getDate().toString();
        var month = now_date.getMonth()
        month = month + 1;
        var strday = day.toString();
        var strmonth = month.toString();
        var year = now_date.getFullYear().toString();

        if (strday.length == 1)
            strday = "0" + strday;

        if (strmonth.length == 1)
            strmonth = "0" + strmonth;


        if (origin == "" || destn == "") {

            alert("Invalid source or destination ");
            return;

        }
        
        
           if (depday < strday &&  depmon <= strmonth && depyear <= year   ) 
        {

           alert("Invalid date");
           return;
        
        
         }
         
         
         if (rndtrip.checked == true)
         
          {
          
          
              if ( retday < strday &&  retmon <= strmonth && retyear <= year) 
        {

           alert("Invalid date");
           return;
        
        
         }
                     if(retday < depday && retmon<depmon && retyear<depyear)
    {
        alert("Return date should not be less than Departure date");   //return date less than departure date
        return;
    }
        }


//        if (depmon < strmonth || depyear < year) {

//            alert("Invalid date");
//            return;
//        }
        
         if(adults == "0" && children == "0" && infants == "0")
        {
            alert("Invalid number of passengers.");
            return false;
        }
        

        // Redirection URL changed on 03/03/2011
        window.location = "http://goair.booksecure.net/webshopper.aspx?triptype=" + triptype + "&origin=" + origin + "&dest=" + destn + "&depday=" + depday + "&depmon=" + depmon + "&depyear=" + depyear + "&retday=" + retday + "&retmon=" + retmon + "&retyear=" + retyear + "&adults=" + adults + "&Children=" + children + "&infants=" + infants + "&seniors=0&subwebfaretype=2";

    
    
    
        return false;
    }
    
    
}

