﻿function change1(DepFrom,DepTo) {
    //debugger;
    optiona = new Array("---------Select---------", "Agra", "Ahmedabad", "Ambala", "Amritsar", "Aurangabad", "Bareilly", "Barmer", "Baroda", "Belgaum", "Bhavnagar", "Bhopal", "Bhubneshwar", "Bidar", "Calicut", "Chandigarh", "Chennai", "Coimbatore", "Daman", "Delhi", "Goa", "Gorakhpur", "Guwahati", "Gwalior", "Hashimara", "Hyderabad", "Indore", "Jaipur", "Jaisalmer", "Jamnagar", "Jamshedpur", "Jodhpur", "Jorhat", "Khajuraho", "Kolkata", "Lucknow", "Mangalore", "Mithapur", "Mumbai", "Nagpur", "Ozar", "Panagarh", "Pathankot", "Pune", "Purnia", "Raipur", "Rajahmundry", "Ranchi", "Sirsa", "Tirupati", "Trichi", "Trivandrum", "Udaipur", "Udhampur", "Uttarlai", "Vijayawada", "Vizag");
    optionb = new Array("---------Select---------", "Agartala", "Agra", "Ahmedabad", "Amritsar", "Aurangabad", "Bangalore", "Bareilly", "Barmer", "Baroda", "Belgaum", "Bhavnagar", "Bhopal", "Bhubneshwar", "Bidar", "Calicut", "Chandigarh", "Coimbatore", "Daman", "Delhi", "Goa", "Gorakhpur", "Guwahati", "Gwalior", "Hyderabad", "Indore", "Jaipur", "Jaisalmer", "Jamnagar", "Jamshedpur", "Jodhpur", "Jorhat", "Khajuraho", "Kolkata", "Lucknow", "Mangalore", "Mumbai", "Nagpur", "Ozar", "Pune", "Raipur", "Rajahmundry", "Ranchi", "Tirupati", "Trichi", "Trivandrum", "Udaipur", "Uttarlai", "Vijayawada", "Vizag");
    optionc = new Array("---------Select---------", "Agra", "Ahmedabad", "Ambala", "Amritsar", "Aurangabad", "Bangalore", "Bareilly", "Barmer", "Baroda", "Belgaum", "Bhopal", "Bhubneshwar", "Bidar", "Calicut", "Chandigarh", "Chennai", "Coimbatore", "Fursatganj", "Goa", "Gorakhpur", "Guwahati", "Gwalior", "Hashimara", "Hyderabad", "Indore", "Jaipur", "Jaisalmer", "Jodhpur", "Jorhat", "Kathmandu", "Khajuraho", "Kolkata", "Lucknow", "Mangalore", "Mumbai", "Nagpur", "Panagarh", "Pathankot", "Purnia", "Raipur", "Rajahmundry", "Ranchi", "Sirsa", "Tirupati", "Trichi", "Trivandrum", "Udaipur", "Udhampur", "Uttarlai", "Vijayawada", "Vizag");
    optiond = new Array("---------Select---------", "Abu Dabhi", "Agra", "Ahmedabad", "Ambala", "Amman", "Amritsar", "Aurangabad", "Bali", "Bahrain", "Bangalore", "Bangkok", "Bareilly", "Baroda", "Barmer", "Beirut", "Belgaum", "Bhavnagar", "Bhopal", "Bhubneshwar", "Bidar", "Calicut", "Chandigarh", "Chennai", "Chittagong", "Coimbatore", "Columbo", "Daman", "Damscus", "Delhi", "Denpasar", "Dhakka", "Dhahran", "Doha", "Dubai", "Frankfurt", "Goa", "Gorakhpur", "Guwahati", "Gwalior", "Hashimara", "Hong Kong", "Hyderabad", "Indore", "Islamabad", "Jaipur", "Jaisalmer", "Jamnagar", "Jamshedpur", "Jeddah", "Jodhpur", "Jorhat", "Karachi", "Kathmandu", "Khajuraho", "Koh Samui", "Kolkata", "Kuala Lumpur", "Kuwait", "Lahore", "Larnaca", "London", "Lucknow", "Male", "Mandalay", "Mangalore", "Mithapur", "Moscow", "Muscat", "Nagpur", "Naples", "Ozar", "Panagarh", "Pathankot", "Patna", "Phuket", "Pune", "Purnia", "Raipur", "Rajahmundry", "Ranchi", "Riyadh", "Seychelles", "Sharjah", "Singapore", "Sirsa", "Tehran", "Tirupati", "Trichi", "Trivandrum", "Udaipur", "Udhampur", "Uttarlai", "Vijayawada", "Vizag", "Yangoon");
    optionh = new Array("---------Select---------", "Chennai", "Delhi", "Kolkata");


    init = 0;
    document.getElementById(DepTo).options.length = 0;


    if (document.getElementById(DepFrom).options[document.getElementById(DepFrom).selectedIndex].value == "Bengaluru (Bangalore)") {
        for (i = 0; i < optiona.length; i++) {
            document.getElementById(DepTo).options.length++;
            document.getElementById(DepTo).options[init].value = optiona[i];
            document.getElementById(DepTo).options[init].text = optiona[i];
            init = init + 1;
        }
        document.getElementById(DepTo).selectedIndex = 0;
    }


    else if (document.getElementById(DepFrom).options[document.getElementById(DepFrom).selectedIndex].value == "Chennai") {
        for (i = 0; i < optionb.length; i++) {
            document.getElementById(DepTo).options.length++;
            document.getElementById(DepTo).options[init].value = optionb[i];
            document.getElementById(DepTo).options[init].text = optionb[i];
            init = init + 1;
        }
        document.getElementById(DepTo).selectedIndex = 0;


    }

    else if (document.getElementById(DepFrom).options[document.getElementById(DepFrom).selectedIndex].value == "Delhi") {
        for (i = 0; i < optionc.length; i++) {
            document.getElementById(DepTo).options.length++;
            document.getElementById(DepTo).options[init].value = optionc[i];
            document.getElementById(DepTo).options[init].text = optionc[i];
            init = init + 1;
        }
        document.getElementById(DepTo).selectedIndex = 0;


    }
    else if (document.getElementById(DepFrom).options[document.getElementById(DepFrom).selectedIndex].value == "Mumbai") {
        for (i = 0; i < optiond.length; i++) {
            document.getElementById(DepTo).options.length++;
            document.getElementById(DepTo).options[init].value = optiond[i];
            document.getElementById(DepTo).options[init].text = optiond[i];
            init = init + 1;
        }
        document.getElementById(DepTo).selectedIndex = 0;



    }
    else if (document.getElementById(DepFrom).options[document.getElementById(DepFrom).selectedIndex].value == "Hyderabad") {
        for (i = 0; i < optionh.length; i++) {
            document.getElementById(DepTo).options.length++;
            document.getElementById(DepTo).options[init].value = optionh[i];
            document.getElementById(DepTo).options[init].text = optionh[i];
            init = init + 1;
        }
        document.getElementById(DepTo).selectedIndex = 0;

   }

    else {
        document.getElementById(DepTo).options[0] = new Option("-------Select---------", "0");

    }

}


