  function expand(id){

  styleObj=document.getElementById(id).style;

  if (styleObj.display=='none')
  {
   styleObj.display='';
   document.getElementById("expander-"+id).src = "http://www.glug.co.uk/wp/wp-content/themes/glug2/images/tripicons/ExpandUp.gif";
   document.getElementById("expander-"+id).title = "Collapse Trip Information";
  }
  else {
   styleObj.display='none';
   document.getElementById("expander-"+id).src = "http://www.glug.co.uk/wp/wp-content/themes/glug2/images/tripicons/ExpandDown.gif";
   document.getElementById("expander-"+id).title = "Expand Trip Information";
  }
  }
  function postwith (to,p) {
  var myForm = document.createElement("form");
  myForm.method="post" ;
  myForm.action = to ;
  for (var k in p) {
    var myInput = document.createElement("input") ;
    myInput.setAttribute("name", k) ;
    myInput.setAttribute("value", p[k]);
    myForm.appendChild(myInput) ;
  }
  document.body.appendChild(myForm) ;
  myForm.submit() ;
  document.body.removeChild(myForm) ;
}
function interact(trip,mode)
{
         if (mode == 'book')
         {
            document.getElementById('mode').value= "booking";
         }
         if (mode == 'interact')
         {
            document.getElementById('mode').value= "interact";
         }
         document.getElementById('tripNumber').value = trip;
         document.trip_user_form.submit();
}

function action(type,trip,policy)
{
 var message = "";
 switch (type)
 {
  case 'interest':
       message = "Note: Registering an interest does NOT reserve or book a place on the trip nor does it commit you to anything. It is nothing more than an expression of interest";
       break;

  case 'can_interest':
       message = "Are you sure you want to cancel your interest in this trip?";
       break;

  case 'booking':
       message = "Booking a place on a trip involves a financial commitment. You must familiarise yourself with the minimum required experiance/diving qualifiction (if any) and the cancellation policies for this trip before proceeding. Booking confirmation takes place on the next screen - clicking 'ok' does NOT complete a booking.";
       break;

  case 'bookingConfirm':
       message = "This will complete your booking and reserve you a place on the trip. The stated cancellation policy comes into force immediately.";
       break;

  case 'cancelBooking':
       if(policy == 1 || policy == 3)
       {
                 message = "Subject to the cancellation policy (if any) shown, you may cancel your place on this without financial penalty. Proceeding will cancel your booking, including any information collected during the booking process. Are you sure you wish to cancel your booking for this trip?";
       }
       else
       {
                 message = "The trip organiser has indicated that cancelling your place on this trip will result in a financial penalty of some sort. Please refer to the cancellation policy shown and/or other trip documentation for details. Proceeding will cancel your booking, including any information collected dueing the booking process. Are you sure you wish to cancel your place?";
       }
       break;

  case 'surrender':
       if(policy == 1 || policy == 3)
       {
                 message = "Offering to surrender your place allows any other member to claim your place. If there is a reserve list, your place will automatically be given to the next member in line on that list. The trip organiser has indicated that there is no financial penalty associated with the resulting effective cancellation of your place. There is no guarntee that your place will be claimed in which case your booking stands and you remain liable for the cost of the place. You can withdraw your offer to surrender at any time. Are you sure you want to offer to surrender your place on this trip?";
       }
       else
       {
                 message = "Offering to surrender your place allows any other member to claim your place. If there is a reserve list, your place will automatically be given to the next member in line on that list. The trip organiser has indicated that there is a financial penalty associated with the resulting effective cancellation of your place, please refer to the cancellation policy shown for details. There is no guarntee that your place will be claimed in which case your booking stands and you remain liable for the cost of the place. You can withdraw your offer to surrender at any time. Are you sure you want to offer to surrender your place on this trip?";
       }
       break;

  case 'can_surrender':
       message = "Are you sure you wish to withdraw your offer to surrender your place on this trip?";
       break;

  case 'rem_reserve':
       message = "Are you sure you wish to remove your name from the reserves list for this trip?";
       break;
 }
 if(confirm(message))
 {
       document.getElementById('mode').value= type;
       document.getElementById('tripNumber').value = trip;
       document.trip_user_form.submit();
 }
}
