/**
 * This method will be invoked to disable tripType(oneway and multicity) if user 
 * selected Calendar or Flex as shop type. Also we have to take care of case when
 * user is using saved trip template to perform search. In that case we have to disable
 * one-way and multicity always.
 * @param String schedule elements id name
 * @param String price elements id name
 * @param String flex elements id name
 * @param String cal elements id name
 * @param String true or false indicating whether this is a trip template
 */
function disableTripTypeIfReq(schedule, price, flex, cal,isThisTT){
    //obtain handle to one-way and multi-city
    oneWayTT = document.getElementById("oneway");
	 if (document.getElementById("multicity")){
    	multiCityTT = document.getElementById("multicity");
	 }
    flexShopType = document.getElementById(flex);
    calShopType = document.getElementById(cal);
    scheduleShopType = document.getElementById(schedule);
    priceShopType = document.getElementById(price);
    if((flexShopType !=null && flexShopType.checked) || (calShopType != null && calShopType.checked)){
        // disable one way and roundtrip
        oneWayTT.disabled = true;
		  if (document.getElementById('multicity')){
        		chkTagTpe=document.getElementById('multicity').tagName;
				if (chkTagTpe=='LI') {
					MulCVal=document.getElementById('multicity');
					MulCVal=MulCVal.lastChild;
					MulCVal.href='#';
					MulCVal.style.textDecoration='none';					
				}
				else {
				multiCityTT.disabled = true;
				}
			}	
    }else if((isThisTT == "false") && (scheduleShopType.checked || priceShopType.checked) ){
        //enable all trip type options only if this is not trip type
        oneWayTT.disabled = false;
		  if (document.getElementById("multicity")){
		  		chkTagTpe=document.getElementById('multicity').tagName;
				if (chkTagTpe=='LI') {
					MulCVal=document.getElementById('multicity');
					MulCVal=MulCVal.lastChild;
					MulCVal.href='javascript:submitTedFormToRegularShopping();';
					MulCVal.style.textDecoration='underline';
				}
				else {
        		multiCityTT.disabled = false;
				}
		  }
    }   
}
