function removeOption (destinationSelect, holidaySelect) {

   var dropDownValue = document.getElementById(destinationSelect).value;
   var elSel = document.getElementById(holidaySelect);

   if (elSel(3).text != 'Island Escapes') {
      addOption('Island Escapes',3,holidaySelect);
   }
   if (elSel(5).text != 'Rail') {
      addOption('Rail',5,holidaySelect);
   }
   if (elSel(6).text != 'Skiing') {
      addOption('Skiing',6,holidaySelect);
   }
   if (elSel(7).text != 'Short Breaks') {
      addOption('Short Breaks',7,holidaySelect);
   }
   if (dayToursFlag=='0') {
      addOption('Day Tours',9,holidaySelect);
      dayToursFlag=1;
   }
   if (attractionsFlag=='0') {
      addOption('Attractions',10,holidaySelect);
      attractionsFlag=1;
   }   

   if (dropDownValue == 'Canada' || dropDownValue == 'Europe' || dropDownValue == 'USA' ) { 
      elSel.remove(3);
      elSel.remove(6);
      elSel.remove(7);
      elSel.remove(7);
      dayToursFlag=0;
      attractionsFlag=0;
   }
   if (dropDownValue == 'Africa') { 
      elSel.remove(3);
      elSel.remove(5);
      elSel.remove(5);
      elSel.remove(6);
      elSel.remove(6);
      dayToursFlag=0;
      attractionsFlag=0;
   }
   if (dropDownValue == 'New+Zealand') { 
      elSel.remove(9);
      elSel.remove(9);
      dayToursFlag=0;
      attractionsFlag=0;
   }
   if (dropDownValue == 'Asia') { 
      elSel.remove(9);
      elSel.remove(9);
      dayToursFlag=0;
      attractionsFlag=0;
   }
   if (dropDownValue == 'America') { 
      elSel.remove(3);
      elSel.remove(4);
      elSel.remove(4);
      elSel.remove(4);
      elSel.remove(5);
      elSel.remove(5);
      dayToursFlag=0;
      attractionsFlag=0;
   }
   var selectedTextHoliday = document.getElementById(holidaySelect).value;

   if (dropDownValue == 'blank') {
         var selObj2 = document.getElementById(destinationSelect);
	selObj2.selectedIndex = 0;
   }
}

function destinationOption (destinationSelect, holidaySelect) {
   var selectedTextHoliday = document.getElementById(holidaySelect).value;

   if (selectedTextHoliday == 'Day+Tour' || selectedTextHoliday == 'Attractions') {
   	var selObj = document.getElementById(destinationSelect);
	selObj.selectedIndex = 1;
   }
   if (selectedTextHoliday == 'Attractions' || selectedTextHoliday == 'Attractions') {
   	var selObj = document.getElementById(destinationSelect);
	selObj.selectedIndex = 1;
   }
}

function addOption (label, num, holidaySelect) {

   var elSel = document.getElementById(holidaySelect);

   if (elSel.selectedIndex >= 0) {
      var elOptNew = document.createElement('option');
      elOptNew.text = label;
      elOptNew.value = label;
      var elOptOld = elSel.options[num];  
      try {
         elSel.add(elOptNew, elOptOld); // standards compliant; doesn't work in IE
      }
   catch(ex) {
      elSel.add(elOptNew, num); // IE only
      }
   }
}

function changeDestinationString (destinationSelect, holidaySelect, dealFinderLocation) {

   var targetURL = "";
   if (dealFinderLocation == 'top') {
      targetURL = "http://www.racq.com.au/travel?";
   }
   else { targetURL = "http://www.racq.com.au/travel/deal_finder?"; }
   var selectedTextDestination = "queries_destination_query=";
   var selectedTextHolidayType = "&queries_holidaytype_query=";
   selectedTextDestination = selectedTextDestination + document.getElementById(destinationSelect).value;
   selectedTextHolidayType = selectedTextHolidayType + document.getElementById(holidaySelect).value;
   targetURL = targetURL + selectedTextDestination + selectedTextHolidayType;
   if (dealFinderLocation == 'top') {
      location.href = targetURL; 
   }
   else {
      location.href = targetURL;
   }
}



