﻿
// fills destination dropdown based on origin dropdown selection

var option;
var Origin;
var Dest;
var type;
var criteria;

function fillDestinations(type,criteria) {
//-------------------- for runtime increse size of combo ie6 settings
    if (criteria == 'grow') {
        var appver = window.navigator.appVersion;
        var myRegExp = /MSIE 6.0/;

        var matchPos1 = appver.search(myRegExp);

        if (matchPos1 != -1) {

            document.getElementById("cmbOriginHome").style.position = "static";
            document.getElementById("cmbOriginHome").style.width = "90px";
            document.getElementById("cmbDestHome").style.position = "static";
            document.getElementById("cmbDestHome").style.width = "90px";
            
        }
    }
    //--------------------------------------------end
   
    if (type == "normal") 
    {
        Origin = document.getElementById("cmbOriginHome").value;
        Dest = document.getElementById("cmbDestHome");
    }
     else if (type == "bestfare") 
     {

         if (criteria != undefined) {

             if (criteria == "nosrc") {

                 Origin = document.getElementById("cmbOriginHome").value;
                 Dest = document.getElementById("cmbDestHome");

             }

             else {
                 Origin = criteria;
                 Dest = document.getElementById("cmbDestHome");
             }
         }

         else {
             Origin = document.getElementById("ctl00_cmbOrigin").value;
             Dest = document.getElementById("ctl00_cmbDest");
         }
     }

//     if (criteria != undefined) {

//         //Origin = document.getElementById("cmbOriginHome").value;
//         Dest = document.getElementById("cmbDestHome");
//         Origin = criteria;
//         
//     }

    if (Origin == "From") {
        Dest.options.length = 1;
        return false;
     }
    
    
    // source/destinations  changed for all on  4/4/2011
    if (Origin == "BOM") {

        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;

        addDEL(type);
        addAMD();
        addIXB();
        addBLR();
        addIXC();
        addCOK();
        addGOI();
        addGAU();
        addJAI();
        addIXJ();
        addIXL();
        addLKO();
        addNAG();
        addNDC();
        addPAT();
         addIXR();
        addSXR();
        return false;
    }
    if (Origin == "AMD") {
        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;
addDEL(type);
        addBLR();
        addCOK();
addGOI();
        addBOM(type);
                addPAT();
     
     addPNQ();
           addIXR();
        
        return false;
    }
    if (Origin == "IXC") {
        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;
  addAMD();
        addBLR();
        addCOK();
 addDEL(type);
  addGOI();
        addBOM(type);
        addNAG();
        addNDC();
        
        return false;

    }
    if (Origin == "GOI") {
        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;
 addAMD();
   addBLR();
   addIXC();
      addCOK();
        addDEL(type);
     
 addLKO();
        addBOM(type);
        addNAG();
        addNDC();
      
        return false;
    }
    if (Origin == "IXJ") {
        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;
        addBLR();
        addDEL(type);
        addGOI();
        	addCCU();
        	     addLKO();
        addBOM(type);
          addPAT();
        addPNQ();
        addSXR();
        return false;
    }
    if (Origin == "PAT") {
        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;
             addAMD();
        addBLR();
        addDEL(type);
 addGOI();
 addIXJ();
        addBOM(type);
        addPNQ();
         addIXR();
        addSXR();
        return false;

    }
    if (Origin == "IXB") {
        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;
        addBLR();                                   
        addDEL(type);
           addGOI();
        addGAU();
        addBOM(type);
        addPNQ();
        
        return false;
    }
    if (Origin == "COK") {
        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;
        addAMD();
        addBLR();
        addDEL(type);
        addBOM(type); 
        
        return false;
    }
    if (Origin == "GAU") {
        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;
        addIXB();
        addBLR();
        addDEL(type);
         addGOI();
        addBOM(type);   
        addPNQ();
       
        return false;

    }
    if (Origin == "IXL") {
        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;
            
        addBLR();
        addDEL(type);
        addGOI();
        addIXJ();
        addBOM(type);
        addPAT();
        return false;

    }
    if (Origin == "NAG") {
        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;
        addBLR();
        addDEL(type);
        addGOI();
        addJAI();
        addBOM(type);
        addNDC();
        return false;
    }
    if (Origin == "PNQ") {
        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;
                addAMD();
                    addBLR();
        addIXC();
        addDEL(type);
        addCCU();
addPAT();
addIXR();
       
        return false;

    }
    if (Origin == "BLR") {
        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;
        addAMD();
        addIXC();
        addCOK();
        addDEL(type);
        addGOI();
        addJAI();
        addIXJ();
  addCCU();
        addLKO();
        addBOM(type);
        addNAG();
        addNDC();
        addPAT();
            addPNQ();
            addIXR();
        addSXR();
        return false;
    }
    if (Origin == "DEL") {
        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;
addAMD();
         addIXB();
         addBLR();
         addIXC();
         addCOK();
         addGAU();
         addGOI();
         addIXJ();
         addIXL();
	addCCU();
         addLKO();
         addBOM(type);  
         addNAG();
         addNDC();
         addPAT();
addIXZ();
         addPNQ();
addIXR();
         addSXR();
        return false;


    }
    if (Origin == "JAI") {
        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;
        addBLR();
        addBOM(type); 
        addNAG();
        addNDC();
      
        return false;
    }

 if (Origin == "CCU") {
        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;
addBLR();
            addIXC();
        addDEL(type);
         addLKO();
        addIXZ();
            addPNQ();
      
        return false;
    }



 if (Origin == "IXZ") {
        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;
         addDEL(type);
        addCCU();
      
        return false;
    }


 if (Origin == "IXR") {
        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;
         addAMD();
          addBLR();
        addDEL(type);
        addIXJ();
       addBOM(type);
        addSXR();
        return false;
    }


    if (Origin == "LKO") {
        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;
        addIXB();
        addBLR();
        addDEL(type);
     
        addGOI();
   addGAU();
        addIXJ();
        addBOM(type);  
        addPNQ();
         addSXR();
        return false;
    }
    if (Origin == "NDC") {
        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;
        addBLR();
        addDEL(type);
        addGOI();
        addJAI();
        addBOM(type);
        addNAG();
        return false;
    }
    if (Origin == "SXR") {
        if (type == "normal")
            Dest.options.length = 1;
        else if (type == "bestfare")
            Dest.options.length = 0;
        addBLR();
        addIXC();
        addDEL(type);
        addGOI();
        addIXJ();
        addCCU();
        addLKO();
        addBOM(type);
         addPAT();
        addPNQ();
        return false;
    }

    
}