function LoadTime1() {
    //debugger;
    Time = new Array("00:00","01:00", "02:00", "03:00", "04:00", "05:00", "06:00", "07:00", "08:00", "09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00", "24:00");
    for (var i = 0; i < Time.length; ++i) {

        addOption(document.form1.TimeList, Time[i], Time[i]);
        
    }
}
function addOption(selectbox, text, value) {
    var optn = document.getElementsByName(selectbox);
    optn.text = text;
    optn.value = value;
    selectbox.options.add(optn);
   
}

function LoadTime1(TimeList) {
    //debugger;
    
   // Time = new Array("-----------Select-----------","Bengaluru (Bangalore)","Chennai","Delhi", "Mumbai");
    init = 0;
    //var a = document.form1.TimeList.value;
    // alert(a);
    alert(document.getElementsByName(TimeList)[0]);
    var ss = document.getElementsByName("TimeList");
    alert(ss.length);
   // document.getElementsByName('TimeList')[0].options.length = 0;
    for (i = 0; i < Time.length; i++) {
        document.getElementsByName(TimeList)[0].options.length++;
        document.getElementsByName(TimeList)[0].options[init].value = Time[i];
        document.getElementsByName(TimeList)[0].options[init].text = Time[i];
        init = init + 1;
    }
    document.getElementsByName("ddlDepTime1").selectedIndex = 0;
}

/*Load Time Drop down*/

function LoadTime() {
    //debugger;
    Time = new Array("00:00", "01:00", "02:00", "03:00", "04:00", "05:00", "06:00", "07:00", "08:00", "09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00", "24:00");

    for (j = 1; j <= 5; j++) {
        init = 0;
        var num = j;
        document.getElementById("ddlDepTime" + num).options.length = 0;
        for (i = 0; i < Time.length; i++) {            
            document.getElementById("ddlDepTime"+num).options.length++;
            document.getElementById("ddlDepTime"+num).options[init].value = Time[i];
            document.getElementById("ddlDepTime"+num).options[init].text = Time[i];
            init = init + 1;            
        }
        document.getElementById("ddlDepTime" + num).selectedIndex = 0;
    }
    //LoadCountry();
    
    MainCountryLoad();
}

/*Load Country Drop down*/

