if ($.cookie('BETA-CACHE') == '1') {
  $.cookie('BETA-CACHE', 1, { 'path': '/', 'expires': 180 });
  if (!window.google || !google.gears) {
    if (confirm('Malaysiakini Webcache Bete required Google Gears. Install Google Gears now?')) {
      window.location = 'http://gears.google.com/?action=install';
    }
  } else {
    if (google.gears.factory.getPermission('Malaysiakini Webcache Beta','','Enable Gears in order to use Malaysiakini Webcache Beta.')) {
      var ls = google.gears.factory.create('beta.localserver');
      var lc = ls.createManagedStore('malaysiakini-cache');
      lc.manifestUrl = '/beta/manifest_my.txt';
      lc.checkForUpdate();
    }
  }
}