// --- [start /site/dpScripts.js] ---
/* [JF] 2009-09-14 Temporary function for testing only (this goes out in conjunction with 'AJAX-polled Interstitial dark page' ....) */
lm.form.interstitialDB=function() {
    
    var eleFormCon, eleFieldset; /* 'eleFormCon' means 'Form Container for new radio boxes' i.e. a 'FORM' HTML tag. */
    if (lm.querystring.IAPBUG)  /* Stands for InterstitialAJAXPolling debug ... i.e. a querystring param that will put the form in debug mode for the AJAX Polling-for-Redirect functionality. */
    {
        //add in two radio buttons to end of the form.
        eleFormCon = document.forms[1]; /* The second form always seems to be the search form. */

        if (eleFormCon && ((eleFormCon.name.toLowerCase()).indexOf('search') !== -1) || ((eleFormCon.id.toLowerCase()).indexOf('search') !== -1))
        {
            eleFieldset = new lm.element.block( {
                                    p:eleFormCon.id,
                                    id:'IAPorStdDEBUG',
                                    className:'clearFloat',
                                    tagName:'fieldset',
                                    styles: {'display':'block'},
                                    innerHTML:'<label style="display: block;" for="IAPEBUGId">Interstitial Redirect Provided By AJAX :  <input onclick="lm.form.interstitialDB.InsAJAXPollAction(this.form);" type="radio" value="0" id="IAPEBUGId" name="IAPorStdDEBUG" /></label><label for="IStdDEBUGId" style="display: block;">Interstitial Redirect (standard mechanism) :  <input type="radio" onclick="lm.form.interstitialDB.InsStandardAction(this.form,\'' + eleFormCon.action + '\');" selected="selected" name="IAPorStdDEBUG" id="IStdDEBUGId" checked="checked" value="1" /></label>'
                                  } );
        } //End if 
    } //End if...
    lm.form.interstitialDB.InsAJAXPollAction = function (eleForm){
        eleForm.action=location.protocol+'//'+frontierHTTPHost+frontierBaseUrl+'/travel/packaging/secret_interstitial_page.html';
        eleForm.setAttribute('action', location.protocol+'//'+frontierHTTPHost+frontierBaseUrl+'/travel/packaging/secret_interstitial_page.html');
    };

    lm.form.interstitialDB.InsStandardAction = function(eleForm,sDefaultAct){ /* 'Interstitial Standard Action()' */
        eleForm.action=sDefaultAct;
        eleForm.setAttribute('action', sDefaultAct);
    };
}; //End static method 'lm.form.interstitialDB()'

/* Invoke temporary debug function for AJAX-institional redirect. */
lm.addEvent({fn:lm.form.interstitialDB});

// This function checks to see if the user has entered a short haul destination.
// If so, the direct flight only check box is checked.


function checkShortHaul(destination){
	var depAirport='LON,LGW,LHR';
				var destinationsArray = shortHaulDestinations.split(',') ;
				var destinationsDropdown = lm.e('destination');
				var destination = destinationsDropdown.options[destinationsDropdown.selectedIndex].text;
				var departureDropdown = lm.e('departurePoint');
				var departurePoint = departureDropdown.options[departureDropdown.selectedIndex].value;
				for (i=0;i<=destinationsArray.length;i++){
					if (destination.indexOf(destinationsArray[i])!=-1 && depAirport.indexOf(departurePoint)!=-1){
						lm.e('directFlights').checked=true;
						break;
					}else{
						lm.e('directFlights').checked=false;
					}
				}
			}

lm.addEvent({fn:function(){
if(lm.e("directFlights")){
	checkShortHaul();
        lm.addEvent({e:'destination', eT:'change', fn:checkShortHaul})
}
}})
// --- [end prdpctbd6008:5001 - /site/dpScripts.js - Nov 20, 2009 9:32 pm GMT - v1-akamaitech,akamai,pct5,pct0410 - NIGjRQqoTFYAAFS3vu0AADA2 - cache 1800 ] ---