function activateBrowseTab (destination,holidaytype) {

var selObjDestination = document.getElementById('destinationDropDownTop');
var selObjHolidayType = document.getElementById('holidayTypeDropDownTop');

switch (destination)
{
case 'Asia':
  selObjDestination.selectedIndex = 4;
  break;
case 'Africa':
  selObjDestination.selectedIndex = 9;
  break;
case 'Australia':
  selObjDestination.selectedIndex = 1;
  break;
case 'Europe':
  selObjDestination.selectedIndex = 5;
  break;
case 'USA':
  selObjDestination.selectedIndex = 6;
  break;
case 'New Zealand':
  selObjDestination.selectedIndex = 2;
  break;
case 'Canada':
  selObjDestination.selectedIndex = 7;
  break;
case 'America':
  selObjDestination.selectedIndex = 8;
  break;
default:
  selObjDestination.selectedIndex = 0;
}

switch (holidaytype)
{
case 'Adventures':
  selObjHolidayType.selectedIndex = 1;
  break;
case 'Cruises':
  selObjHolidayType.selectedIndex = 2;
  break;
case 'Island Escapes':
  selObjHolidayType.selectedIndex = 3;
  break;
case 'Tours':
  selObjHolidayType.selectedIndex = 4;
  break;
case 'Rail':
  selObjHolidayType.selectedIndex = 5;
  break;
case 'Skiing':
  selObjHolidayType.selectedIndex = 6;
  break;
case 'Short Breaks':
  selObjHolidayType.selectedIndex = 7;
  break;
case 'Packages':
  selObjHolidayType.selectedIndex = 8;
  break;
case 'Day Tour':
  selObjHolidayType.selectedIndex = 9;
  break;
case 'Attractions':
  selObjHolidayType.selectedIndex = 10;
  break;
default:
  selObjHolidayType.selectedIndex = 0;
   }
}

function noResultString (destinationString, holidayTypeString) {

if (holidayTypeString != '') {
   holidayTypeString = "<strong>" + holidayTypeString + "</strong>";   
   if (destinationString != '') {
      holidayTypeString = holidayTypeString + " in ";  
      destinationString = "<strong>" + destinationString + "</strong>";
   }
}
document.write("Although we could not find any results for your search on this website, we have many of these deals available in store. Please <a href='https://secure.racq.com.au/ssl3/members/Apps/TravelBooking/Default.aspx?p=%globals_asset_name%&cms=%globals_asset_url%'>enquire online</a> or <a href='http://www.racq.com.au/travel/contact_us'>contact us</a> and one of our experienced Travel Agents will supply you with some great deals to inspire your next holiday.");

}

function calculateLinkNumber (destinationName, groupCount) {

var linkNumber = '';

switch (destinationName)
{
case 'Australian Holidays':
  linkNumber = "http://www.racq.com.au/travel/australian_holidays";
  break;
case 'Overseas Holidays':
  linkNumber = "./?a=64876";
  break;
case 'Cruises':
  linkNumber = "./?a=66621";
  break;
case 'Discount Tickets':
  linkNumber = "http://www.racq.com.au/travel/discount_tickets";
  break;
case 'USA':
  linkNumber = "./?a=64907";
  break;
case 'New Zealand & South Pacific':
  linkNumber = "./?a=64911";
  break;
case 'Canada':
  linkNumber = "./?a=64915";
  break;
case 'South & Central America':
  linkNumber = "./?a=64923";
  break;
default:
  linkNumber = "#";
}
   if (destinationName.indexOf(";") == -1 ) {
      if (groupCount == '1') {
         document.write("<h2><a href='" + linkNumber + "'>" + destinationName + " </a> (" + groupCount + " result)</h2>");
      } 
      else {
         document.write("<h2><a href='" + linkNumber + "'>" + destinationName + " </a> (" + groupCount + " results)</h2>");
      }
   }
   else {
     if (groupCount == '1') {
         document.write("<h2><a href='http://www.racq.com.au/travel/cruises'>Cruises</a> (" + groupCount + " result)</h2>");
      } 
      else {
         document.write("<h2><a href='http://www.racq.com.au/travel/cruises'>Cruises</a> (" + groupCount + " results)</h2>");
      }
   }
}
