checkMyTripForm = function(){
	inputEls = document.getElementsByTagName('input');
	for(i=0;i<inputEls.length;i++){
		if(inputEls[i].type == 'text' && inputEls[i].value.length<=0){
			alert('Please fill in all form sections noted with a *');
			return false;
		}
	}
	if(!validEmail($('email').value)){
		alert('Please use a valid email address');
		return false;
	}else{
		return true;
	}
}  

validEmail = function(emailAddress){
	if((emailAddress.indexOf(".") > 0) && (emailAddress.indexOf("@") > 0)){
		return true;
	}else{
		return false;
	}
}

  Behaviour.register({
      '#go_i_want_to': function(el) { 
        el.onclick = function() {
          selected_option = document.getElementById('search_i_want_to').value;
          window.location.href='/discover/trips/'+selected_option+'/';
        }
      },
      '#go_passion_is': function(el) { 
        el.onclick = function() {
          selected_option = document.getElementById('search_passion_is').value;
          window.location.href='/discover/trips/'+selected_option+'/';
        }
      },
      '#go_love_to': function(el) { 
        el.onclick = function() {
          selected_option = document.getElementById('search_love_to').value;
          window.location.href='/discover/trips/'+selected_option+'/';
        }
      },
      '.meta_searcher': function(el) { 
        el.onchange = function() {
          if(el.value=='-') return false;
          window.location.href='/discover/trips/'+el.value+'/';
        }
        el.options.selectedIndex = 0;
      },
      '#searcher_country': function(el) { 
        el.onchange = function() {
          if(el.value=='-') return false;
          window.location.href='/discover/country/'+el.value+'/';
        }
      },
      '#enquiry form': function(el) { 
        el.onsubmit = function() {
          optionInfo = '\n\n------- Option Information: --------\n';
          optionInfo += "\nDuration: " + $('searcher_duration').value;
          optionInfo += "\nAccommodation: " + $('searcher_accommodation').value;
          optionInfo += "\nTravel: " + $('searcher_travel').value;
          optionInfo += "\nBudget: " + $('searcher_budget').value;
          optionInfo += "\nDeparture month: " + $('searcher_month').value;
          optionInfo += "\nDeparture year: " + $('searcher_year').value;
          $('notes').value += optionInfo;
        }
      },
      '.action_show_member': function(el) { 
        el.onclick = function() {
					new Ajax.Updater($('member_info'), '/member/'+el.parentNode.getElementsByTagName("input")[0].value, {asynchronous:true});
          return false;
        }
      },
      '.action_new_window': function(el) { 
        el.onclick = function() {
          window.open(el.href);
          return false;
        }
      }
    });