/*========================================================================================
  
$rcsfile: TripPlannerSearchInput.js $

$Revision: 1.1 $ $Date: 2008/02/15 03:53:03 $

Summary:	JavaScript file for the AvailabilitySearchInput control. Content moved from the C# code.

------------------------------------------------------------------------------------------
This file is part of the Navitaire NewSkies application.
Copyright (C) Navitaire.  All rights reserved.
========================================================================================*/

//TripPlanner Utilities...
function SetNextOrigin(object)
{
    var index =  object.id.substring(object.id.length - 1);   
    if(index >= 0)
    {
        // get next origin
        var nextIndex = index*1+1;
        var nextOrig = document.getElementById(applicationJavaScriptHtmlId + '_TextBoxMarketOrigin' + nextIndex);
        var nextListOrig = document.getElementById(applicationJavaScriptHtmlId + '_DropDownListMarketOrigin' + nextIndex);
        
        // then make sure the value of current object should be equal to the next origin.
        if (nextListOrig)
        {
            nextListOrig.selectedIndex=findIndexByValue(nextListOrig, object.value);
        }
        if (nextOrig)
        {
            nextOrig.value=object.value;
        }
    }
}

function AddNewMarket(caller)
{
    //get last index of market set...     
    if (lastIndex <= applicationNumberOfMarketsToOffer)
    {
        HideShowMarket(lastIndex, 'inline')
        if (lastIndex == applicationNumberOfMarketsToOffer)
        {
	        var addMarketButton = document.getElementById('addNewMarketGroup');	        
	        if (addMarketButton) addMarketButton.style.display = 'none';
        }
        lastIndex++;
        
    }
}


function InitializeTripPlanner()
{
    // only show the next journey of the current journey index    
    if (tripPlannerSwitch == true)
    {       
        for (mktIx=1; mktIx<=applicationNumberOfMarketsToOffer; mktIx++)
        {
            if (tripPlannerCurrentJourneyIndex+1 == mktIx)
            {
                HideShowMarket(mktIx, 'inline');
            }
            else
            {
                HideShowMarket(mktIx, 'none');
            }        	
        }		
    }
    
}

function SetCurrentJourney()
{
    var appendUrl = '&currentJourneyIndex=';
}
 
//variable for tripplanner
var lastIndex = applicationDefaultNumMarket+1;
