function validate_postcode(frm) {
  var postcode = $(frm).down('.postcode').value;
  if(postcode.length < 5)
  {
    display_notification('The post/zip code you entered is too short, please check it and try again.');
    return false;
  }
  
  if(postcode.length > 9)
  {
    display_notification('The post/zip code you entered is too long, please check it and try again.');
    return false;
  }
  
  frm.submit();
}

function change_page(page_num){
  $('postcode_form_small').down().value = page_num;
  $('postcode_form_small').submit();
}

function marker_added(marker,id) {
  // when i marker is added to the gmap, check to see if it is one of the 4 possible results on the left hand side
  if($('dealer_'+id)){
    // if it is one of the results enable the show map link and attach a gmap event to the link    
    Event.observe($('dealer_'+id).down('.map_link'),'click',function(){
      GEvent.trigger(marker,'click');
    });
    
    // if this is the first dealer in the list then show marker
    if($('dealer_'+id) == $$('.dealer')[0]){
      GEvent.trigger(marker,'click');      
    }
  }
}