function LoadCountry() {

    Country = new Array("-----------Select-----------", "Bengaluru (Bangalore)","Chennai", "Delhi", "Mumbai", "Hyderabad");

    for (j = 1; j <= 5; j++) {
        init = 0;
        var num = j;
        document.getElementById("ddlDeptFrom" + num).options.length = 0;
        for (i = 0; i < Country.length; i++) {
            document.getElementById("ddlDeptFrom" + num).options.length++;
            document.getElementById("ddlDeptFrom" + num).options[init].value = Country[i];
            document.getElementById("ddlDeptFrom" + num).options[init].text = Country[i];
            init = init + 1;
        }
        document.getElementById("ddlDeptFrom" + num).selectedIndex = 0;
    }
    
}


function MainCountryLoad() {
try
{
    MainCountry = new Array("-----------Select-----------", "Argentina", "Australia", "Austria", "bahrain", "Belgium", "Canada", "Chile", "Colombia", "Costa Rica", "Czech Republic", "Dominican Republic", "Ecuador", "Egypt", "France", "Germany", "Greece", "Guam", "Guatemala", "Honduras", "Hong Kong", "Hungary", "India", "Indonesia", "Italy", "Japan", "Korea", "Mexico", "Netherlands", "Pakistan", "Panama", "Paraguay", "Peru", "Philippines", "Poland", "Portugal", "Puerto Rico", "Romania", "Russia", "Saudi Arabia", "Singapore", "Slovakia", "South Africa", "Spain", "Switzerland", "Taiwan", "Thailand", "Trinidad", "Turkey", "United Arab Emirates", "United Kingdom", "United States", "Uruguay", "Venezuela", "Other");

init = 0;
document.getElementById("ddlCountry").options.length = 0;
for (i = 0; i < MainCountry.length; i++) {
    document.getElementById("ddlCountry").options.length++;
    document.getElementById("ddlCountry").options[init].value = MainCountry[i];
    document.getElementById("ddlCountry").options[init].text = MainCountry[i];
            init = init + 1;
        }
        document.getElementById("ddlCountry").selectedIndex = 0;
        LoadOneway();
        LoadReturn();
    }
    catch(exc) {
    
    }
}


    /********** Load Return ****************/

    function LoadReturn() {
        //debugger;
        Time = new Array("00:00", "01:00", "02:00", "03:00", "04:00", "05:00", "06:00", "07:00", "08:00", "09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00", "24:00");

        for (j = 1; j <= 2; j++) {
            init = 0;
            var num = j;
            document.getElementById("ddlRetDepTime" + num).options.length = 0;
            for (i = 0; i < Time.length; i++) {
                document.getElementById("ddlRetDepTime" + num).options.length++;
                document.getElementById("ddlRetDepTime" + num).options[init].value = Time[i];
                document.getElementById("ddlRetDepTime" + num).options[init].text = Time[i];
                init = init + 1;
            }
            document.getElementById("ddlRetDepTime" + num).selectedIndex = 0;
        }
        //LoadCountryRet();        
    }


    function LoadCountryRet() {

        Country = new Array("-----------Select-----------", "Bengaluru (Bangalore)", "Chennai", "Delhi", "Mumbai", "Hyderabad");

        
            init = 0;
            document.getElementById("ddlRetDepFrom").options.length = 0;
            for (i = 0; i < Country.length; i++)
             {
                 document.getElementById("ddlRetDepFrom").options.length++;
                 document.getElementById("ddlRetDepFrom").options[init].value = Country[i];
                 document.getElementById("ddlRetDepFrom").options[init].text = Country[i];
                init = init + 1;
            }
            document.getElementById("ddlRetDepFrom").selectedIndex = 0;
        }



        /********** Load Oneway ****************/
        function LoadOneway() {
            //debugger;
            Time = new Array("00:00", "01:00", "02:00", "03:00", "04:00", "05:00", "06:00", "07:00", "08:00", "09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00", "24:00");

           
                init = 0;

                document.getElementById("ddlOneDepTime").options.length = 0;
                for (i = 0; i < Time.length; i++) {
                    document.getElementById("ddlOneDepTime").options.length++;
                    document.getElementById("ddlOneDepTime").options[init].value = Time[i];
                    document.getElementById("ddlOneDepTime").options[init].text = Time[i];
                    init = init + 1;
                }
                document.getElementById("ddlOneDepTime").selectedIndex = 0;
            
            //LoadCountryOne();
        }

        function LoadCountryOne() {

            Country = new Array("-----------Select-----------", "Bengaluru (Bangalore)", "Chennai", "Delhi", "Mumbai", "Hyderabad");


            init = 0;
            document.getElementById("ddlOneDepFrom").options.length = 0;
            for (i = 0; i < Country.length; i++) {
                document.getElementById("ddlOneDepFrom").options.length++;
                document.getElementById("ddlOneDepFrom").options[init].value = Country[i];
                document.getElementById("ddlOneDepFrom").options[init].text = Country[i];
                init = init + 1;
            }
            document.getElementById("ddlOneDepFrom").selectedIndex = 0;
        }

                                        