function addAMD() {
    option = document.createElement('option');
    option.value = "AMD";
    option.innerHTML = "AHMEDABAD";
    Dest.appendChild(option);
}

function addIXC() {
    option = document.createElement('option');
    option.value = "IXC";
    option.innerHTML = "CHANDIGARH";
    Dest.appendChild(option);
}

function addGOI() {
    option = document.createElement('option');
    option.value = "GOI";
    option.innerHTML = "GOA";
    Dest.appendChild(option);
}

function addIXJ() {
    option = document.createElement('option');
    option.value = "IXJ";
    option.innerHTML = "JAMMU";
    Dest.appendChild(option);
}

function addBOM(type) {
    option = document.createElement('option');
    option.value = "BOM";
    if (type == "normal")
        option.innerHTML = "MUMBAI"
    else if (type == "bestfare")
        option.innerHTML = "MUMBAI";
    Dest.appendChild(option);
}


function addPAT() {
    option = document.createElement('option');
    option.value = "PAT";
    option.innerHTML = "PATNA";
    Dest.appendChild(option);
}

function addIXB() {
    option = document.createElement('option');
    option.value = "IXB";
    option.innerHTML = "BAGDOGRA";
    Dest.appendChild(option);
}

function addCOK() {
    option = document.createElement('option');
    option.value = "COK";
    option.innerHTML = "COCHIN";
    Dest.appendChild(option);
}

function addGAU() {
    option = document.createElement('option');
    option.value = "GAU";
    option.innerHTML = "GUWAHATI";
    Dest.appendChild(option);
}

function addIXL() {
    option = document.createElement('option');
    option.value = "IXL";
    option.innerHTML = "LEH";
    Dest.appendChild(option);
}

function addNAG() {
    option = document.createElement('option');
    option.value = "NAG";
    option.innerHTML = "NAGPUR";
    Dest.appendChild(option);
}


function addPNQ() {
    option = document.createElement('option');
    option.value = "PNQ";
    option.innerHTML = "PUNE";
    Dest.appendChild(option);
}

function addBLR() {
    option = document.createElement('option');
    option.value = "BLR";
    option.innerHTML = "BENGALURU";
    Dest.appendChild(option);
}

function addDEL(type) {
    option = document.createElement('option');
    option.value = "DEL";
    
    if (type == "normal") {
        option.innerHTML = "DELHI";
    }

    else if (type == "bestfare") {
    option.innerHTML = "DELHI";
    
    }
    Dest.appendChild(option);
}

function addJAI() {
    option = document.createElement('option');
    option.value = "JAI";
    option.innerHTML = "JAIPUR";
    Dest.appendChild(option);
}

function addLKO() {
    option = document.createElement('option');
    option.value = "LKO";
    option.innerHTML = "LUCKNOW";
    Dest.appendChild(option);
}

function addNDC() {
    option = document.createElement('option');
    option.value = "NDC";
    option.innerHTML = "NANDED";
    Dest.appendChild(option);
}

function addSXR() {
    option = document.createElement('option');
    option.value = "SXR";
    option.innerHTML = "SRINAGAR";
    Dest.appendChild(option);
}

function addCCU() {
    option = document.createElement('option');
    option.value = "CCU";
    option.innerHTML = "KOLKATA";
    Dest.appendChild(option);
}
function addIXZ() {
    option = document.createElement('option');
    option.value = "IXZ";
    option.innerHTML = "PORT BLAIR";
    Dest.appendChild(option);
}

function addIXR() {
    option = document.createElement('option');
    option.value = "IXR";
    option.innerHTML = "RANCHI";
    Dest.appendChild(option);
}


