var uic_tabs = new Array('knaresborough','ripon','wakefield');

function switch_tab_home(which) {
  for(var i in uic_tabs) if (typeof uic_tabs[i] == 'string' && typeof document.getElementById('uic_'+uic_tabs[i]) != 'undefined') {
    document.getElementById('uic_tb_'+uic_tabs[i]).src = "/common/images/button"+uic_tabs[i]+"Red.gif";
    document.getElementById('uic_'+uic_tabs[i]).style.display = 'none';
  }
  document.getElementById('uic_tb_'+which).src = "/common/images/button"+which+"Grey.gif";
  document.getElementById('uic_'+which).style.display = 'inline';
}

// ------------------------------------------

function carlocator_add_to_favourites(vehicle_id,userid) {
  if (isNaN(vehicle_id)) {
    return false;
  }

  ajax  = new sack();
  ajax.onLoading    = function() { };
  ajax.onCompletion = function() {
//                         carlocator_load_favourites();
                        alert(ajax.response);
                        return true;
                      };
  ajax.requestFile  = '/ajax/carlocator_useraction.php?action=2&vehicle_id='+vehicle_id+'&userid='+userid;
  ajax.runAJAX();
}

function carloctor_load_favourites() {
  ajax  = new sack();
  ajax.onLoading    = function() { };
  ajax.onCompletion = function() {
                        alert('Favourites: loaded!');
                        return true;
                      }
  ajax.requestFile  = '/ajax/carlocator_load_favourites.php';
  ajax.runAJAX();
}